Skip to content

Commit e3548aa

Browse files
sprasad-microsoftsmfrench
authored andcommitted
cifs: free ntlmsspblob allocated in negotiate
One of my previous fixes: cifs: send workstation name during ntlmssp session setup ...changed the prototype of build_ntlmssp_negotiate_blob from being allocated by the caller to being allocated within the function. The caller needs to free this object too. While SMB2 version of the caller did it, I forgot to free for the SMB1 version. Fixing that here. Fixes: 49bd49f ("cifs: send workstation name during ntlmssp session setup") Cc: [email protected] # 5.16 Signed-off-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 0c947b8 commit e3548aa

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

fs/cifs/sess.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,15 +1413,15 @@ sess_auth_rawntlmssp_negotiate(struct sess_data *sess_data)
14131413
&blob_len, ses, server,
14141414
sess_data->nls_cp);
14151415
if (rc)
1416-
goto out;
1416+
goto out_free_ntlmsspblob;
14171417

14181418
sess_data->iov[1].iov_len = blob_len;
14191419
sess_data->iov[1].iov_base = ntlmsspblob;
14201420
pSMB->req.SecurityBlobLength = cpu_to_le16(blob_len);
14211421

14221422
rc = _sess_auth_rawntlmssp_assemble_req(sess_data);
14231423
if (rc)
1424-
goto out;
1424+
goto out_free_ntlmsspblob;
14251425

14261426
rc = sess_sendreceive(sess_data);
14271427

@@ -1435,14 +1435,14 @@ sess_auth_rawntlmssp_negotiate(struct sess_data *sess_data)
14351435
rc = 0;
14361436

14371437
if (rc)
1438-
goto out;
1438+
goto out_free_ntlmsspblob;
14391439

14401440
cifs_dbg(FYI, "rawntlmssp session setup challenge phase\n");
14411441

14421442
if (smb_buf->WordCount != 4) {
14431443
rc = -EIO;
14441444
cifs_dbg(VFS, "bad word count %d\n", smb_buf->WordCount);
1445-
goto out;
1445+
goto out_free_ntlmsspblob;
14461446
}
14471447

14481448
ses->Suid = smb_buf->Uid; /* UID left in wire format (le) */
@@ -1456,10 +1456,13 @@ sess_auth_rawntlmssp_negotiate(struct sess_data *sess_data)
14561456
cifs_dbg(VFS, "bad security blob length %d\n",
14571457
blob_len);
14581458
rc = -EINVAL;
1459-
goto out;
1459+
goto out_free_ntlmsspblob;
14601460
}
14611461

14621462
rc = decode_ntlmssp_challenge(bcc_ptr, blob_len, ses);
1463+
1464+
out_free_ntlmsspblob:
1465+
kfree(ntlmsspblob);
14631466
out:
14641467
sess_free_buffer(sess_data);
14651468

0 commit comments

Comments
 (0)