You need to sign in or sign up before continuing.
提交 44e0f15b 编写于 作者: D Dan Carpenter 提交者: Greg Kroah-Hartman

libertas_tf: prevent underflow in process_cmdrequest()

[ Upstream commit 3348ef6a6a126706d6a73ed40c18d8033df72783 ]

If recvlength is less than MESSAGE_HEADER_LEN (4) we would end up
corrupting memory.

Fixes: c305a19a ("libertas_tf: usb specific functions")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 14e0b9bb
...@@ -605,9 +605,10 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff, ...@@ -605,9 +605,10 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
{ {
unsigned long flags; unsigned long flags;
if (recvlength > LBS_CMD_BUFFER_SIZE) { if (recvlength < MESSAGE_HEADER_LEN ||
recvlength > LBS_CMD_BUFFER_SIZE) {
lbtf_deb_usbd(&cardp->udev->dev, lbtf_deb_usbd(&cardp->udev->dev,
"The receive buffer is too large\n"); "The receive buffer is invalid: %d\n", recvlength);
kfree_skb(skb); kfree_skb(skb);
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册