Skip to content
Commit e5645f51 authored by Wei Wang's avatar Wei Wang Committed by David S. Miller
Browse files

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: 587fea74

 ("ipv6: mark DST_NOGC and remove the operation of
dst_free()")
Reported-by: default avatarJohn Stultz <john.stultz@linaro.org>
Tested-by: default avatarJohn Stultz <john.stultz@linaro.org>
Tested-by: default avatarMartin KaFai Lau <kafai@fb.com>
Signed-off-by: default avatarWei Wang <weiwan@google.com>
Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 36f41f8f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment