iovec: make sure the caller actually wants anything in memcpy_fromiovecend
authorPaul Lawrence <paullawrence@google.com>
Wed, 18 Oct 2017 16:20:15 +0000 (09:20 -0700)
committerDanny Wood <danwood76@gmail.com>
Fri, 11 Jan 2019 07:53:54 +0000 (07:53 +0000)
Based on upstream change 06ebb06d49486676272a3c030bfeef4bd969a8e6

One more instance when the caller requests 0 bytes instead of running
off and dereferencing potentially invalid iovecs.

Signed-off-by: Paul Lawrence <paullawrence@google.com>
Bug: 36279469
Change-Id: Ib8d529e17c07c77357ab70bd6a2d7e305d6b27f0

net/core/iovec.c

index 1117a26a854809b6c89eff531b7784f25a353191..7fc51422d73c4a4d0ff49d4a5ec2853c5c9bc443 100644 (file)
@@ -147,6 +147,10 @@ int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov,
        __wsum csum = *csump;
        int partial_cnt = 0, err = 0;
 
+       /* No data? Done! */
+       if (len == 0)
+               return 0;
+
        /* Skip over the finished iovecs */
        while (offset >= iov->iov_len) {
                offset -= iov->iov_len;