diff options
author | Li Wei <lw@cn.fujitsu.com> | 2012-07-17 03:28:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-17 04:35:03 -0400 |
commit | a858d64b7709ca7bd2ee71d66ef3b7190cdcbb7d (patch) | |
tree | 363940e9b8d8ffa40624cd9974cc872cab355fd2 /net/ipv6 | |
parent | c41e4130a248c8220889f6e6636b47595e369386 (diff) |
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 <lw@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/mcast.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 6d0f5dc8e3a6..92f8e48e4ba4 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -211,6 +211,9 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *addr) | |||
211 | struct ipv6_mc_socklist __rcu **lnk; | 211 | struct ipv6_mc_socklist __rcu **lnk; |
212 | struct net *net = sock_net(sk); | 212 | struct net *net = sock_net(sk); |
213 | 213 | ||
214 | if (!ipv6_addr_is_multicast(addr)) | ||
215 | return -EINVAL; | ||
216 | |||
214 | spin_lock(&ipv6_sk_mc_lock); | 217 | spin_lock(&ipv6_sk_mc_lock); |
215 | for (lnk = &np->ipv6_mc_list; | 218 | for (lnk = &np->ipv6_mc_list; |
216 | (mc_lst = rcu_dereference_protected(*lnk, | 219 | (mc_lst = rcu_dereference_protected(*lnk, |