mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gilad Ben-Yossef <gilad@codefidence.com>
To: Valdis.Kletnieks@vt.edu
Cc: netdev@vger.kernel.org, ori@comsleep.com,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH testing] Do not call IPv4 specific func in tcp_check_req
Date: Wed,  4 Nov 2009 18:40:54 +0200	[thread overview]
Message-ID: <1257352854-19490-1-git-send-email-gilad@codefidence.com> (raw)
In-Reply-To: <7916.1257300093@turing-police.cc.vt.edu>

Calling IPv4 specific inet_csk_route_req in tcp_check_req
is a bad idea and crashes machine on IPv6 connections, as reported
by Valdis Kletnieks

Also, all we are really interested in is the timestamp
option in the header, so calling tcp_parse_options()
with the "estab" set to false flag is an overkill as
it tries to parse half a dozen other TCP options.

We know whether timestamp should be enabled or not
using data from request_sock.

Signed-off-by: Gilad Ben-Yossef <gilad@codefidence.com>
---
 net/ipv4/tcp_minisocks.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 8bb560d..c816e50 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -500,11 +500,10 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
 	int paws_reject = 0;
 	struct tcp_options_received tmp_opt;
 	struct sock *child;
-	struct dst_entry *dst = inet_csk_route_req(sk, req);
 
-	tmp_opt.saw_tstamp = 0;
-	if (th->doff > (sizeof(struct tcphdr)>>2)) {
-		tcp_parse_options(skb, &tmp_opt, 0, dst);
+	if ((th->doff > (sizeof(struct tcphdr)>>2)) && (req->ts_recent)) {
+		tmp_opt.tstamp_ok = 1;
+		tcp_parse_options(skb, &tmp_opt, 1, NULL);
 
 		if (tmp_opt.saw_tstamp) {
 			tmp_opt.ts_recent = req->ts_recent;
@@ -517,8 +516,6 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
 		}
 	}
 
-	dst_release(dst);
-
 	/* Check for pure retransmitted SYN. */
 	if (TCP_SKB_CB(skb)->seq == tcp_rsk(req)->rcv_isn &&
 	    flg == TCP_FLAG_SYN &&
-- 
1.5.6.3


  parent reply	other threads:[~2009-11-04 16:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-03 17:50 2.6.32-rc5-mmotm1101 - kernel BUG at net/ipv4/tcp_input.c:3707! Valdis.Kletnieks
2009-11-03 18:02 ` Eric Dumazet
2009-11-03 19:20   ` Gilad Ben-Yossef
2009-11-03 21:34     ` Ilpo JÀrvinen
2009-11-04  2:01       ` Valdis.Kletnieks
2009-11-04  2:34         ` David Miller
2009-11-04  6:38         ` Gilad Ben-Yossef
2009-11-04 16:40         ` Gilad Ben-Yossef [this message]
2009-11-05  7:22           ` [PATCH testing] Do not call IPv4 specific func in tcp_check_req David Miller
2009-11-04 16:43         ` 2.6.32-rc5-mmotm1101 - kernel BUG at net/ipv4/tcp_input.c:3707! Gilad Ben-Yossef
2009-11-05  2:33           ` Valdis.Kletnieks
2009-11-05  7:25             ` David Miller
2009-11-05  7:22           ` David Miller
2009-11-04  6:27       ` Gilad Ben-Yossef
2009-11-03 19:21   ` [PATCH 1/1] Use defaults when no route options are available Gilad Ben-Yossef
2009-11-04 13:28     ` David Miller
2009-11-04 14:27       ` Gilad Ben-Yossef

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1257352854-19490-1-git-send-email-gilad@codefidence.com \
    --to=gilad@codefidence.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ori@comsleep.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®