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 <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
43fb7bce88
commit
fe4ed2f09b
|
|
@ -1097,6 +1097,7 @@ int smb2_handle_negotiate(struct ksmbd_work *work)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ksmbd_conn_lock(conn);
|
||||||
smb2_buf_len = get_rfc1002_len(work->request_buf);
|
smb2_buf_len = get_rfc1002_len(work->request_buf);
|
||||||
smb2_neg_size = offsetof(struct smb2_negotiate_req, Dialects);
|
smb2_neg_size = offsetof(struct smb2_negotiate_req, Dialects);
|
||||||
if (smb2_neg_size > smb2_buf_len) {
|
if (smb2_neg_size > smb2_buf_len) {
|
||||||
|
|
@ -1247,6 +1248,7 @@ int smb2_handle_negotiate(struct ksmbd_work *work)
|
||||||
ksmbd_conn_set_need_negotiate(conn);
|
ksmbd_conn_set_need_negotiate(conn);
|
||||||
|
|
||||||
err_out:
|
err_out:
|
||||||
|
ksmbd_conn_unlock(conn);
|
||||||
if (rc)
|
if (rc)
|
||||||
rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES;
|
rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue