diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-09-06 09:06:35 -0400 |
---|---|---|
committer | David S. Miller <davem@kimchee.(none)> | 2007-09-11 04:29:07 -0400 |
commit | ef8aef55ce61fd0e2af798695f7386ac756ae1e7 (patch) | |
tree | dd3d30a25e69fa94dcffa024e5a87758c0f6ba24 | |
parent | 2fbe43f6f631dd7ce19fb1499d6164a5bdb34568 (diff) |
[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>
-rw-r--r-- | net/core/datagram.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/core/datagram.c b/net/core/datagram.c index cb056f476126..029b93e246b4 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c | |||
@@ -450,6 +450,9 @@ int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, | |||
450 | __wsum csum; | 450 | __wsum csum; |
451 | int chunk = skb->len - hlen; | 451 | int chunk = skb->len - hlen; |
452 | 452 | ||
453 | if (!chunk) | ||
454 | return 0; | ||
455 | |||
453 | /* Skip filled elements. | 456 | /* Skip filled elements. |
454 | * Pretty silly, look at memcpy_toiovec, though 8) | 457 | * Pretty silly, look at memcpy_toiovec, though 8) |
455 | */ | 458 | */ |