]> git.baikalelectronics.ru Git - kernel.git/commit
CDC-NCM: avoid overflow in sanity checking
authorOliver Neukum <oneukum@suse.com>
Tue, 15 Feb 2022 10:35:47 +0000 (11:35 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 15 Feb 2022 14:56:10 +0000 (14:56 +0000)
commit6bdf84e076fad9a50abed700d48e7d1ab56671ed
tree2b5bad2d091e5bf2cb4f403ffb9305250a394594
parent1350431f888605410f7e56b72c204f9ac8ef140a
CDC-NCM: avoid overflow in sanity checking

A broken device may give an extreme offset like 0xFFF0
and a reasonable length for a fragment. In the sanity
check as formulated now, this will create an integer
overflow, defeating the sanity check. Both offset
and offset + len need to be checked in such a manner
that no overflow can occur.
And those quantities should be unsigned.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/cdc_ncm.c