* [PATCH] libertas_tf: prevent underflow in process_cmdrequest()
@ 2018-08-14 9:07 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2018-08-14 9:07 UTC (permalink / raw)
To: Kalle Valo, Luis Carlos Cobo
Cc: Sebastian Andrzej Siewior, linux-wireless, kernel-janitors
If recvlength is less than MESSAGE_HEADER_LEN (4) we would end up
corrupting memory.
Fixes: c305a19a0d0a ("libertas_tf: usb specific functions")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This is from static analysis. I'm not positive that this is a real
bug, but it's harmless to check.
diff --git a/drivers/net/wireless/marvell/libertas_tf/if_usb.c b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
index e92fc5001171..789337ea676a 100644
--- a/drivers/net/wireless/marvell/libertas_tf/if_usb.c
+++ b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
@@ -605,9 +605,10 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
{
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,
- "The receive buffer is too large\n");
+ "The receive buffer is invalid: %d\n", recvlength);
kfree_skb(skb);
return;
}
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] libertas_tf: prevent underflow in process_cmdrequest()
@ 2018-08-14 9:07 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2018-08-14 9:07 UTC (permalink / raw)
To: Kalle Valo, Luis Carlos Cobo
Cc: Sebastian Andrzej Siewior, linux-wireless, kernel-janitors
If recvlength is less than MESSAGE_HEADER_LEN (4) we would end up
corrupting memory.
Fixes: c305a19a0d0a ("libertas_tf: usb specific functions")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This is from static analysis. I'm not positive that this is a real
bug, but it's harmless to check.
diff --git a/drivers/net/wireless/marvell/libertas_tf/if_usb.c b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
index e92fc5001171..789337ea676a 100644
--- a/drivers/net/wireless/marvell/libertas_tf/if_usb.c
+++ b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
@@ -605,9 +605,10 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
{
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,
- "The receive buffer is too large\n");
+ "The receive buffer is invalid: %d\n", recvlength);
kfree_skb(skb);
return;
}
^ permalink raw reply related [flat|nested] 6+ messages in thread
* re:[PATCH] libertas_tf: prevent underflow in process_cmdrequest()
2018-08-14 9:07 ` Dan Carpenter
@ 2018-08-14 10:17 ` Walter Harms
-1 siblings, 0 replies; 6+ messages in thread
From: Walter Harms @ 2018-08-14 10:17 UTC (permalink / raw)
To: Kalle Valo
Cc: Luis Carlos Cobo, Sebastian Andrzej Siewior, linux-wireless,
kernel-janitors
If recvlength is less than MESSAGE_HEADER_LEN (4) we would end up
corrupting memory.
Fixes: c305a19a0d0a ("libertas_tf: usb specific functions")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This is from static analysis. I'm not positive that this is a real
bug, but it's harmless to check.
diff --git a/drivers/net/wireless/marvell/libertas_tf/if_usb.c
b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
index e92fc5001171..789337ea676a 100644
--- a/drivers/net/wireless/marvell/libertas_tf/if_usb.c
+++ b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
@@ -605,9 +605,10 @@ static inline void process_cmdrequest(int recvlength,
uint8_t *recvbuff,
{
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,
- "The receive buffer is too large\n");
+ "The receive buffer is invalid: %d\n", recvlength);
The wording here is a bit unfortunate, and give the user a false impression (at
least me).
The problem is the paketsize not the buffer.
therefor i suggest to change that into:
"received invalid paketsize %d\n"
just my 2 cents,
re,
wh
kfree_skb(skb);
return;
}
^ permalink raw reply related [flat|nested] 6+ messages in thread
* re:[PATCH] libertas_tf: prevent underflow in process_cmdrequest()
@ 2018-08-14 10:17 ` Walter Harms
0 siblings, 0 replies; 6+ messages in thread
From: Walter Harms @ 2018-08-14 10:17 UTC (permalink / raw)
To: Kalle Valo
Cc: Luis Carlos Cobo, Sebastian Andrzej Siewior, linux-wireless,
kernel-janitors
If recvlength is less than MESSAGE_HEADER_LEN (4) we would end up
corrupting memory.
Fixes: c305a19a0d0a ("libertas_tf: usb specific functions")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This is from static analysis. I'm not positive that this is a real
bug, but it's harmless to check.
diff --git a/drivers/net/wireless/marvell/libertas_tf/if_usb.c
b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
index e92fc5001171..789337ea676a 100644
--- a/drivers/net/wireless/marvell/libertas_tf/if_usb.c
+++ b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
@@ -605,9 +605,10 @@ static inline void process_cmdrequest(int recvlength,
uint8_t *recvbuff,
{
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,
- "The receive buffer is too large\n");
+ "The receive buffer is invalid: %d\n", recvlength);
The wording here is a bit unfortunate, and give the user a false impression (at
least me).
The problem is the paketsize not the buffer.
therefor i suggest to change that into:
"received invalid paketsize %d\n"
just my 2 cents,
re,
wh
kfree_skb(skb);
return;
}
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] libertas_tf: prevent underflow in process_cmdrequest()
2018-08-14 9:07 ` Dan Carpenter
@ 2018-08-31 15:43 ` Kalle Valo
-1 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2018-08-31 15:43 UTC (permalink / raw)
To: Dan Carpenter
Cc: Luis Carlos Cobo, Sebastian Andrzej Siewior, linux-wireless,
kernel-janitors
Dan Carpenter <dan.carpenter@oracle.com> wrote:
> If recvlength is less than MESSAGE_HEADER_LEN (4) we would end up
> corrupting memory.
>
> Fixes: c305a19a0d0a ("libertas_tf: usb specific functions")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Patch applied to wireless-drivers-next.git, thanks.
3348ef6a6a12 libertas_tf: prevent underflow in process_cmdrequest()
--
https://patchwork.kernel.org/patch/10565197/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] libertas_tf: prevent underflow in process_cmdrequest()
@ 2018-08-31 15:43 ` Kalle Valo
0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2018-08-31 15:43 UTC (permalink / raw)
To: Dan Carpenter
Cc: Luis Carlos Cobo, Sebastian Andrzej Siewior, linux-wireless,
kernel-janitors
Dan Carpenter <dan.carpenter@oracle.com> wrote:
> If recvlength is less than MESSAGE_HEADER_LEN (4) we would end up
> corrupting memory.
>
> Fixes: c305a19a0d0a ("libertas_tf: usb specific functions")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Patch applied to wireless-drivers-next.git, thanks.
3348ef6a6a12 libertas_tf: prevent underflow in process_cmdrequest()
--
https://patchwork.kernel.org/patch/10565197/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-08-31 19:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-14 9:07 [PATCH] libertas_tf: prevent underflow in process_cmdrequest() Dan Carpenter
2018-08-14 9:07 ` Dan Carpenter
2018-08-31 15:43 ` Kalle Valo
2018-08-31 15:43 ` Kalle Valo
2018-08-14 10:17 Walter Harms
2018-08-14 10:17 ` Walter Harms
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.