Skip to content

Commit

Permalink
tcp: len check is unnecessarily devastating, change to WARN_ON
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
ij1 authored and davem330 committed Apr 2, 2011
1 parent 2cab86b commit 2fceec1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/ipv4/tcp_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2fceec1

Please sign in to comment.