]> git.baikalelectronics.ru Git - kernel.git/commit
ucounts: Proper error handling in set_cred_ucounts
authorEric W. Biederman <ebiederm@xmission.com>
Sat, 16 Oct 2021 17:47:51 +0000 (12:47 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Tue, 19 Oct 2021 16:04:25 +0000 (11:04 -0500)
commit14405e82be5500a34228534f5962737e75b678ff
tree5674fdd26d21efd860afc4c571c250cfa511aed0
parentc8360ba6c7ebafc2b2dcabfb09cd9bf3351a48bd
ucounts: Proper error handling in set_cred_ucounts

Instead of leaking the ucounts in new if alloc_ucounts fails, store
the result of alloc_ucounts into a temporary variable, which is later
assigned to new->ucounts.

Cc: stable@vger.kernel.org
Fixes: f1a163971101 ("Add a reference to ucounts for each cred")
Link: https://lkml.kernel.org/r/87pms2s0v8.fsf_-_@disp2133
Tested-by: Yu Zhao <yuzhao@google.com>
Reviewed-by: Alexey Gladkov <legion@kernel.org>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
kernel/cred.c