]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: client: get rid of kstrdup() when parsing pass2 mount option
authorPaulo Alcantara <pc@manguebit.org>
Sat, 26 Jul 2025 16:40:28 +0000 (13:40 -0300)
committerSteve French <stfrench@microsoft.com>
Mon, 28 Jul 2025 14:41:17 +0000 (09:41 -0500)
Steal string reference from @param->string rather than duplicating it.

Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/fs_context.c

index c332d110704a284ed0b99e7740a544e26f7e4a7d..f29efc03e8050bb5e23c684e44ca207dc2c10639 100644 (file)
@@ -1489,12 +1489,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
                ctx->password2 = NULL;
                if (strlen(param->string) == 0)
                        break;
-
-               ctx->password2 = kstrdup(param->string, GFP_KERNEL);
-               if (ctx->password2 == NULL) {
-                       cifs_errorf(fc, "OOM when copying password2 string\n");
-                       goto cifs_parse_mount_err;
-               }
+               ctx->password2 = no_free_ptr(param->string);
                break;
        case Opt_ip:
                if (strlen(param->string) == 0) {