Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] smb: client: Improve exception handling in smb2_setup_request()
@ 2025-10-09 14:32 Markus Elfring
  0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2025-10-09 14:32 UTC (permalink / raw)
  To: linux-cifs, samba-technical, Aurelien Aptel, Bharath SM,
	Enzo Matsumiya, Paulo Alcantara, Pavel Shilovsky, Ronnie Sahlberg,
	Shyam Prasad N, Steve French, Tom Talpey
  Cc: LKML, kernel-janitors

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-10-09 14:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-09 14:32 [PATCH] smb: client: Improve exception handling in smb2_setup_request() Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox