aboutsummaryrefslogtreecommitdiffstats
path: root/net/packet/af_packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/packet/af_packet.c')
-rw-r--r--net/packet/af_packet.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 031a5e6fb4aa..243946d4809d 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -60,6 +60,7 @@
60#include <linux/wireless.h> 60#include <linux/wireless.h>
61#include <linux/kernel.h> 61#include <linux/kernel.h>
62#include <linux/kmod.h> 62#include <linux/kmod.h>
63#include <linux/slab.h>
63#include <net/net_namespace.h> 64#include <net/net_namespace.h>
64#include <net/ip.h> 65#include <net/ip.h>
65#include <net/protocol.h> 66#include <net/protocol.h>
@@ -1688,6 +1689,8 @@ static int packet_dev_mc(struct net_device *dev, struct packet_mclist *i,
1688{ 1689{
1689 switch (i->type) { 1690 switch (i->type) {
1690 case PACKET_MR_MULTICAST: 1691 case PACKET_MR_MULTICAST:
1692 if (i->alen != dev->addr_len)
1693 return -EINVAL;
1691 if (what > 0) 1694 if (what > 0)
1692 return dev_mc_add(dev, i->addr, i->alen, 0); 1695 return dev_mc_add(dev, i->addr, i->alen, 0);
1693 else 1696 else
@@ -1700,6 +1703,8 @@ static int packet_dev_mc(struct net_device *dev, struct packet_mclist *i,
1700 return dev_set_allmulti(dev, what); 1703 return dev_set_allmulti(dev, what);
1701 break; 1704 break;
1702 case PACKET_MR_UNICAST: 1705 case PACKET_MR_UNICAST:
1706 if (i->alen != dev->addr_len)
1707 return -EINVAL;
1703 if (what > 0) 1708 if (what > 0)
1704 return dev_unicast_add(dev, i->addr); 1709 return dev_unicast_add(dev, i->addr);
1705 else 1710 else
@@ -1734,7 +1739,7 @@ static int packet_mc_add(struct sock *sk, struct packet_mreq_max *mreq)
1734 goto done; 1739 goto done;
1735 1740
1736 err = -EINVAL; 1741 err = -EINVAL;
1737 if (mreq->mr_alen != dev->addr_len) 1742 if (mreq->mr_alen > dev->addr_len)
1738 goto done; 1743 goto done;
1739 1744
1740 err = -ENOBUFS; 1745 err = -ENOBUFS;
@@ -2164,8 +2169,6 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd,
2164 case SIOCGIFDSTADDR: 2169 case SIOCGIFDSTADDR:
2165 case SIOCSIFDSTADDR: 2170 case SIOCSIFDSTADDR:
2166 case SIOCSIFFLAGS: 2171 case SIOCSIFFLAGS:
2167 if (!net_eq(sock_net(sk), &init_net))
2168 return -ENOIOCTLCMD;
2169 return inet_dgram_ops.ioctl(sock, cmd, arg); 2172 return inet_dgram_ops.ioctl(sock, cmd, arg);
2170#endif 2173#endif
2171 2174