Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[linux-2.6.git] / net / packet / af_packet.c
index 031a5e6..d7d0310 100644 (file)
@@ -60,6 +60,7 @@
 #include <linux/wireless.h>
 #include <linux/kernel.h>
 #include <linux/kmod.h>
+#include <linux/slab.h>
 #include <net/net_namespace.h>
 #include <net/ip.h>
 #include <net/protocol.h>
@@ -1688,10 +1689,12 @@ static int packet_dev_mc(struct net_device *dev, struct packet_mclist *i,
 {
        switch (i->type) {
        case PACKET_MR_MULTICAST:
+               if (i->alen != dev->addr_len)
+                       return -EINVAL;
                if (what > 0)
-                       return dev_mc_add(dev, i->addr, i->alen, 0);
+                       return dev_mc_add(dev, i->addr);
                else
-                       return dev_mc_delete(dev, i->addr, i->alen, 0);
+                       return dev_mc_del(dev, i->addr);
                break;
        case PACKET_MR_PROMISC:
                return dev_set_promiscuity(dev, what);
@@ -1700,10 +1703,12 @@ static int packet_dev_mc(struct net_device *dev, struct packet_mclist *i,
                return dev_set_allmulti(dev, what);
                break;
        case PACKET_MR_UNICAST:
+               if (i->alen != dev->addr_len)
+                       return -EINVAL;
                if (what > 0)
-                       return dev_unicast_add(dev, i->addr);
+                       return dev_uc_add(dev, i->addr);
                else
-                       return dev_unicast_delete(dev, i->addr);
+                       return dev_uc_del(dev, i->addr);
                break;
        default:
                break;
@@ -1734,7 +1739,7 @@ static int packet_mc_add(struct sock *sk, struct packet_mreq_max *mreq)
                goto done;
 
        err = -EINVAL;
-       if (mreq->mr_alen != dev->addr_len)
+       if (mreq->mr_alen > dev->addr_len)
                goto done;
 
        err = -ENOBUFS;