diff mbox series

[PULL,11/13] net/eth: Check iovec has enough data earlier

Message ID 1616407692-693-12-git-send-email-jasowang@redhat.com
State New
Headers show
Series [PULL,01/13] net: eth: Add a helper to pad a short Ethernet frame | expand

Commit Message

Jason Wang March 22, 2021, 10:08 a.m. UTC
From: Philippe Mathieu-Daudé <philmd@redhat.com>

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

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>
 net/eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series


diff --git a/net/eth.c b/net/eth.c
index 087aa71..6db943d 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;