diff options
author | Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> | 2011-04-01 21:47:41 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-06-03 10:33:59 +0900 |
commit | 21fdc47e2e3238412559703663e5a04cbebb4309 (patch) | |
tree | f0606b221f240d89b198ddea99d64ee034c38c98 | |
parent | 29ad44a2c7365a4094772be7bbc81aff279295fc (diff) | |
download | lwn-21fdc47e2e3238412559703663e5a04cbebb4309.tar.gz lwn-21fdc47e2e3238412559703663e5a04cbebb4309.zip |
tcp: len check is unnecessarily devastating, change to WARN_ON
[ Upstream commit 2fceec13375e5d98ef033c6b0ee03943fc460950 ]
All callers are prepared for alloc failures anyway, so this error
can safely be boomeranged to the callers domain without super
bad consequences. ...At worst the connection might go into a state
where each RTO tries to (unsuccessfully) re-fragment with such
a mis-sized value and eventually dies.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | net/ipv4/tcp_output.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index dfa5beb0c1c8..8b0d0167e44a 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1003,7 +1003,8 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, int nlen; u8 flags; - BUG_ON(len > skb->len); + if (WARN_ON(len > skb->len)) + return -EINVAL; nsize = skb_headlen(skb) - len; if (nsize < 0) |