* [PATCH] wfx: prevent underflow in wfx_send_pds()
@ 2022-08-19 5:23 Dan Carpenter
2022-08-22 12:20 ` Jérôme Pouiller
2022-09-02 8:44 ` wifi: " Kalle Valo
0 siblings, 2 replies; 6+ messages in thread
From: Dan Carpenter @ 2022-08-19 5:23 UTC (permalink / raw)
To: Jérôme Pouiller; +Cc: Kalle Valo, linux-wireless, kernel-janitors
This does a "chunk_len - 4" subtraction later when it calls:
ret = wfx_hif_configuration(wdev, buf + 4, chunk_len - 4);
so check for "chunk_len" is less than 4.
Fixes: dcbecb497908 ("staging: wfx: allow new PDS format")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/net/wireless/silabs/wfx/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/silabs/wfx/main.c b/drivers/net/wireless/silabs/wfx/main.c
index e015bfb8d221..84d82ddded56 100644
--- a/drivers/net/wireless/silabs/wfx/main.c
+++ b/drivers/net/wireless/silabs/wfx/main.c
@@ -181,7 +181,7 @@ int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len)
while (len > 0) {
chunk_type = get_unaligned_le16(buf + 0);
chunk_len = get_unaligned_le16(buf + 2);
- if (chunk_len > len) {
+ if (chunk_len < 4 || chunk_len > len) {
dev_err(wdev->dev, "PDS:%d: corrupted file\n", chunk_num);
return -EINVAL;
}
--
2.35.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] wfx: prevent underflow in wfx_send_pds()
2022-08-19 5:23 [PATCH] wfx: prevent underflow in wfx_send_pds() Dan Carpenter
@ 2022-08-22 12:20 ` Jérôme Pouiller
2022-08-29 16:03 ` Kalle Valo
2022-09-02 8:44 ` wifi: " Kalle Valo
1 sibling, 1 reply; 6+ messages in thread
From: Jérôme Pouiller @ 2022-08-22 12:20 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Kalle Valo, linux-wireless, kernel-janitors
On Friday 19 August 2022 07:23:43 CEST Dan Carpenter wrote:
> This does a "chunk_len - 4" subtraction later when it calls:
>
> ret = wfx_hif_configuration(wdev, buf + 4, chunk_len - 4);
>
> so check for "chunk_len" is less than 4.
This patch also ensures that buf[4] won't overflow during:
if (buf[4] != '{' || buf[chunk_len - 1] != '}')
dev_warn(wdev->dev, "PDS:%d: unexpected content\n", chunk_num);
> Fixes: dcbecb497908 ("staging: wfx: allow new PDS format")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
--
Jérôme Pouiller
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] wfx: prevent underflow in wfx_send_pds()
2022-08-22 12:20 ` Jérôme Pouiller
@ 2022-08-29 16:03 ` Kalle Valo
2022-08-29 17:12 ` Jérôme Pouiller
0 siblings, 1 reply; 6+ messages in thread
From: Kalle Valo @ 2022-08-29 16:03 UTC (permalink / raw)
To: Jérôme Pouiller; +Cc: Dan Carpenter, linux-wireless, kernel-janitors
Jérôme Pouiller <jerome.pouiller@silabs.com> writes:
> On Friday 19 August 2022 07:23:43 CEST Dan Carpenter wrote:
>> This does a "chunk_len - 4" subtraction later when it calls:
>>
>> ret = wfx_hif_configuration(wdev, buf + 4, chunk_len - 4);
>>
>> so check for "chunk_len" is less than 4.
>
> This patch also ensures that buf[4] won't overflow during:
>
> if (buf[4] != '{' || buf[chunk_len - 1] != '}')
> dev_warn(wdev->dev, "PDS:%d: unexpected content\n", chunk_num);
>
>> Fixes: dcbecb497908 ("staging: wfx: allow new PDS format")
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
BTW Jérôme, as you are the driver maintainer you can use Acked-by.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] wfx: prevent underflow in wfx_send_pds()
2022-08-29 16:03 ` Kalle Valo
@ 2022-08-29 17:12 ` Jérôme Pouiller
2022-09-01 10:33 ` Kalle Valo
0 siblings, 1 reply; 6+ messages in thread
From: Jérôme Pouiller @ 2022-08-29 17:12 UTC (permalink / raw)
To: Kalle Valo; +Cc: Dan Carpenter, linux-wireless, kernel-janitors
On Monday 29 August 2022 18:03:38 CEST Kalle Valo wrote:
> Jérôme Pouiller <jerome.pouiller@silabs.com> writes:
>
> > On Friday 19 August 2022 07:23:43 CEST Dan Carpenter wrote:
> >> This does a "chunk_len - 4" subtraction later when it calls:
> >>
> >> ret = wfx_hif_configuration(wdev, buf + 4, chunk_len - 4);
> >>
> >> so check for "chunk_len" is less than 4.
> >
> > This patch also ensures that buf[4] won't overflow during:
> >
> > if (buf[4] != '{' || buf[chunk_len - 1] != '}')
> > dev_warn(wdev->dev, "PDS:%d: unexpected content\n", chunk_num);
> >
> >> Fixes: dcbecb497908 ("staging: wfx: allow new PDS format")
> >> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
>
> BTW Jérôme, as you are the driver maintainer you can use Acked-by.
Reviewed-by does not imply Acked-by?
--
Jérôme Pouiller
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] wfx: prevent underflow in wfx_send_pds()
2022-08-29 17:12 ` Jérôme Pouiller
@ 2022-09-01 10:33 ` Kalle Valo
0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2022-09-01 10:33 UTC (permalink / raw)
To: Jérôme Pouiller; +Cc: Dan Carpenter, linux-wireless, kernel-janitors
Jérôme Pouiller <jerome.pouiller@silabs.com> writes:
> On Monday 29 August 2022 18:03:38 CEST Kalle Valo wrote:
>> Jérôme Pouiller <jerome.pouiller@silabs.com> writes:
>>
>> > On Friday 19 August 2022 07:23:43 CEST Dan Carpenter wrote:
>> >> This does a "chunk_len - 4" subtraction later when it calls:
>> >>
>> >> ret = wfx_hif_configuration(wdev, buf + 4, chunk_len - 4);
>> >>
>> >> so check for "chunk_len" is less than 4.
>> >
>> > This patch also ensures that buf[4] won't overflow during:
>> >
>> > if (buf[4] != '{' || buf[chunk_len - 1] != '}')
>> > dev_warn(wdev->dev, "PDS:%d: unexpected content\n", chunk_num);
>> >
>> >> Fixes: dcbecb497908 ("staging: wfx: allow new PDS format")
>> >> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>> >
>> > Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
>>
>> BTW Jérôme, as you are the driver maintainer you can use Acked-by.
>
> Reviewed-by does not imply Acked-by?
Acked-by has "stronger" meaning and is meant to use by the maintainer of
the code in question. So anyone can use Reviewed-by but only the
maintainer should use Acked-by. My preference is that maintainers use
Acked-by as then I can easily see from my patchwork script that the
patch is ready to be applied.
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#when-to-use-acked-by-cc-and-co-developed-by
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: wifi: wfx: prevent underflow in wfx_send_pds()
2022-08-19 5:23 [PATCH] wfx: prevent underflow in wfx_send_pds() Dan Carpenter
2022-08-22 12:20 ` Jérôme Pouiller
@ 2022-09-02 8:44 ` Kalle Valo
1 sibling, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2022-09-02 8:44 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Jérôme Pouiller, linux-wireless, kernel-janitors
Dan Carpenter <dan.carpenter@oracle.com> wrote:
> This does a "chunk_len - 4" subtraction later when it calls:
>
> ret = wfx_hif_configuration(wdev, buf + 4, chunk_len - 4);
>
> so check for "chunk_len" is less than 4.
>
> Fixes: dcbecb497908 ("staging: wfx: allow new PDS format")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Patch applied to wireless-next.git, thanks.
f97c81f5b7f8 wifi: wfx: prevent underflow in wfx_send_pds()
--
https://patchwork.kernel.org/project/linux-wireless/patch/Yv8eX7Xv2ubUOvW7@kili/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-09-02 8:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-19 5:23 [PATCH] wfx: prevent underflow in wfx_send_pds() Dan Carpenter
2022-08-22 12:20 ` Jérôme Pouiller
2022-08-29 16:03 ` Kalle Valo
2022-08-29 17:12 ` Jérôme Pouiller
2022-09-01 10:33 ` Kalle Valo
2022-09-02 8:44 ` wifi: " Kalle Valo
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.