Skip to contentSkip to conversation

smb: client: Improve exception handling in smb2_setup_request()

PATCH New Markus Elfring 1 participant 1 message Oct 9, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 smb: client: Improve exception handling in smb2_setup_request()

From: Markus Elfring <[email protected]>
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.

---
 fs/smb/client/smb2transport.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
fs/smb/client/smb2transport.c +4 -5
index bc0e92eb2b64..373c5309b54c 100644
@@ -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);
 	}
 
Signature · 1 line
2.51.0