mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
	Bharath SM <bharathsm@microsoft.com>,
	Paulo Alcantara <pc@manguebit.org>,
	Ronnie Sahlberg <ronniesahlberg@gmail.com>,
	Shyam Prasad N <sprasad@microsoft.com>,
	Steve French <sfrench@samba.org>, Tom Talpey <tom@talpey.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] smb: client: Use more common error handling code in smb3_reconfigure()
Date: Thu, 11 Jun 2026 17:42:08 +0200	[thread overview]
Message-ID: <328ba830-24f6-4358-b88f-9aec843ecf14@web.de> (raw)

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 11 Jun 2026 17:33:39 +0200

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 <elfring@users.sourceforge.net>
---
 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;
-- 
2.54.0


             reply	other threads:[~2026-06-11 15:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11 15:42 Markus Elfring [this message]
2026-06-12 22:14 ` XIAO WU

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=328ba830-24f6-4358-b88f-9aec843ecf14@web.de \
    --to=markus.elfring@web.de \
    --cc=bharathsm@microsoft.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pc@manguebit.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=samba-technical@lists.samba.org \
    --cc=sfrench@samba.org \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®