]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[TCP] MTUprobe: fix potential sk_send_head corruption
authorIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
Tue, 20 Nov 2007 07:24:09 +0000 (23:24 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Nov 2007 07:24:09 +0000 (23:24 -0800)
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>
include/net/tcp.h
net/ipv4/tcp_output.c

index d695cea7730da4a4bd16da6c0ce7bfcf2680767f..cb5b033e0e59c205980243d2b7e494db0925f218 100644 (file)
@@ -1288,6 +1288,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 324b4207254ae411728dd8a3cc1740f5ac0ce267..e48e28e7d539330d55d5dc274035320793e43b0b 100644 (file)
@@ -1352,7 +1352,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;