ksmbd: fix integer overflows on 32 bit systems
commitaab98e2dbdupstream. On 32bit systems the addition operations in ipc_msg_alloc() can potentially overflow leading to memory corruption. Add bounds checking using KSMBD_IPC_MAX_PAYLOAD to avoid overflow. Fixes:0626e6641f("cifsd: add server handler for central processing and tranport layers") Cc: stable@vger.kernel.org Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
fcd06731f5
commit
82f59d64e6
@@ -570,6 +570,9 @@ ksmbd_ipc_spnego_authen_request(const char *spnego_blob, int blob_len)
|
||||
struct ksmbd_spnego_authen_request *req;
|
||||
struct ksmbd_spnego_authen_response *resp;
|
||||
|
||||
if (blob_len > KSMBD_IPC_MAX_PAYLOAD)
|
||||
return NULL;
|
||||
|
||||
msg = ipc_msg_alloc(sizeof(struct ksmbd_spnego_authen_request) +
|
||||
blob_len + 1);
|
||||
if (!msg)
|
||||
@@ -749,6 +752,9 @@ struct ksmbd_rpc_command *ksmbd_rpc_write(struct ksmbd_session *sess, int handle
|
||||
struct ksmbd_rpc_command *req;
|
||||
struct ksmbd_rpc_command *resp;
|
||||
|
||||
if (payload_sz > KSMBD_IPC_MAX_PAYLOAD)
|
||||
return NULL;
|
||||
|
||||
msg = ipc_msg_alloc(sizeof(struct ksmbd_rpc_command) + payload_sz + 1);
|
||||
if (!msg)
|
||||
return NULL;
|
||||
@@ -797,6 +803,9 @@ struct ksmbd_rpc_command *ksmbd_rpc_ioctl(struct ksmbd_session *sess, int handle
|
||||
struct ksmbd_rpc_command *req;
|
||||
struct ksmbd_rpc_command *resp;
|
||||
|
||||
if (payload_sz > KSMBD_IPC_MAX_PAYLOAD)
|
||||
return NULL;
|
||||
|
||||
msg = ipc_msg_alloc(sizeof(struct ksmbd_rpc_command) + payload_sz + 1);
|
||||
if (!msg)
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user