diff options
author | Eric Dumazet <edumazet@google.com> | 2016-11-02 14:53:17 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-03 19:33:30 (GMT) |
commit | ac9e70b17ecd7c6e933ff2eaf7ab37429e71bf4d (patch) | |
tree | 781677be717b11066e303449ee4abd787048816e /net | |
parent | 9512925a2cc2b1cd0206bb93bad200a69716f998 (diff) | |
download | linux-ac9e70b17ecd7c6e933ff2eaf7ab37429e71bf4d.tar.xz |
tcp: fix potential memory corruption
Imagine initial value of max_skb_frags is 17, and last
skb in write queue has 15 frags.
Then max_skb_frags is lowered to 14 or smaller value.
tcp_sendmsg() will then be allowed to add additional page frags
and eventually go past MAX_SKB_FRAGS, overflowing struct
skb_shared_info.
Fixes: 5f74f82ea34c ("net:Add sysctl_max_skb_frags")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Hans Westgaard Ry <hans.westgaard.ry@oracle.com>
Cc: HÃ¥kon Bugge <haakon.bugge@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/tcp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 3251fe7..18238ef 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -1241,7 +1241,7 @@ new_segment: if (!skb_can_coalesce(skb, i, pfrag->page, pfrag->offset)) { - if (i == sysctl_max_skb_frags || !sg) { + if (i >= sysctl_max_skb_frags || !sg) { tcp_mark_push(tp, skb); goto new_segment; } |