Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef8aef55 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller
Browse files

[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: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2fbe43f6
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -450,6 +450,9 @@ int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
	__wsum csum;
	__wsum csum;
	int chunk = skb->len - hlen;
	int chunk = skb->len - hlen;


	if (!chunk)
		return 0;

	/* Skip filled elements.
	/* Skip filled elements.
	 * Pretty silly, look at memcpy_toiovec, though 8)
	 * Pretty silly, look at memcpy_toiovec, though 8)
	 */
	 */