Skip to content

Commit a858d64

Browse files
Li Weidavem330
authored andcommitted
ipv6: fix unappropriate errno returned for non-multicast address
We need to check the passed in multicast address and return appropriate errno(EINVAL) if it is not valid. And it's no need to walk through the ipv6_mc_list in this situation. Signed-off-by: Li Wei <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c41e413 commit a858d64

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/ipv6/mcast.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *addr)
211211
struct ipv6_mc_socklist __rcu **lnk;
212212
struct net *net = sock_net(sk);
213213

214+
if (!ipv6_addr_is_multicast(addr))
215+
return -EINVAL;
216+
214217
spin_lock(&ipv6_sk_mc_lock);
215218
for (lnk = &np->ipv6_mc_list;
216219
(mc_lst = rcu_dereference_protected(*lnk,

0 commit comments

Comments
 (0)