Skip to content

Commit 2fceec1

Browse files
ij1davem330
authored andcommitted
tcp: len check is unnecessarily devastating, change to WARN_ON
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>
1 parent 2cab86b commit 2fceec1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/ipv4/tcp_output.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,8 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len,
10031003
int nlen;
10041004
u8 flags;
10051005

1006-
BUG_ON(len > skb->len);
1006+
if (WARN_ON(len > skb->len))
1007+
return -EINVAL;
10071008

10081009
nsize = skb_headlen(skb) - len;
10091010
if (nsize < 0)

0 commit comments

Comments
 (0)