Re: [PATCH] net: ping: check minimum size on ICMP header length

2016-12-05 Thread David Miller
From: Kees Cook Date: Fri, 2 Dec 2016 16:58:53 -0800 > diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c > index 205e2000d395..8257be3f032c 100644 > --- a/net/ipv4/ping.c > +++ b/net/ipv4/ping.c > @@ -654,7 +654,7 @@ int ping_common_sendmsg(int family, struct msghdr *msg, > size_t len, >

Re: [PATCH] net: ping: check minimum size on ICMP header length

2016-12-04 Thread Lorenzo Colitti
On Sat, Dec 3, 2016 at 9:58 AM, Kees Cook wrote: > - if (len > 0x) > + if (len > 0x || len < icmph_len) > return -EMSGSIZE; EMSGSIZE usually means the message is too long. Maybe use EINVAL? That's what the code will return if the passed-in ICMP header is invali

[PATCH] net: ping: check minimum size on ICMP header length

2016-12-02 Thread Kees Cook
Prior to commit c0371da6047a ("put iov_iter into msghdr") in v3.19, there was no check that the iovec contained enough bytes for a icmp header, and the read loop would walk across neighboring stack contents. Since the iov_iter conversion, bad arguments are noticed, but the returned error is EFAULT.