From nobody Wed Nov 19 10:09:23 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=1615392127; cv=none; d=zohomail.com; s=zohoarc; b=MEL34ZAuVgUOhWYa+BhtNzQ4x77vIcV3rPXGB2C4m0j9m7yrbJWlQMUrVYJTMjG4mPb8jYCRrB0unfDUavpW6/ygY020eiDjzVn43b6EhmeuwhyUfw4S6Sug5szYyVCwYiOn9zeyIa6Xnq5wgvT3WzBwmhFLlOaoYf+yLyfUGXY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615392127; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=z7STKW13AjGU8of8784VkFijz8VFi7Qj7fyPQfQCuSc=; b=Ye9bIXNSuyuCNtE3nRBWGLjWEU0/uMgh70lcpUBXV3g9mxTlGuNkSuSCMc6KJRpoIhz//TARD1K+slGfmMMXcR8t99zvU9ak4qEIBIfzMAoQsnoVuUmxVJ2+WmP8wcvXyqLaMyFir9elznlrDXR6aiCadFmLgGNZo03cuWfxyrA= 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 1615392127724896.9567124999126; Wed, 10 Mar 2021 08:02:07 -0800 (PST) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-362-5TZK3YSZNXCrOy-RdiPwAw-1; Wed, 10 Mar 2021 11:02:04 -0500 Received: by mail-ed1-f69.google.com with SMTP id w16so8594063edc.22 for ; Wed, 10 Mar 2021 08:02:04 -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 g26sm899475ejz.70.2021.03.10.08.01.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 08:01:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615392126; 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=z7STKW13AjGU8of8784VkFijz8VFi7Qj7fyPQfQCuSc=; b=jC/IgXXY940/vbP7qFKIAjah2fGastm3jMHA4qs1UoMemgpxAvfmTIjQGeH5oYfiVIY6Rl 7t4/Qhjk+3/c2U9UvA6kD+rB4ES/T+m0x6OeSWNDL5nGxvUr07/UwnTB47BHvxA/2k53il eCrrgxhVuLjMijUVZiu7BeonTeB8Whk= X-MC-Unique: 5TZK3YSZNXCrOy-RdiPwAw-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=z7STKW13AjGU8of8784VkFijz8VFi7Qj7fyPQfQCuSc=; b=Eeuw/PXdJlzzDtPLMU6pXxWuD6I4Gsj0pmTMdbX0AwKHYVS3AiKCADeBwvYPbbFN9T AnMAWOcN/WFE0O9f/ttdQxLBcTniFwhS8pWYZr0hhVrQBWvl7aJHJ5D+s/iM8tNYiBpX Q4YvyxPPNsaaLNS7WvOWL9XAXTxTnXMEtGmXvOr86pFQu+0BYlUG49YdbXmzgYNEmQQX TVV4ePECnD70bVkUu+rlwODfpO4L/ZRNCtEME+TonseceR5AaLPnrGNGiJy5qpL4F9MR Qr0R2C6CFrIfTCGhqPo5xpi2f72uCOmQuVRXfq34okN7Zh8nnwU1ZqGbFrRURTkja84q SF9A== X-Gm-Message-State: AOAM533dQpSP8c5e3lNjjuOczvtniarLJeHav4GCKfR4UFzt4+cVaPz4 rJNAPV/f6/ay4iQaGRjIU93AnEBaXLC1pqJ3SVq2rfawyKNP6SKDhyGscfg3ddmyeDIxAUGfDu1 r3HTjL1iGO3CdDQ== X-Received: by 2002:aa7:cc94:: with SMTP id p20mr4150144edt.353.1615392123738; Wed, 10 Mar 2021 08:02:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJwOH5owravIZco1LO5HGj2WOFn+55hGHiAodM7YqXyPpnXRdkEZH4mBWKQGs6m+2c/MfM6EOQ== X-Received: by 2002:aa7:cc94:: with SMTP id p20mr4149664edt.353.1615392119230; Wed, 10 Mar 2021 08:01:59 -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 4/7] net/eth: Check the size earlier Date: Wed, 10 Mar 2021 17:01:32 +0100 Message-Id: <20210310160135.1148272-5-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) Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefano Garzarella --- net/eth.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/net/eth.c b/net/eth.c index 7c47a267a7a..e870d02b0df 100644 --- a/net/eth.c +++ b/net/eth.c @@ -406,16 +406,14 @@ _eth_get_rss_ex_dst_addr(const struct iovec *pkt, int= pkt_frags, struct in6_address *dst_addr) { struct ip6_ext_hdr_routing *rthdr =3D (struct ip6_ext_hdr_routing *) e= xt_hdr; + size_t input_size =3D iov_size(pkt, pkt_frags); + size_t bytes_read; + + if (input_size < ext_hdr_offset + sizeof(*ext_hdr)) { + return false; + } =20 if ((rthdr->rtype =3D=3D 2) && (rthdr->segleft =3D=3D 1)) { - - size_t input_size =3D iov_size(pkt, pkt_frags); - size_t bytes_read; - - if (input_size < ext_hdr_offset + sizeof(*ext_hdr)) { - return false; - } - bytes_read =3D iov_to_buf(pkt, pkt_frags, ext_hdr_offset + sizeof(*ext_hdr), dst_addr, sizeof(*dst_addr)); --=20 2.26.2