Linux-CIFS Archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
	Aurelien Aptel <aaptel@suse.com>,
	Bharath SM <bharathsm@microsoft.com>,
	Enzo Matsumiya <ematsumiya@suse.de>,
	Paulo Alcantara <pc@manguebit.org>,
	Pavel Shilovsky <pshilov@microsoft.com>,
	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: Improve exception handling in smb2_setup_request()
Date: Thu, 9 Oct 2025 16:32:08 +0200	[thread overview]
Message-ID: <dcb52df3-4179-4aab-b823-8bb2c4c46bdf@web.de> (raw)

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 9 Oct 2025 16:24:17 +0200

Add a label so that a bit of exception handling can be better reused
from an if branch in this function implementation.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/smb/client/smb2transport.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/smb/client/smb2transport.c b/fs/smb/client/smb2transport.c
index bc0e92eb2b64..373c5309b54c 100644
--- a/fs/smb/client/smb2transport.c
+++ b/fs/smb/client/smb2transport.c
@@ -886,15 +886,14 @@ smb2_setup_request(struct cifs_ses *ses, struct TCP_Server_Info *server,
 	smb2_seq_num_into_buf(server, shdr);
 
 	rc = smb2_get_mid_entry(ses, server, shdr, &mid);
-	if (rc) {
-		revert_current_mid_from_hdr(server, shdr);
-		return ERR_PTR(rc);
-	}
+	if (rc)
+		goto revert_current_mid_from_hdr;
 
 	rc = smb2_sign_rqst(rqst, server);
 	if (rc) {
-		revert_current_mid_from_hdr(server, shdr);
 		delete_mid(mid);
+revert_current_mid_from_hdr:
+		revert_current_mid_from_hdr(server, shdr);
 		return ERR_PTR(rc);
 	}
 
-- 
2.51.0


                 reply	other threads:[~2025-10-09 14:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=dcb52df3-4179-4aab-b823-8bb2c4c46bdf@web.de \
    --to=markus.elfring@web.de \
    --cc=aaptel@suse.com \
    --cc=bharathsm@microsoft.com \
    --cc=ematsumiya@suse.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pc@manguebit.org \
    --cc=pshilov@microsoft.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).