]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
wifi: libertas: fix integer underflow in process_cmdrequest()
authorAmir Mohammad Jahangirzad <a.jahangirzad@gmail.com>
Sat, 18 Apr 2026 00:42:47 +0000 (04:12 +0330)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 27 Apr 2026 10:40:32 +0000 (12:40 +0200)
commit3994b4afd521d60e47e012fe2ed7b606aaec370b
tree5cd25a7990a4f3922ec022763ec993699979d9fe
parenta035766f970bde2d4298346a31a80685be5c0205
wifi: libertas: fix integer underflow in process_cmdrequest()

The existing validation only checks if recvlength exceeds
LBS_CMD_BUFFER_SIZE, but doesn't check the lower bound. When a
USB device sends a response shorter than MESSAGE_HEADER_LEN, the
subtraction (recvlength - MESSAGE_HEADER_LEN) wraps to a huge
value, causing memcpy to corrupt the heap.
Add the same lower bound check that libertas_tf already has.

Signed-off-by: Amir Mohammad Jahangirzad <a.jahangirzad@gmail.com>
Link: https://patch.msgid.link/20260418004247.368944-1-a.jahangirzad@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/marvell/libertas/if_usb.c