diff options
author | Sabrina Dubroca <sd@queasysnail.net> | 2018-06-05 09:01:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-06-05 12:26:39 -0400 |
commit | 848235edb5c93ed086700584c8ff64f6d7fc778d (patch) | |
tree | ad8211588a1867fe378e81e300aff1aae796f3a2 | |
parent | 4f416db98beaef2f047709e4693b0a4c64d9bbf8 (diff) |
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 5e1859fbcc3c ("ipv4: ipmr:
various fixes and cleanups").
Fixes: d1db275dd3f6 ("ipv6: ip6mr: support multiple tables")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv6/ip6mr.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 20a419ee8000..5c57374850b3 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -1760,7 +1760,8 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns | |||
1760 | ret = 0; | 1760 | ret = 0; |
1761 | if (!ip6mr_new_table(net, v)) | 1761 | if (!ip6mr_new_table(net, v)) |
1762 | ret = -ENOMEM; | 1762 | ret = -ENOMEM; |
1763 | raw6_sk(sk)->ip6mr_table = v; | 1763 | else |
1764 | raw6_sk(sk)->ip6mr_table = v; | ||
1764 | rtnl_unlock(); | 1765 | rtnl_unlock(); |
1765 | return ret; | 1766 | return ret; |
1766 | } | 1767 | } |