From a31ed5e14bd848a136596ec7f288bdd75f9f6e0d Mon Sep 17 00:00:00 2001 From: Paul Lawrence Date: Wed, 18 Oct 2017 09:20:15 -0700 Subject: [PATCH] iovec: make sure the caller actually wants anything in memcpy_fromiovecend 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 Bug: 36279469 Change-Id: Ib8d529e17c07c77357ab70bd6a2d7e305d6b27f0 --- net/core/iovec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/core/iovec.c b/net/core/iovec.c index 1117a26a854..7fc51422d73 100644 --- a/net/core/iovec.c +++ b/net/core/iovec.c @@ -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; -- 2.20.1