]> git.baikalelectronics.ru Git - kernel.git/commit
wifi: rndis_wlan: Prevent buffer overflow in rndis_query_oid
authorSzymon Heidrich <szymon.heidrich@gmail.com>
Wed, 11 Jan 2023 17:50:31 +0000 (18:50 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Feb 2023 06:52:37 +0000 (07:52 +0100)
commit1e4ba1a1a6fc9824ceafafebdf02ecb6bbac149d
tree7584a89c7c26c6e7ffdec546774e0128d044094a
parentba7017670e499844864c45738481f579ea43f954
wifi: rndis_wlan: Prevent buffer overflow in rndis_query_oid

[ Upstream commit b870e73a56c4cccbec33224233eaf295839f228c ]

Since resplen and respoffs are signed integers sufficiently
large values of unsigned int len and offset members of RNDIS
response will result in negative values of prior variables.
This may be utilized to bypass implemented security checks
to either extract memory contents by manipulating offset or
overflow the data buffer via memcpy by manipulating both
offset and len.

Additionally assure that sum of resplen and respoffs does not
overflow so buffer boundaries are kept.

Fixes: fcc264202521 ("rndis_wlan: copy only useful data from rndis_command respond")
Signed-off-by: Szymon Heidrich <szymon.heidrich@gmail.com>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230111175031.7049-1-szymon.heidrich@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/rndis_wlan.c