提交 6825a26c 编写于 作者: G Gao feng 提交者: David S. Miller

ipv6: release reference of ip6_null_entry's dst entry in __ip6_del_rt

as we hold dst_entry before we call __ip6_del_rt,
so we should alse call dst_release not only return
-ENOENT when the rt6_info is ip6_null_entry.

and we already hold the dst entry, so I think it's
safe to call dst_release out of the write-read lock.
Signed-off-by: NGao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 32418cfe
...@@ -1593,17 +1593,18 @@ static int __ip6_del_rt(struct rt6_info *rt, struct nl_info *info) ...@@ -1593,17 +1593,18 @@ static int __ip6_del_rt(struct rt6_info *rt, struct nl_info *info)
struct fib6_table *table; struct fib6_table *table;
struct net *net = dev_net(rt->dst.dev); struct net *net = dev_net(rt->dst.dev);
if (rt == net->ipv6.ip6_null_entry) if (rt == net->ipv6.ip6_null_entry) {
return -ENOENT; err = -ENOENT;
goto out;
}
table = rt->rt6i_table; table = rt->rt6i_table;
write_lock_bh(&table->tb6_lock); write_lock_bh(&table->tb6_lock);
err = fib6_del(rt, info); err = fib6_del(rt, info);
dst_release(&rt->dst);
write_unlock_bh(&table->tb6_lock); write_unlock_bh(&table->tb6_lock);
out:
dst_release(&rt->dst);
return err; return err;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册