[PATCH net] adding missing rcu_read_unlock in ipxip6_rcv

Subsystems: networking [general], networking [ipv4/ipv6], the rest

STALE3238d

3 messages, 2 authors, 2017-12-07 · open the first message on its own page

[PATCH net] adding missing rcu_read_unlock in ipxip6_rcv

From: Nikita V. Shirokov <hidden>
Date: 2017-12-06 18:37:53

commit 8d79266bc48c ("ip6_tunnel: add collect_md mode to IPv6 tunnels")
introduced new exit point in  ipxip6_rcv. however rcu_read_unlock is
missing there. this diff is fixing this

Signed-off-by: Nikita V. Shirokov <redacted>
---
 net/ipv6/ip6_tunnel.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 3d3092a..00f2c79 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -903,8 +903,10 @@ static int ipxip6_rcv(struct sk_buff *skb, u8 ipproto,
 			goto drop;
 		if (t->parms.collect_md) {
 			tun_dst = ipv6_tun_rx_dst(skb, 0, 0, 0);
-			if (!tun_dst)
+			if (!tun_dst) {
+				rcu_read_unlock();
 				return 0;
+			}
 		}
 		ret = __ip6_tnl_rcv(t, skb, tpi, tun_dst, dscp_ecn_decapsulate,
 				    log_ecn_error);
-- 
2.9.5

Re: [PATCH net] adding missing rcu_read_unlock in ipxip6_rcv

From: David Miller <davem@davemloft.net>
Date: 2017-12-06 20:50:07

From: "Nikita V. Shirokov" <redacted>
Date: Wed,  6 Dec 2017 10:19:33 -0800
commit 8d79266bc48c ("ip6_tunnel: add collect_md mode to IPv6 tunnels")
introduced new exit point in  ipxip6_rcv. however rcu_read_unlock is
missing there. this diff is fixing this

Signed-off-by: Nikita V. Shirokov <redacted>
 ...
quoted hunk
@@ -903,8 +903,10 @@ static int ipxip6_rcv(struct sk_buff *skb, u8 ipproto,
 			goto drop;
 		if (t->parms.collect_md) {
 			tun_dst = ipv6_tun_rx_dst(skb, 0, 0, 0);
-			if (!tun_dst)
+			if (!tun_dst) {
+				rcu_read_unlock();
 				return 0;
+			}
 		}
 		ret = __ip6_tnl_rcv(t, skb, tpi, tun_dst, dscp_ecn_decapsulate,
 				    log_ecn_error);
Shouldn't it branch to 'drop' otherwise we leak the skb?

Re: [PATCH net] adding missing rcu_read_unlock in ipxip6_rcv

From: Nikita Shirokov <hidden>
Date: 2017-12-07 00:28:42


On 12/6/17, 12:50 PM, "David Miller" [off-list ref] wrote:

    From: "Nikita V. Shirokov" [off-list ref]
    Date: Wed,  6 Dec 2017 10:19:33 -0800
    
    > commit 8d79266bc48c ("ip6_tunnel: add collect_md mode to IPv6 tunnels")
    > introduced new exit point in  ipxip6_rcv. however rcu_read_unlock is
    > missing there. this diff is fixing this
    > 
    > Signed-off-by: Nikita V. Shirokov [off-list ref]
     ...
    > @@ -903,8 +903,10 @@ static int ipxip6_rcv(struct sk_buff *skb, u8 ipproto,
    >  			goto drop;
    >  		if (t->parms.collect_md) {
    >  			tun_dst = ipv6_tun_rx_dst(skb, 0, 0, 0);
    > -			if (!tun_dst)
    > +			if (!tun_dst) {
    > +				rcu_read_unlock();
    >  				return 0;
    > +			}
    >  		}
    >  		ret = __ip6_tnl_rcv(t, skb, tpi, tun_dst, dscp_ecn_decapsulate,
    >  				    log_ecn_error);
    
    Shouldn't it branch to 'drop' otherwise we leak the skb?
    

Fair point, will rework.

--
Nikita
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help