]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
[PATCH] Fix datagram recvmsg NULL iov handling regression.
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 20 Sep 2007 19:41:36 +0000 (12:41 -0700)
committerWilly Tarreau <w@1wt.eu>
Wed, 17 Oct 2007 19:30:39 +0000 (21:30 +0200)
commit ef8aef55ce61fd0e2af798695f7386ac756ae1e7 in mainline

Subject: [PATCH] [NET]: Do not dereference iov if length is zero

When msg_iovlen is zero we shouldn't try to dereference
msg_iov.  Right now the only thing that tries to do so
is skb_copy_and_csum_datagram_iovec.  Since the total
length should also be zero if msg_iovlen is zero, it's
sufficient to check the total length there and simply
return if it's zero.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/core/datagram.c

index 797fdd4352ce50e3bf1ef2de7e3e7f686d2258c4..5d55a2ed7111b9c52fea2f75f18c4124b38836ca 100644 (file)
@@ -444,6 +444,9 @@ int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
        __wsum csum;
        int chunk = skb->len - hlen;
 
+       if (!chunk)
+               return 0;
+
        /* Skip filled elements.
         * Pretty silly, look at memcpy_toiovec, though 8)
         */