adding missing rcu_read_unlock in ipxip6_rcv
Subsystems (3)
PATCH 1/1 adding missing rcu_read_unlock in ipxip6_rcv
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 <[email protected]>
--- net/ipv6/ip6_tunnel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv6/ip6_tunnel.c +3 -1
@@ -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);
Signature · 1 line
2.9.5
David Miller
maintainerFrom: "Nikita V. Shirokov" <[email protected]>
Date: Wed, 6 Dec 2017 10:19:33 -0800
Quoted 5 lines
commit
8d79266bc48c("ip6_tunnel: addcollect_mdmode to IPv6 tunnels") introduced new exit point inipxip6_rcv. howeverrcu_read_unlockis missing there. this diff is fixing thisSigned-off-by Nikita V. Shirokov <[email protected]>
...
net/ipv6/ip6_tunnel.c static int ipxip6_rcv(struct sk_buff *skb, u8 ipproto, · line 912
Quoted 12 lines
net/ipv6/ip6_tunnel.c +3
-1@@ -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?
On 12/6/17, 12:50 PM, "David Miller" <[email protected]> wrote:
From: "Nikita V. Shirokov" <[email protected]> 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 <[email protected]> ... > @@ -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