aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@redhat.com>2021-03-10 19:31:21 +0100
committerJason Wang <jasowang@redhat.com>2021-03-22 17:34:31 +0800
commitef763586c943815eb0836c54c207ce8572e176a7 (patch)
treee2a40494d3b661819f91b63e92787728a1ce4198
parent6f10f77dcdbc151217d19229d9aeeb93c9c1c408 (diff)
net/eth: Check iovec has enough data earlier
We want to check fields from ip6_ext_hdr_routing structure and if correct read the full in6_address. Let's directly check if our iovec contains enough data for everything, else return early. Suggested-by: Stefano Garzarella <sgarzare@redhat.com> Reviewed-by: Miroslav Rezanina <mrezanin@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
-rw-r--r--net/eth.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/eth.c b/net/eth.c
index 087aa71a02..6db943d4b3 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -409,7 +409,7 @@ _eth_get_rss_ex_dst_addr(const struct iovec *pkt, int pkt_frags,
size_t input_size = iov_size(pkt, pkt_frags);
size_t bytes_read;
- if (input_size < ext_hdr_offset + sizeof(*ext_hdr)) {
+ if (input_size < ext_hdr_offset + sizeof(*rthdr) + sizeof(*dst_addr)) {
return false;
}