From nobody Wed Nov 19 10:09:32 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615392138; cv=none; d=zohomail.com; s=zohoarc; b=RwwN6jg+Gm7mxTLcaKNG2KeuYBzTemqJAoQu4/b8s5mUcw7Yph0IthHvY9DgI2F59qLtP7URfyZ0OQ2hity0J4bbvQOKhm+UFOpNjf6ga7zRWLrL2YmdMG4qoOBNsSglEMlwrNVTRw20GKEI7IQcjqDR+6vKmXyUShdYE5HonJ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615392138; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=0zxcBphhiOETeSJ3HAp76zLwbki6XNRBCYQIOVB2vCU=; b=InF9d4QExwLSMOVGk4f4hAhDU9xDn1utdyJCPrng5BwZRT2nkVyLD94l+srfkHdpbJyZwUCCEnIlkCOXyR4CEtcXeA85u/W0OBxRFrLztHgd4i4tf2NA5+Nkb2LXzNz4/3HZheKIJDTvsVrdUgEni/aIRVg//tFKMVRakAcGx6M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1615392138958579.0303165063902; Wed, 10 Mar 2021 08:02:18 -0800 (PST) Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-246-VRtpb5NHPLuu9UfTAxeJkg-1; Wed, 10 Mar 2021 11:02:16 -0500 Received: by mail-ej1-f72.google.com with SMTP id jo6so7417181ejb.13 for ; Wed, 10 Mar 2021 08:02:15 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id w18sm10194493ejn.23.2021.03.10.08.02.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 08:02:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615392137; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0zxcBphhiOETeSJ3HAp76zLwbki6XNRBCYQIOVB2vCU=; b=STeJDMAOb6yLnRz1QBvV5bIjuu13o3ljNzz48aptdSQ8dSd/Qlv2Iwoh0MsxQBnPMphwjg vX0h/doKrifHIGwyu7h0Cg127CeVC079+UuFufjsfdDctn19GP/JzBUwcwqE3YoBvHu3ZR BPO3IAVZz6SJ57s5ef0Gn1BeJcEMH2Q= X-MC-Unique: VRtpb5NHPLuu9UfTAxeJkg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0zxcBphhiOETeSJ3HAp76zLwbki6XNRBCYQIOVB2vCU=; b=FDsgVMxvixpqN2YoYZibuSVF9dyuiinpawFBnJ08c/85H2Y5x2DukwmCRpoSTpnlTi 1Pl+EvWXeEg91BEVoM32YnkVOt0Rxf0VEPUikmV6YLk3SysFxUFNK+prhNnljH9h2+6p ZZyLtSV2aekwfg1INM7d3rnHtQAuZMtcirsKZKfLDNNMLn/UBOE7vha4Pam2npJXoqx1 u7+/4vTRFaFzuxh8+HC+dIOY8TjyOTDpUD1Ur2BNlvLibyA2+o0/R4gXFo7CCiNeHHb9 P7p8eXslzWv7oiqrW0jU61gnocv9ehT0LglrR1NSYZ7O3JlsWXdekBvCyKDDnjOFD727 v31Q== X-Gm-Message-State: AOAM530p6vh2FSeig83qTVTR2I2PfZQfK4d8F+9sNEgUi8ewalL9OpT2 KaB482LyqNxshoE1e1G+jMUhDYoyeN65vR0M1YyK34HZVl7bsYGhySRoXjQek94iPaUgnVOfzix ksd/2v+iovMvCTw== X-Received: by 2002:a17:906:94ca:: with SMTP id d10mr4372209ejy.107.1615392130165; Wed, 10 Mar 2021 08:02:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQDDoDqFQvJ/MhGgNGsJegguM7SM+nDrBu9m6mmuFSl9OYZYU6/QgAPFOGYMuO6YxPmbEjFg== X-Received: by 2002:a17:906:94ca:: with SMTP id d10mr4371599ejy.107.1615392124499; Wed, 10 Mar 2021 08:02:04 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Stefano Garzarella , Dmitry Fleytman , Paolo Bonzini , Miroslav Rezanina , Jason Wang , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v5 5/7] net/eth: Check iovec has enough data earlier Date: Wed, 10 Mar 2021 17:01:33 +0100 Message-Id: <20210310160135.1148272-6-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210310160135.1148272-1-philmd@redhat.com> References: <20210310160135.1148272-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @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 early. Suggested-by: Stefano Garzarella Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefano Garzarella --- net/eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/eth.c b/net/eth.c index e870d02b0df..28cdc843a69 100644 --- a/net/eth.c +++ b/net/eth.c @@ -409,7 +409,7 @@ _eth_get_rss_ex_dst_addr(const struct iovec *pkt, int p= kt_frags, size_t input_size =3D iov_size(pkt, pkt_frags); size_t bytes_read; =20 - if (input_size < ext_hdr_offset + sizeof(*ext_hdr)) { + if (input_size < ext_hdr_offset + sizeof(*rthdr) + sizeof(*dst_addr)) { return false; } =20 --=20 2.26.2