Skip to content

Commit fe4ed2f

Browse files
namjaejeonSteve French
authored andcommitted
ksmbd: conn lock to serialize smb2 negotiate
If client send parallel smb2 negotiate request on same connection, ksmbd_conn can be racy. smb2 negotiate handling that are not performance-related can be serialized with conn lock. Signed-off-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 43fb7bc commit fe4ed2f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/smb/server/smb2pdu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,7 @@ int smb2_handle_negotiate(struct ksmbd_work *work)
10971097
return rc;
10981098
}
10991099

1100+
ksmbd_conn_lock(conn);
11001101
smb2_buf_len = get_rfc1002_len(work->request_buf);
11011102
smb2_neg_size = offsetof(struct smb2_negotiate_req, Dialects);
11021103
if (smb2_neg_size > smb2_buf_len) {
@@ -1247,6 +1248,7 @@ int smb2_handle_negotiate(struct ksmbd_work *work)
12471248
ksmbd_conn_set_need_negotiate(conn);
12481249

12491250
err_out:
1251+
ksmbd_conn_unlock(conn);
12501252
if (rc)
12511253
rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES;
12521254

0 commit comments

Comments
 (0)