1
0
Fork 0
alistair23-linux/drivers/staging/most
Andrey Shvetsov b5e5d81230 staging: most: net: fix buffer overflow
commit 4d1356ac12 upstream.

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-02-01 09:34:33 +00:00
..
Documentation staging: most: trivial: fix a couple of typos 2019-06-06 15:03:34 +02:00
cdev staging: most: Delete an error message for a failed memory allocation 2019-07-22 07:34:09 +02:00
dim2 staging: Remove dev_err() usage after platform_get_irq() 2019-07-30 20:50:04 +02:00
i2c staging: add missing SPDX lines to Makefile files 2019-04-03 11:10:15 +02:00
net staging: most: net: fix buffer overflow 2020-02-01 09:34:33 +00:00
sound staging: most: sound: Fix error path of audio_init 2019-08-28 22:22:13 +02:00
usb staging: most: usb: remove prefix from description tag 2019-04-16 13:25:17 +02:00
video staging: most: Use DEFINE_SPINLOCK() instead of struct spinlock 2019-07-30 09:52:04 +02:00
Kconfig staging: most: use help instead of ---help--- in Kconfig 2019-05-20 10:49:07 +02:00
Makefile staging: most: enable configfs support 2019-04-16 13:25:17 +02:00
TODO
configfs.c staging: most: remove data sanity check 2019-07-03 18:28:28 +02:00
core.c staging: most-core: Fix checkpatch warnings 2019-08-27 19:01:26 +02:00
core.h staging: most: allow speculative configuration 2019-04-16 13:25:18 +02:00