Patchwork ext2: fix return values on parse_options() failure

login
register
mail settings
Submitter Zhao Hongjiang
Date Oct. 9, 2012, 5:44 a.m.
Message ID <5073B9C4.9070009@gmail.com>
Download mbox | patch
Permalink /patch/190211/
State Not Applicable
Headers show

Comments

Zhao Hongjiang - Oct. 9, 2012, 5:44 a.m.
From: Zhao Hongjiang <zhaohongjiang@huawei.com>

parse_options() in ext2 should return 0 when parse the mount options fails.

Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com>
---
 fs/ext2/super.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

-- 1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lukas Czerner - Oct. 9, 2012, 6:29 a.m.
On Tue, 9 Oct 2012, Zhao Hongjiang wrote:

> Date: Tue, 09 Oct 2012 13:44:36 +0800
> From: Zhao Hongjiang <zhaohongjiang37@gmail.com>
> To: jack@suse.cz
> Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
>     Eric W. Biederman <ebiederm@xmission.com>, serge.hallyn@canonical.com,
>     containers@lists.linux-foundation.org
> Subject: [PATCH] ext2: fix return values on parse_options() failure
> 
> From: Zhao Hongjiang <zhaohongjiang@huawei.com>
> 
> parse_options() in ext2 should return 0 when parse the mount options fails.
> 
> Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com>

Reviewed-by: Lukas Czerner <lczerner@redhat.com>

Thanks!
-Lukas

> ---
>  fs/ext2/super.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext2/super.c b/fs/ext2/super.c
> index 6c205d0..fa04d02 100644
> --- a/fs/ext2/super.c
> +++ b/fs/ext2/super.c
> @@ -469,7 +469,7 @@ static int parse_options(char *options, struct super_block *sb)
>  			uid = make_kuid(current_user_ns(), option);
>  			if (!uid_valid(uid)) {
>  				ext2_msg(sb, KERN_ERR, "Invalid uid value %d", option);
> -				return -1;
> +				return 0;
> 
>  			}
>  			sbi->s_resuid = uid;
> @@ -480,7 +480,7 @@ static int parse_options(char *options, struct super_block *sb)
>  			gid = make_kgid(current_user_ns(), option);
>  			if (!gid_valid(gid)) {
>  				ext2_msg(sb, KERN_ERR, "Invalid gid value %d", option);
> -				return -1;
> +				return 0;
>  			}
>  			sbi->s_resgid = gid;
>  			break;
> -- 1.7.1
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jan Kara - Oct. 9, 2012, 9:22 p.m.
On Tue 09-10-12 08:29:50, Lukáš Czerner wrote:
> On Tue, 9 Oct 2012, Zhao Hongjiang wrote:
> 
> > Date: Tue, 09 Oct 2012 13:44:36 +0800
> > From: Zhao Hongjiang <zhaohongjiang37@gmail.com>
> > To: jack@suse.cz
> > Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
> >     Eric W. Biederman <ebiederm@xmission.com>, serge.hallyn@canonical.com,
> >     containers@lists.linux-foundation.org
> > Subject: [PATCH] ext2: fix return values on parse_options() failure
> > 
> > From: Zhao Hongjiang <zhaohongjiang@huawei.com>
> > 
> > parse_options() in ext2 should return 0 when parse the mount options fails.
> > 
> > Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com>
> 
> Reviewed-by: Lukas Czerner <lczerner@redhat.com>
  Thanks, added to my tree.

									Honza

> > ---
> >  fs/ext2/super.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/ext2/super.c b/fs/ext2/super.c
> > index 6c205d0..fa04d02 100644
> > --- a/fs/ext2/super.c
> > +++ b/fs/ext2/super.c
> > @@ -469,7 +469,7 @@ static int parse_options(char *options, struct super_block *sb)
> >  			uid = make_kuid(current_user_ns(), option);
> >  			if (!uid_valid(uid)) {
> >  				ext2_msg(sb, KERN_ERR, "Invalid uid value %d", option);
> > -				return -1;
> > +				return 0;
> > 
> >  			}
> >  			sbi->s_resuid = uid;
> > @@ -480,7 +480,7 @@ static int parse_options(char *options, struct super_block *sb)
> >  			gid = make_kgid(current_user_ns(), option);
> >  			if (!gid_valid(gid)) {
> >  				ext2_msg(sb, KERN_ERR, "Invalid gid value %d", option);
> > -				return -1;
> > +				return 0;
> >  			}
> >  			sbi->s_resgid = gid;
> >  			break;
> > -- 1.7.1
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 6c205d0..fa04d02 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -469,7 +469,7 @@  static int parse_options(char *options, struct super_block *sb)
 			uid = make_kuid(current_user_ns(), option);
 			if (!uid_valid(uid)) {
 				ext2_msg(sb, KERN_ERR, "Invalid uid value %d", option);
-				return -1;
+				return 0;

 			}
 			sbi->s_resuid = uid;
@@ -480,7 +480,7 @@  static int parse_options(char *options, struct super_block *sb)
 			gid = make_kgid(current_user_ns(), option);
 			if (!gid_valid(gid)) {
 				ext2_msg(sb, KERN_ERR, "Invalid gid value %d", option);
-				return -1;
+				return 0;
 			}
 			sbi->s_resgid = gid;
 			break;