diff options
author | Andrey Shvetsov <[email protected]> | 2020-01-16 18:22:39 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <[email protected]> | 2020-01-22 09:51:15 +0100 |
commit | 4d1356ac12f4d5180d0df345d85ff0ee42b89c72 (patch) | |
tree | b76e48894474f5907b6fb71b66b2f46c6c2c1da5 /scripts/gcc-plugins/cyc_complexity_plugin.c | |
parent | 3063da91ca569ccafd6d07cd877d6d3588b2c85a (diff) |
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 <[email protected]>
Signed-off-by: Andrey Shvetsov <[email protected]>
Cc: stable <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'scripts/gcc-plugins/cyc_complexity_plugin.c')
0 files changed, 0 insertions, 0 deletions