From c1266041e64571096e960c5507e176e88b4913e4 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Thu, 11 Jun 2026 17:33:39 +0200 Subject: [PATCH] smb: client: Use more common error handling code in smb3_reconfigure() Use an additional label so that a bit of exception handling can be better reused at the end of this function implementation. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Steve French --- fs/smb/client/fs_context.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c index fd4b13cd654d..9addc74ce57e 100644 --- a/fs/smb/client/fs_context.c +++ b/fs/smb/client/fs_context.c @@ -1092,10 +1092,8 @@ static int smb3_reconfigure(struct fs_context *fc) return -ENOMEM; rc = smb3_fs_context_dup(old_ctx, cifs_sb->ctx); - if (rc) { - kfree(old_ctx); - return rc; - } + if (rc) + goto free_old_ctx; /* * We can not change UNC/username/password/domainname/ @@ -1244,6 +1242,7 @@ static int smb3_reconfigure(struct fs_context *fc) kfree_sensitive(new_password2); smb3_cleanup_fs_context_contents(cifs_sb->ctx); memcpy(cifs_sb->ctx, old_ctx, sizeof(*old_ctx)); +free_old_ctx: kfree(old_ctx); return rc;