提交 848235ed 编写于 作者: S Sabrina Dubroca 提交者: David S. Miller

ip6mr: only set ip6mr_table from setsockopt when ip6mr_new_table succeeds

Currently, raw6_sk(sk)->ip6mr_table is set unconditionally during
ip6_mroute_setsockopt(MRT6_TABLE). A subsequent attempt at the same
setsockopt will fail with -ENOENT, since we haven't actually created
that table.

A similar fix for ipv4 was included in commit 5e1859fb ("ipv4: ipmr:
various fixes and cleanups").

Fixes: d1db275d ("ipv6: ip6mr: support multiple tables")
Signed-off-by: NSabrina Dubroca <sd@queasysnail.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 4f416db9
......@@ -1760,6 +1760,7 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns
ret = 0;
if (!ip6mr_new_table(net, v))
ret = -ENOMEM;
else
raw6_sk(sk)->ip6mr_table = v;
rtnl_unlock();
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册