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>
This commit is contained in:
Philippe Mathieu-Daudé 2021-03-10 19:31:21 +01:00 committed by Jason Wang
parent 6f10f77dcd
commit ef763586c9
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}