Skip to content

Commit 9f3ebbe

Browse files
committed
Merge tag '6.6-rc3-ksmbd-server-fixes' of git://git.samba.org/ksmbd
Pull smb server fixes from Steve French: "Two SMB3 server fixes for null pointer dereferences: - invalid SMB3 request case (fixes issue found in testing the read compound patch) - iovec error case in response processing" * tag '6.6-rc3-ksmbd-server-fixes' of git://git.samba.org/ksmbd: ksmbd: check iov vector index in ksmbd_conn_write() ksmbd: return invalid parameter error response if smb2 request is invalid
2 parents 14c06b9 + 73f949e commit 9f3ebbe

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

fs/smb/server/connection.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ int ksmbd_conn_write(struct ksmbd_work *work)
197197
if (work->send_no_response)
198198
return 0;
199199

200+
if (!work->iov_idx)
201+
return -EINVAL;
202+
200203
ksmbd_conn_lock(conn);
201204
sent = conn->transport->ops->writev(conn->transport, work->iov,
202205
work->iov_cnt,

fs/smb/server/server.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,10 @@ static int __process_request(struct ksmbd_work *work, struct ksmbd_conn *conn,
115115
if (check_conn_state(work))
116116
return SERVER_HANDLER_CONTINUE;
117117

118-
if (ksmbd_verify_smb_message(work))
118+
if (ksmbd_verify_smb_message(work)) {
119+
conn->ops->set_rsp_status(work, STATUS_INVALID_PARAMETER);
119120
return SERVER_HANDLER_ABORT;
121+
}
120122

121123
command = conn->ops->get_cmd_val(work);
122124
*cmd = command;

fs/smb/server/smb2misc.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,8 @@ int ksmbd_smb2_check_message(struct ksmbd_work *work)
440440

441441
validate_credit:
442442
if ((work->conn->vals->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU) &&
443-
smb2_validate_credit_charge(work->conn, hdr)) {
444-
work->conn->ops->set_rsp_status(work, STATUS_INVALID_PARAMETER);
443+
smb2_validate_credit_charge(work->conn, hdr))
445444
return 1;
446-
}
447445

448446
return 0;
449447
}

0 commit comments

Comments
 (0)