Skip to content

Commit

Permalink
ip6mr: only set ip6mr_table from setsockopt when ip6mr_new_table succ…
Browse files Browse the repository at this point in the history
…eeds

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 5e1859f ("ipv4: ipmr:
various fixes and cleanups").

Fixes: d1db275 ("ipv6: ip6mr: support multiple tables")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
qsn authored and davem330 committed Jun 5, 2018
1 parent 4f416db commit 848235e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/ipv6/ip6mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1760,7 +1760,8 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns
ret = 0;
if (!ip6mr_new_table(net, v))
ret = -ENOMEM;
raw6_sk(sk)->ip6mr_table = v;
else
raw6_sk(sk)->ip6mr_table = v;
rtnl_unlock();
return ret;
}
Expand Down

0 comments on commit 848235e

Please sign in to comment.