lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 12 May 2016 13:55:53 -0700
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Alexander Duyck <alexander.duyck@...il.com>
Cc:	Alexander Duyck <aduyck@...antis.com>,
	Netdev <netdev@...r.kernel.org>,
	David Miller <davem@...emloft.net>,
	Thomas Graf <tgraf@...g.ch>, Tom Herbert <tom@...bertland.com>,
	Jiri Benc <jbenc@...hat.com>
Subject: Re: [net-next PATCH v2] udp: Resolve NULL pointer dereference over
 flow-based vxlan device

On Thu, 2016-05-12 at 13:27 -0700, Alexander Duyck wrote:

> I'm assuming this was using skb_dst(skb)->dev in order to allow for
> use of this function by other callers since the original function
> __udp4_lib_lookup_skb was using that.  If we change this then it
> reduces the likelihood of the code being reusable by other callers.
> In such a case I would probably want to go through and also rename the
> functions to make sure they are tagged as being GRO specific.
> 

__udp4_lib_lookup_skb() should use skb->dev as well,
or get the net pointer from its caller.

It is called from __udp4_lib_rcv() and this one simply does :

struct net *net = dev_net(skb->dev);

So for consistency (and small performance gain) I would suggest :

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index f67f52ba4809..d9006f2d28eb 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -604,7 +604,7 @@ static inline struct sock *__udp4_lib_lookup_skb(struct sk_buff *skb,
 {
        const struct iphdr *iph = ip_hdr(skb);
 
-       return __udp4_lib_lookup(dev_net(skb_dst(skb)->dev), iph->saddr, sport,
+       return __udp4_lib_lookup(dev_net(skb->dev), iph->saddr, sport,
                                 iph->daddr, dport, inet_iif(skb),
                                 udptable, skb);
 }


Powered by blists - more mailing lists