smb: client: Use more common code in SMB2_tcon()
Subsystems (3)
PATCH 1/1 smb: client: Use more common code in SMB2_tcon()
From: Markus Elfring <[email protected]>
Date: Thu, 9 Oct 2025 10:37:39 +0200
Use an additional label so that a bit of common code can be better reused at the end of this function implementation.
Signed-off-by Markus Elfring <[email protected]>
--- fs/smb/client/smb2pdu.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
fs/smb/client/smb2pdu.c +5 -6
@@ -2056,8 +2056,8 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree, unc_path_len =cifs_strtoUTF16 (unc_path, tree,strlen (tree), cp);if (unc_path_len <=0 ) { -kfree (unc_path); -return -EINVAL ; + rc = -EINVAL ; + goto free_unc_path; } unc_path_len *=2 ;
@@ -2066,10 +2066,8 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,atomic_set (&tcon->num_remote_opens,0 ); rc =smb2_plain_req_init (SMB2_TREE_CONNECT , tcon, server, (void **) &req, &total_len); -if (rc) { -kfree (unc_path); -return rc; - } +if (rc) + goto free_unc_path;if (smb3_encryption_required (tcon)) flags |=CIFS_TRANSFORM_REQ ;
@@ -2160,6 +2158,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree, tcon_exit:free_rsp_buf (resp_buftype, rsp); +free_unc_path:kfree (unc_path);return rc;
Signature · 1 line
2.51.0