Skip to contentSkip to conversation

cred: add missing return error code when set_cred_ucounts() failed

PATCH In review Yang Yingliang 3 participants 6 messages May 26, 2021 – May 28, 2021 Credentials

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cred: add missing return error code when set_cred_ucounts() failed

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

Fixes 905ae01c4ae2 ("Add a reference to ucounts for each cred")
---
 kernel/cred.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/cred.c +2 -1
index db7c46bf36e5..e6fd2b3fc31f 100644
@@ -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;
 	}
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 1 line · Yang Yingliang

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.

Quoted 20 lines
Fixes 905ae01c4ae2 ("Add a reference to ucounts for each cred")
---
 kernel/cred.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/cred.c +2 -1
index db7c46bf36e5..e6fd2b3fc31f 100644
@@ -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 lore raw
Quoted 10 lines · Eric W. Biederman
Quoted 1 line · Yang Yingliang

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.

Quoted 21 lines
Quoted 20 lines
Fixes 905ae01c4ae2 ("Add a reference to ucounts for each cred")
---
 kernel/cred.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/cred.c +2 -1
index db7c46bf36e5..e6fd2b3fc31f 100644
@@ -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;
 	}
Signature · 1 line
Rgrds, legion
#3 lore raw
Quoted 5 lines · Alexey Gladkov
Quoted 4 lines · Eric W. Biederman
Quoted 1 line · Yang Yingliang

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

Quoted 8 lines
Quoted 6 lines

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.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Fixes 905ae01c4ae2 ("Add a reference to ucounts for each cred")
---
 kernel/cred.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
kernel/cred.c +0 -0
index db7c46bf36e5..e6fd2b3fc31f 100644
@@ -372,7 +372,8 @@ int copy_creds(struct task_struct *p, unsigned long clone_flags)
Quoted 9 lines

kernel/cred.c int copy_creds(struct task_struct *p, unsigned long clone_flags) · line 378

Quoted 8 lines
kernel/cred.c +2 -1
 		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

Reviewed-by Acked-by
#4 lore raw
Quoted 12 lines · Eric W. Biederman
Quoted 10 lines · Alexey Gladkov
Quoted 9 lines · Eric W. Biederman
Quoted 1 line · Yang Yingliang

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.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

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.

Quoted 24 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Fixes 905ae01c4ae2 ("Add a reference to ucounts for each cred")
---
 kernel/cred.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
kernel/cred.c +0 -0
index db7c46bf36e5..e6fd2b3fc31f 100644
@@ -372,7 +372,8 @@ int copy_creds(struct task_struct *p, unsigned long clone_flags)
Quoted 9 lines

kernel/cred.c int copy_creds(struct task_struct *p, unsigned long clone_flags) · line 378

Quoted 8 lines
kernel/cred.c +2 -1
 		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

Signature · 1 line
Rgrds, legion
#5 lore raw
In reply to Yang Yingliang
Quoted 5 lines · Yang Yingliang

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

Fixes 905ae01c4ae2 ("Add a reference to ucounts for each cred")

Applied thanks.

Quoted 17 lines
---
 kernel/cred.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/cred.c +2 -1
index db7c46bf36e5..e6fd2b3fc31f 100644
@@ -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;
 	}