Skip to content

Commit bb12c1b

Browse files
committed
Merge: smb: client: Handle kstrdup failures for passwords
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5695 JIRA: https://issues.redhat.com/browse/RHEL-65939 CVE: CVE-2024-50120 Signed-off-by: Paulo Alcantara <[email protected]> Approved-by: Chris von Recklinghausen <[email protected]> Approved-by: Benjamin Coddington <[email protected]> Approved-by: CKI KWF Bot <[email protected]> Merged-by: Rado Vrbovsky <[email protected]>
2 parents bce7c0a + 62b5e81 commit bb12c1b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fs/smb/client/fs_context.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,8 +918,15 @@ static int smb3_reconfigure(struct fs_context *fc)
918918
else {
919919
kfree_sensitive(ses->password);
920920
ses->password = kstrdup(ctx->password, GFP_KERNEL);
921+
if (!ses->password)
922+
return -ENOMEM;
921923
kfree_sensitive(ses->password2);
922924
ses->password2 = kstrdup(ctx->password2, GFP_KERNEL);
925+
if (!ses->password2) {
926+
kfree_sensitive(ses->password);
927+
ses->password = NULL;
928+
return -ENOMEM;
929+
}
923930
}
924931
STEAL_STRING(cifs_sb, ctx, domainname);
925932
STEAL_STRING(cifs_sb, ctx, nodename);

0 commit comments

Comments
 (0)