netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: davem@davemloft.net
Cc: xemul@openvz.org, vgusev@openvz.org, netdev@vger.kernel.org,
	"Denis V. Lunev" <den@openvz.org>
Subject: [PATCH net-2.6] ipv6: NULL pointer dereferrence in tcp_v6_send_ack
Date: Wed,  1 Oct 2008 13:11:57 +0400	[thread overview]
Message-ID: <1222852317-7177-1-git-send-email-den@openvz.org> (raw)
In-Reply-To: <20081001.020359.48616451.davem@davemloft.net>

The following actions are possible:
tcp_v6_rcv
  skb->dev = NULL;
  tcp_v6_do_rcv
    tcp_v6_hnd_req
      tcp_check_req
        req->rsk_ops->send_ack == tcp_v6_send_ack

So, skb->dev can be NULL in tcp_v6_send_ack. We must obtain namespace
from dst entry.

Thanks to Vitaliy Gusev <vgusev@openvz.org> for initial problem finding
in IPv4 code.

Signed-off-by: Denis V. Lunev <den@openvz.org>
---
 net/ipv4/tcp_ipv4.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index b585c85..10e22fd 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1050,7 +1050,7 @@ static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32
 	struct tcphdr *th = tcp_hdr(skb), *t1;
 	struct sk_buff *buff;
 	struct flowi fl;
-	struct net *net = dev_net(skb->dev);
+	struct net *net = dev_net(skb->dst->dev);
 	struct sock *ctl_sk = net->ipv6.tcp_sk;
 	unsigned int tot_len = sizeof(struct tcphdr);
 	__be32 *topt;
-- 
1.5.6.4


  reply	other threads:[~2008-10-01  9:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-30 16:13 [PATCH] Fix NULL dereference in tcp_4_send_ack() Vitaliy Gusev
2008-09-30 16:29 ` [PATCH net-2.6] ip: NULL pointer dereferrence in tcp_v(4|6)_send_ack Denis V. Lunev
2008-10-01  8:52   ` David Miller
2008-10-01  9:06     ` Vitaliy Gusev
2008-10-01  9:03       ` David Miller
2008-10-01  9:11         ` Denis V. Lunev [this message]
2008-10-01  9:13           ` [PATCH net-2.6] ipv6: NULL pointer dereferrence in tcp_v6_send_ack David Miller
2008-10-01 13:34           ` Arnaldo Carvalho de Melo
2008-10-01 13:38             ` David Miller

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=1222852317-7177-1-git-send-email-den@openvz.org \
    --to=den@openvz.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=vgusev@openvz.org \
    --cc=xemul@openvz.org \
    /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;
as well as URLs for NNTP newsgroup(s).