]> git.hungrycats.org Git - linux/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 17:51:04 +0000 (09:51 -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 54053de0bdd7c12f2f3a0269f2ddf5b77c33ec47..704d51e1f5432d621324243803d8fe5a6d268788 100644 (file)
@@ -1256,6 +1256,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 666d8a58d14a3d573f11963de87773f25201d573..097165fab7fbd0c968bf5acaa939780e7422a43e 100644 (file)
@@ -1287,7 +1287,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;