Message ID | alpine.DEB.2.00.1103312212360.9481@melkinpaasi.cs.helsinki.fi |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi> Date: Thu, 31 Mar 2011 22:37:21 +0300 (EEST) > [PATCH] tcp: len check is unnecessarily devastating, change to WARN_ON > > All callers are prepared to 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> Applied. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index dfa5beb..8b0d016 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)