2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-10 22:54:11 +08:00
linux-next/drivers/staging/most
Andrey Shvetsov 4d1356ac12 staging: most: net: fix buffer overflow
If the length of the socket buffer is 0xFFFFFFFF (max size for an
unsigned int), then payload_len becomes 0xFFFFFFF1 after subtracting 14
(ETH_HLEN).  Then, mdp_len is set to payload_len + 16 (MDP_HDR_LEN)
which overflows and results in a value of 2.  These values for
payload_len and mdp_len will pass current buffer size checks.

This patch checks if derived from skb->len sum may overflow.

The check is based on the following idea:

For any `unsigned V1, V2` and derived `unsigned SUM = V1 + V2`,
`V1 + V2` overflows iif `SUM < V1`.

Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200116172238.6046-1-andrey.shvetsov@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-22 09:51:15 +01:00
..
cdev staging: most: remove header include path to drivers/staging 2020-01-16 20:56:31 +01:00
dim2 staging: most: remove header include path to drivers/staging 2020-01-16 20:56:31 +01:00
Documentation staging: most: trivial: fix a couple of typos 2019-06-06 15:03:34 +02:00
i2c staging: most: remove header include path to drivers/staging 2020-01-16 20:56:31 +01:00
net staging: most: net: fix buffer overflow 2020-01-22 09:51:15 +01:00
sound staging: most: remove header include path to drivers/staging 2020-01-16 20:56:31 +01:00
usb staging: most: remove header include path to drivers/staging 2020-01-16 20:56:31 +01:00
video staging: most: remove header include path to drivers/staging 2020-01-16 20:56:31 +01:00
configfs.c staging: most: remove header include path to drivers/staging 2020-01-16 20:56:31 +01:00
core.c staging: most: remove header include path to drivers/staging 2020-01-16 20:56:31 +01:00
Kconfig staging: most: Fix Kconfig indentation 2019-11-20 15:20:29 +01:00
Makefile staging: most: remove header include path to drivers/staging 2020-01-16 20:56:31 +01:00
most.h staging: most: rename enum mbo_status_flags 2019-12-17 13:50:04 +01:00
TODO