diff options
author | Namjae Jeon <linkinjeon@kernel.org> | 2023-09-21 08:37:06 +0200 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2023-09-21 21:41:06 +0200 |
commit | 73f949ea87c7d697210653501ca21efe57295327 (patch) | |
tree | 3456982d347b855ca404ce17f1a653da9151dc50 /fs | |
parent | ksmbd: return invalid parameter error response if smb2 request is invalid (diff) | |
download | linux-73f949ea87c7d697210653501ca21efe57295327.tar.xz linux-73f949ea87c7d697210653501ca21efe57295327.zip |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/smb/server/connection.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/smb/server/connection.c b/fs/smb/server/connection.c index 0d990c2f33cd..db7fa704a3f6 100644 --- a/fs/smb/server/connection.c +++ b/fs/smb/server/connection.c @@ -197,6 +197,9 @@ int ksmbd_conn_write(struct ksmbd_work *work) if (work->send_no_response) return 0; + if (!work->iov_idx) + return -EINVAL; + ksmbd_conn_lock(conn); sent = conn->transport->ops->writev(conn->transport, work->iov, work->iov_cnt, |