All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] cred: add missing return error code when set_cred_ucounts() failed
@ 2021-05-26 14:38 Yang Yingliang
  2021-05-26 22:10 ` Eric W. Biederman
  2021-05-28 21:22 ` Eric W. Biederman
  0 siblings, 2 replies; 6+ messages in thread
From: Yang Yingliang @ 2021-05-26 14:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: legion, ebiederm

If set_cred_ucounts() failed, we need return the error code.

Fixes: 905ae01c4ae2 ("Add a reference to ucounts for each cred")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 kernel/cred.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/cred.c b/kernel/cred.c
index db7c46bf36e5..e6fd2b3fc31f 100644
--- a/kernel/cred.c
+++ b/kernel/cred.c
@@ -372,7 +372,8 @@ int copy_creds(struct task_struct *p, unsigned long clone_flags)
 		ret = create_user_ns(new);
 		if (ret < 0)
 			goto error_put;
-		if (set_cred_ucounts(new) < 0)
+		ret = set_cred_ucounts(new);
+		if (ret < 0)
 			goto error_put;
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] cred: add missing return error code when set_cred_ucounts() failed
  2021-05-26 14:38 [PATCH -next] cred: add missing return error code when set_cred_ucounts() failed Yang Yingliang
@ 2021-05-26 22:10 ` Eric W. Biederman
  2021-05-27  8:56   ` Alexey Gladkov
  2021-05-28 21:22 ` Eric W. Biederman
  1 sibling, 1 reply; 6+ messages in thread
From: Eric W. Biederman @ 2021-05-26 22:10 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: linux-kernel, legion

Yang Yingliang <yangyingliang@huawei.com> writes:

> If set_cred_ucounts() failed, we need return the error code.

Alex how does this look to you?

This is showing up now as I have finally dropped the code in linux-next
and other people are looking at it.

At a quick fix looks correct to me.

> Fixes: 905ae01c4ae2 ("Add a reference to ucounts for each cred")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  kernel/cred.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/cred.c b/kernel/cred.c
> index db7c46bf36e5..e6fd2b3fc31f 100644
> --- a/kernel/cred.c
> +++ b/kernel/cred.c
> @@ -372,7 +372,8 @@ int copy_creds(struct task_struct *p, unsigned long clone_flags)
>  		ret = create_user_ns(new);
>  		if (ret < 0)
>  			goto error_put;
> -		if (set_cred_ucounts(new) < 0)
> +		ret = set_cred_ucounts(new);
> +		if (ret < 0)
>  			goto error_put;
>  	}

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] cred: add missing return error code when set_cred_ucounts() failed
  2021-05-26 22:10 ` Eric W. Biederman
@ 2021-05-27  8:56   ` Alexey Gladkov
  2021-05-27 16:10     ` Eric W. Biederman
  0 siblings, 1 reply; 6+ messages in thread
From: Alexey Gladkov @ 2021-05-27  8:56 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: Yang Yingliang, linux-kernel

On Wed, May 26, 2021 at 05:10:43PM -0500, Eric W. Biederman wrote:
> Yang Yingliang <yangyingliang@huawei.com> writes:
> 
> > If set_cred_ucounts() failed, we need return the error code.
> 
> Alex how does this look to you?
> 
> This is showing up now as I have finally dropped the code in linux-next
> and other people are looking at it.
> 
> At a quick fix looks correct to me.

Yes, this is the right fix. I miss it.

> > Fixes: 905ae01c4ae2 ("Add a reference to ucounts for each cred")
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> > ---
> >  kernel/cred.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/kernel/cred.c b/kernel/cred.c
> > index db7c46bf36e5..e6fd2b3fc31f 100644
> > --- a/kernel/cred.c
> > +++ b/kernel/cred.c
> > @@ -372,7 +372,8 @@ int copy_creds(struct task_struct *p, unsigned long clone_flags)
> >  		ret = create_user_ns(new);
> >  		if (ret < 0)
> >  			goto error_put;
> > -		if (set_cred_ucounts(new) < 0)
> > +		ret = set_cred_ucounts(new);
> > +		if (ret < 0)
> >  			goto error_put;
> >  	}
> 

-- 
Rgrds, legion


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] cred: add missing return error code when set_cred_ucounts() failed
  2021-05-27  8:56   ` Alexey Gladkov
@ 2021-05-27 16:10     ` Eric W. Biederman
  2021-05-28 11:40       ` Alexey Gladkov
  0 siblings, 1 reply; 6+ messages in thread
From: Eric W. Biederman @ 2021-05-27 16:10 UTC (permalink / raw)
  To: Alexey Gladkov; +Cc: Yang Yingliang, linux-kernel

Alexey Gladkov <legion@kernel.org> writes:

> On Wed, May 26, 2021 at 05:10:43PM -0500, Eric W. Biederman wrote:
>> Yang Yingliang <yangyingliang@huawei.com> writes:
>> 
>> > If set_cred_ucounts() failed, we need return the error code.
>> 
>> Alex how does this look to you?
>> 
>> This is showing up now as I have finally dropped the code in linux-next
>> and other people are looking at it.
>> 
>> At a quick fix looks correct to me.
>
> Yes, this is the right fix. I miss it.


Can I have your Acked-by or Reviewed-by.
Thank you.

>> > Fixes: 905ae01c4ae2 ("Add a reference to ucounts for each cred")
>> > Reported-by: Hulk Robot <hulkci@huawei.com>
>> > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> > ---
>> >  kernel/cred.c | 3 ++-
>> >  1 file changed, 2 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/kernel/cred.c b/kernel/cred.c
>> > index db7c46bf36e5..e6fd2b3fc31f 100644
>> > --- a/kernel/cred.c
>> > +++ b/kernel/cred.c
>> > @@ -372,7 +372,8 @@ int copy_creds(struct task_struct *p, unsigned long clone_flags)
>> >  		ret = create_user_ns(new);
>> >  		if (ret < 0)
>> >  			goto error_put;
>> > -		if (set_cred_ucounts(new) < 0)
>> > +		ret = set_cred_ucounts(new);
>> > +		if (ret < 0)
>> >  			goto error_put;
>> >  	}
>> 

Eric

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] cred: add missing return error code when set_cred_ucounts() failed
  2021-05-27 16:10     ` Eric W. Biederman
@ 2021-05-28 11:40       ` Alexey Gladkov
  0 siblings, 0 replies; 6+ messages in thread
From: Alexey Gladkov @ 2021-05-28 11:40 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: Yang Yingliang, linux-kernel

On Thu, May 27, 2021 at 11:10:27AM -0500, Eric W. Biederman wrote:
> Alexey Gladkov <legion@kernel.org> writes:
> 
> > On Wed, May 26, 2021 at 05:10:43PM -0500, Eric W. Biederman wrote:
> >> Yang Yingliang <yangyingliang@huawei.com> writes:
> >> 
> >> > If set_cred_ucounts() failed, we need return the error code.
> >> 
> >> Alex how does this look to you?
> >> 
> >> This is showing up now as I have finally dropped the code in linux-next
> >> and other people are looking at it.
> >> 
> >> At a quick fix looks correct to me.
> >
> > Yes, this is the right fix. I miss it.
> 
> 
> Can I have your Acked-by or Reviewed-by.
> Thank you.

Yes.

Reviewed-by: Alexey Gladkov <legion@kernel.org>
Acked-by: Alexey Gladkov <legion@kernel.org>

> >> > Fixes: 905ae01c4ae2 ("Add a reference to ucounts for each cred")
> >> > Reported-by: Hulk Robot <hulkci@huawei.com>
> >> > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> >> > ---
> >> >  kernel/cred.c | 3 ++-
> >> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >> >
> >> > diff --git a/kernel/cred.c b/kernel/cred.c
> >> > index db7c46bf36e5..e6fd2b3fc31f 100644
> >> > --- a/kernel/cred.c
> >> > +++ b/kernel/cred.c
> >> > @@ -372,7 +372,8 @@ int copy_creds(struct task_struct *p, unsigned long clone_flags)
> >> >  		ret = create_user_ns(new);
> >> >  		if (ret < 0)
> >> >  			goto error_put;
> >> > -		if (set_cred_ucounts(new) < 0)
> >> > +		ret = set_cred_ucounts(new);
> >> > +		if (ret < 0)
> >> >  			goto error_put;
> >> >  	}
> >> 
> 
> Eric
> 

-- 
Rgrds, legion


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] cred: add missing return error code when set_cred_ucounts() failed
  2021-05-26 14:38 [PATCH -next] cred: add missing return error code when set_cred_ucounts() failed Yang Yingliang
  2021-05-26 22:10 ` Eric W. Biederman
@ 2021-05-28 21:22 ` Eric W. Biederman
  1 sibling, 0 replies; 6+ messages in thread
From: Eric W. Biederman @ 2021-05-28 21:22 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: linux-kernel, legion

Yang Yingliang <yangyingliang@huawei.com> writes:

> If set_cred_ucounts() failed, we need return the error code.
>
> Fixes: 905ae01c4ae2 ("Add a reference to ucounts for each cred")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Applied thanks.
> ---
>  kernel/cred.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/cred.c b/kernel/cred.c
> index db7c46bf36e5..e6fd2b3fc31f 100644
> --- a/kernel/cred.c
> +++ b/kernel/cred.c
> @@ -372,7 +372,8 @@ int copy_creds(struct task_struct *p, unsigned long clone_flags)
>  		ret = create_user_ns(new);
>  		if (ret < 0)
>  			goto error_put;
> -		if (set_cred_ucounts(new) < 0)
> +		ret = set_cred_ucounts(new);
> +		if (ret < 0)
>  			goto error_put;
>  	}

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-28 21:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26 14:38 [PATCH -next] cred: add missing return error code when set_cred_ucounts() failed Yang Yingliang
2021-05-26 22:10 ` Eric W. Biederman
2021-05-27  8:56   ` Alexey Gladkov
2021-05-27 16:10     ` Eric W. Biederman
2021-05-28 11:40       ` Alexey Gladkov
2021-05-28 21:22 ` Eric W. Biederman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.