netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org, Stefano Brivio <sbrivio@redhat.com>,
	wenxu <wenxu@ucloud.cn>, Alexei Starovoitov <ast@fb.com>,
	"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH net] tunnel: fix dev null pointer dereference when send pkg larger than mtu in collect_md mode
Date: Fri, 16 Aug 2019 11:24:18 +0800	[thread overview]
Message-ID: <20190816032418.GX18865@dhcp-12-139.nay.redhat.com> (raw)
In-Reply-To: <cb5b5d82-1239-34a9-23f5-1894a2ec92a2@gmail.com>

Hi Eric,

Thanks for the review.
On Thu, Aug 15, 2019 at 11:16:58AM +0200, Eric Dumazet wrote:
> > diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
> > index 38c02bb62e2c..c6713c7287df 100644
> > --- a/net/ipv4/ip_tunnel.c
> > +++ b/net/ipv4/ip_tunnel.c
> > @@ -597,6 +597,9 @@ void ip_md_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
> >  		goto tx_error;
> >  	}
> >  
> > +	if (skb_dst(skb) && !skb_dst(skb)->dev)
> > +		skb_dst(skb)->dev = rt->dst.dev;
> > +
> 
> 
> IMO this looks wrong.
> This dst seems shared. 

If the dst is shared, it may cause some problem. Could you point me where the
dst may be shared possibly?

> Once set, we will reuse the same dev ?

If yes, how about just set the skb dst to rt->dst, as the
iptunnel_xmit would do later.

skb_dst_drop(skb);
skb_dst_set(skb, &rt->dst);

or do you have any other idea?
> 
> If intended, why not doing this in __metadata_dst_init() instead of in the fast path ?

I'm afraid we couldn't do this, I didn't find a way to init dev in
__metadata_dst_init(). Do you?

Thanks
Hangbin

  reply	other threads:[~2019-08-16  3:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-15  6:09 [PATCH net] tunnel: fix dev null pointer dereference when send pkg larger than mtu in collect_md mode Hangbin Liu
2019-08-15  9:16 ` Eric Dumazet
2019-08-16  3:24   ` Hangbin Liu [this message]
2019-08-16  4:01     ` Hangbin Liu
2019-08-16  8:23     ` Eric Dumazet
2019-08-16 10:51       ` Hangbin Liu
2019-08-19  7:53 ` [PATCHv2 0/2] " Hangbin Liu
2019-08-19  7:53   ` [PATCH 1/2] ipv4/icmp: fix rt dst dev null pointer dereference Hangbin Liu
2019-08-21 16:11     ` Julian Anastasov
2019-08-19  7:53   ` [PATCH 2/2] xfrm/xfrm_policy: fix dst dev null pointer dereference in collect_md mode Hangbin Liu
2019-08-20 19:20   ` [PATCHv2 0/2] fix dev null pointer dereference when send pkg larger than mtu " David Miller
2019-08-21  2:09 ` [PATCHv3 0/2] fix dev null pointer dereference when send packets " Hangbin Liu
2019-08-21  2:09   ` [PATCHv3 1/2] ipv4/icmp: fix rt dst dev null pointer dereference Hangbin Liu
2019-08-21  2:09   ` [PATCHv3 2/2] xfrm/xfrm_policy: fix dst dev null pointer dereference in collect_md mode Hangbin Liu
2019-08-22 14:19 ` [PATCHv4 0/2] fix dev null pointer dereference when send packets larger than mtu " Hangbin Liu
2019-08-22 14:19   ` [PATCHv4 net 1/2] ipv4/icmp: fix rt dst dev null pointer dereference Hangbin Liu
2019-08-22 18:46     ` Julian Anastasov
2019-08-23 22:32     ` Jonathan Lemon
2019-08-22 14:19   ` [PATCHv4 net 2/2] xfrm/xfrm_policy: fix dst dev null pointer dereference in collect_md mode Hangbin Liu
2019-08-23 22:30     ` Jonathan Lemon
2019-08-24 21:51   ` [PATCHv4 0/2] fix dev null pointer dereference when send packets larger than mtu " 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=20190816032418.GX18865@dhcp-12-139.nay.redhat.com \
    --to=liuhangbin@gmail.com \
    --cc=ast@fb.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=sbrivio@redhat.com \
    --cc=wenxu@ucloud.cn \
    /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).