Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764484AbXLMHOl (ORCPT ); Thu, 13 Dec 2007 02:14:41 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1762657AbXLMG6C (ORCPT ); Thu, 13 Dec 2007 01:58:02 -0500 Received: from pentafluge.infradead.org ([213.146.154.40]:55572 "EHLO pentafluge.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760761AbXLMG6A (ORCPT ); Thu, 13 Dec 2007 01:58:00 -0500 Date: Wed, 12 Dec 2007 22:53:13 -0800 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org, davem@davemloft.net Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , Chuck Ebbert , Domenico Andreoli , torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, Ilpo J?rvinen , Herbert Xu Subject: [patch 45/60] TCP: MTUprobe: fix potential sk_send_head corruption Message-ID: <20071213065313.GU6867@kroah.com> References: <20071213064518.328162328@mini.kroah.org> MIME-Version: 1.0 Content-Type: text/plain; charset=unknown-8bit Content-Disposition: inline; filename="tcp-mtuprobe-fix-potential-sk_send_head-corruption.patch" Content-Transfer-Encoding: 8bit In-Reply-To: <20071213065039.GA6867@kroah.com> User-Agent: Mutt/1.5.16 (2007-06-09) X-Bad-Reply: References and In-Reply-To but no 'Re:' in Subject. Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1785 Lines: 55 2.6.23-stable review patch. If anyone has any objections, please let us know. ------------------ From: Ilpo J?rvinen [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 Signed-off-by: David S. Miller Cc: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- include/net/tcp.h | 3 +++ net/ipv4/tcp_output.c | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1256,6 +1256,9 @@ static inline void tcp_insert_write_queu 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) --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -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; -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/