]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: client: get rid of kstrdup() when parsing pass mount option
authorPaulo Alcantara <pc@manguebit.org>
Sat, 26 Jul 2025 16:38:52 +0000 (13:38 -0300)
committerSteve French <stfrench@microsoft.com>
Mon, 28 Jul 2025 14:40:36 +0000 (09:40 -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 18b55f243b4cb162f2346c3ed7adfedb2829893b..c332d110704a284ed0b99e7740a544e26f7e4a7d 100644 (file)
@@ -1482,12 +1482,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
                ctx->password = NULL;
                if (strlen(param->string) == 0)
                        break;
-
-               ctx->password = kstrdup(param->string, GFP_KERNEL);
-               if (ctx->password == NULL) {
-                       cifs_errorf(fc, "OOM when copying password string\n");
-                       goto cifs_parse_mount_err;
-               }
+               ctx->password = no_free_ptr(param->string);
                break;
        case Opt_pass2:
                kfree_sensitive(ctx->password2);