]> git.baikalelectronics.ru Git - kernel.git/commit
ipv6: release rt6->rt6i_idev properly during ifdown
authorWei Wang <weiwan@google.com>
Mon, 14 Aug 2017 17:44:59 +0000 (10:44 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 15 Aug 2017 05:18:48 +0000 (22:18 -0700)
commit10b6de9427cdc9b0136df8c8f7b0522194f761e6
treee9910540098f3c7aa709c7fd84e5e5a435ad29e9
parent78282ad18beca960c9405d23013d36e66b17ad0e
ipv6: release rt6->rt6i_idev properly during ifdown

When a dst is created by addrconf_dst_alloc() for a host route or an
anycast route, dst->dev points to loopback dev while rt6->rt6i_idev
points to a real device.
When the real device goes down, the current cleanup code only checks for
dst->dev and assumes rt6->rt6i_idev->dev is the same. This causes the
refcount leak on the real device in the above situation.
This patch makes sure to always release the refcount taken on
rt6->rt6i_idev during dst_dev_put().

Fixes: a801e2cccf50 ("ipv6: mark DST_NOGC and remove the operation of
dst_free()")
Reported-by: John Stultz <john.stultz@linaro.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Tested-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Wei Wang <weiwan@google.com>
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/route.c