]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
net/packet: fix overflow in check for tp_reserve
authorAndrey Konovalov <andreyknvl@google.com>
Wed, 29 Mar 2017 14:11:22 +0000 (16:11 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 31 Mar 2017 08:37:40 +0000 (10:37 +0200)
When calculating po->tp_hdrlen + po->tp_reserve the result can overflow.

Fix by checking that tp_reserve <= INT_MAX on assign.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
BugLink: https://bugs.launchpad.net/bugs/1678009
CVE-2017-7308
(cherry picked from commit bcc5364bdcfe131e6379363f089e7b4108d35b70 linux-net)
Signed-off-by: Andy Whitcroft <apw@canonical.com>
net/packet/af_packet.c

index 362e0ab4c516a356fc3d403d67f658651f5ad456..4835e5973e787ca83601bd0fdfc5142be5e3cc35 100644 (file)
@@ -3602,6 +3602,8 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
                        return -EBUSY;
                if (copy_from_user(&val, optval, sizeof(val)))
                        return -EFAULT;
+               if (val > INT_MAX)
+                       return -EINVAL;
                po->tp_reserve = val;
                return 0;
        }