Skip to content

Commit 73f949e

Browse files
namjaejeonSteve French
authored andcommitted
ksmbd: check iov vector index in ksmbd_conn_write()
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>
1 parent f2f11fc commit 73f949e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
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,

0 commit comments

Comments
 (0)