mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
ksmbd: check iov vector index in ksmbd_conn_write()
[ Upstream commit 73f949ea87 ]
If ->iov_idx is zero, This means that the iov vector for the response
was not added during the request process. In other words, it means that
there is a problem in generating a response, So this patch return as
an error to avoid NULL pointer dereferencing problem.
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8beae8a0a0
commit
7345f5dbf6
@@ -199,6 +199,9 @@ int ksmbd_conn_write(struct ksmbd_work *work)
|
|||||||
if (work->send_no_response)
|
if (work->send_no_response)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (!work->iov_idx)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
ksmbd_conn_lock(conn);
|
ksmbd_conn_lock(conn);
|
||||||
sent = conn->transport->ops->writev(conn->transport, work->iov,
|
sent = conn->transport->ops->writev(conn->transport, work->iov,
|
||||||
work->iov_cnt,
|
work->iov_cnt,
|
||||||
|
|||||||
Reference in New Issue
Block a user