diff options
| author | Markus Elfring <elfring@users.sourceforge.net> | 2025-10-09 11:37:39 +0300 |
|---|---|---|
| committer | Steve French <stfrench@microsoft.com> | 2026-06-14 23:12:24 +0300 |
| commit | 0eb17dea51eff940230b5e562df29ce457124d41 (patch) | |
| tree | 7475dc0901e09bca47f8ff81d6e53e6d41e93180 | |
| parent | c1266041e64571096e960c5507e176e88b4913e4 (diff) | |
| download | linux-0eb17dea51eff940230b5e562df29ce457124d41.tar.xz | |
smb: client: Use more common code in SMB2_tcon()
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 <elfring@users.sourceforge.net>
Signed-off-by: Steve French <stfrench@microsoft.com>
| -rw-r--r-- | fs/smb/client/smb2pdu.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index 6a185b805c1e..4972cfe249f6 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -2129,8 +2129,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; @@ -2139,10 +2139,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; @@ -2233,6 +2231,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; |
