]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
TCP: MTUprobe: fix potential sk_send_head corruption
authorIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
Thu, 29 Nov 2007 12:07:58 +0000 (23:07 +1100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 14 Dec 2007 18:31:58 +0000 (10:31 -0800)
[TCP] MTUprobe: fix potential sk_send_head corruption

[ Upstream commit: 6e42141009ff18297fe19d19296738b742f861db ]

When the abstraction functions got added, conversion here was
made incorrectly. As a result, the skb may end up pointing
to skb which got included to the probe skb and then was freed.
For it to trigger, however, skb_transmit must fail sending as
well.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
include/net/tcp.h
net/ipv4/tcp_output.c

index a99b4f6fb2cbf633988414c49846ddece76ba78c..c05e018299507d333a508644b002299c1ae5d559 100644 (file)
@@ -1258,6 +1258,9 @@ static inline void tcp_insert_write_queue_before(struct sk_buff *new,
                                                  struct sock *sk)
 {
        __skb_insert(new, skb->prev, skb, &sk->sk_write_queue);
+
+       if (sk->sk_send_head == skb)
+               sk->sk_send_head = new;
 }
 
 static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk)
index 53232dd6fb48af5a9c4f5d2373a1630936bb7980..eee57e647f515e1449d35a7ae8cdb2d3d35515ff 100644 (file)
@@ -1279,7 +1279,6 @@ static int tcp_mtu_probe(struct sock *sk)
 
        skb = tcp_send_head(sk);
        tcp_insert_write_queue_before(nskb, skb, sk);
-       tcp_advance_send_head(sk, skb);
 
        TCP_SKB_CB(nskb)->seq = TCP_SKB_CB(skb)->seq;
        TCP_SKB_CB(nskb)->end_seq = TCP_SKB_CB(skb)->seq + probe_size;