summaryrefslogtreecommitdiffstats
path: root/net/packet
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-04-26 22:39:08 -0400
committerDavid S. Miller <davem@davemloft.net>2017-04-26 22:39:08 -0400
commitb1513c35317c106a1588f3ab32f6888f0e2afd71 (patch)
treeb2cd68a0d34dd04eb89fcf28e173e5ee22f898fd /net/packet
parent78a57b482aa53b040fbc2b2ef0208b54f004161b (diff)
parentf83246089ca09308425175d47f5e71e6da68b2ef (diff)
downloadlinux-b1513c35317c106a1588f3ab32f6888f0e2afd71.tar.bz2
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/packet')
-rw-r--r--net/packet/af_packet.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 94052f42058b..f4001763134d 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -3880,6 +3880,8 @@ static int packet_getsockopt(struct socket *sock, int level, int optname,
case PACKET_HDRLEN:
if (len > sizeof(int))
len = sizeof(int);
+ if (len < sizeof(int))
+ return -EINVAL;
if (copy_from_user(&val, optval, len))
return -EFAULT;
switch (val) {