diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-08-19 08:23:43 +0300 |
---|---|---|
committer | Kalle Valo <kvalo@kernel.org> | 2022-09-02 11:44:35 +0300 |
commit | f97c81f5b7f8047810b0d79a8f759a83951210a0 (patch) | |
tree | aefb4efa9835758405f862d0053a69007921d7c5 /drivers/net/wireless/silabs | |
parent | 620d5eaeb9059636864bda83ca1c68c20ede34a5 (diff) |
wifi: wfx: prevent underflow in wfx_send_pds()
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>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/Yv8eX7Xv2ubUOvW7@kili
Diffstat (limited to 'drivers/net/wireless/silabs')
-rw-r--r-- | drivers/net/wireless/silabs/wfx/main.c | 2 |
1 files changed, 1 insertions, 1 deletions
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; } |