Patch "smb: client: Handle kstrdup failures for passwords" has been added to the 6.11-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    smb: client: Handle kstrdup failures for passwords

to the 6.11-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     smb-client-handle-kstrdup-failures-for-passwords.patch
and it can be found in the queue-6.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit cd535eca7c871d4f5119dd3507c4687ff824b42e
Author: Henrique Carvalho <henrique.carvalho@xxxxxxxx>
Date:   Tue Oct 22 15:21:26 2024 -0300

    smb: client: Handle kstrdup failures for passwords
    
    [ Upstream commit 9a5dd61151399ad5a5d69aad28ab164734c1e3bc ]
    
    In smb3_reconfigure(), after duplicating ctx->password and
    ctx->password2 with kstrdup(), we need to check for allocation
    failures.
    
    If ses->password allocation fails, return -ENOMEM.
    If ses->password2 allocation fails, free ses->password, set it
    to NULL, and return -ENOMEM.
    
    Fixes: c1eb537bf456 ("cifs: allow changing password during remount")
    Reviewed-by: David Howells <dhowells@xxxxxxxxxx
    Signed-off-by: Haoxiang Li <make24@xxxxxxxxxxx>
    Signed-off-by: Henrique Carvalho <henrique.carvalho@xxxxxxxx>
    Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c
index bc926ab2555bc..4069b69fbc7e0 100644
--- a/fs/smb/client/fs_context.c
+++ b/fs/smb/client/fs_context.c
@@ -920,8 +920,15 @@ static int smb3_reconfigure(struct fs_context *fc)
 	else  {
 		kfree_sensitive(ses->password);
 		ses->password = kstrdup(ctx->password, GFP_KERNEL);
+		if (!ses->password)
+			return -ENOMEM;
 		kfree_sensitive(ses->password2);
 		ses->password2 = kstrdup(ctx->password2, GFP_KERNEL);
+		if (!ses->password2) {
+			kfree_sensitive(ses->password);
+			ses->password = NULL;
+			return -ENOMEM;
+		}
 	}
 	STEAL_STRING(cifs_sb, ctx, domainname);
 	STEAL_STRING(cifs_sb, ctx, nodename);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux