From nobody Mon Feb 9 18:44:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1615401117; cv=none; d=zohomail.com; s=zohoarc; b=M+EvDxavup+kM+C+b8LXz9a6ijVk1f+rzYPhIOrLE/ducnD7I/TlxgVGSLuTf430crpsbxecJm8VzZcwAg208gcYIbqXs3KB/zW2W69A3GUfYVWjtge4mrwrufHHukYsisgfbZQZsOnQlgBxyxV7xzbtECI4z849RDjhUG5g5IM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615401117; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=jlY0Kaoccpxu0Z7znINrHN6ufu6pyEGXYRMIKp0FRTw=; b=hR3utOYsBORA8/ZJr03znf0Qk7Habo2KDGEQZmB79GDVJMmzvkRa+QKHLEXiHA4f6phmOZcOuwvIYK5uLLoUX6z97K034V6ypkyXNjp1MgR/hGWb9bmIqAtgPMnCNn/QYXy4vrntEX6F4TVGv+6kxCObQCyoy13pyKa8cEB/QRY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1615401117285824.6920925804183; Wed, 10 Mar 2021 10:31:57 -0800 (PST) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-229-rydJkXsHN7S4Zcxby0IEWA-1; Wed, 10 Mar 2021 13:31:52 -0500 Received: by mail-ej1-f70.google.com with SMTP id a22so5881745ejx.10 for ; Wed, 10 Mar 2021 10:31:52 -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 q11sm144137ejr.36.2021.03.10.10.31.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 10:31:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615401116; 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=jlY0Kaoccpxu0Z7znINrHN6ufu6pyEGXYRMIKp0FRTw=; b=avNk89D5i1ZqlD/+xkELcdeEDDPLwmEvo3FXSwF1zQjQ0WkgC6FE7vMDD5JzXgzaCvdUXK 0E1atSyP6HVn9O0L3zpKpKIwdyvuA8Gn2TiGw6mRU7nqVop2iV/ruFTZR5hhbpVUl6Zkz+ m8YPZBL8/OdYwEg4MS9hnQnLs2VfC7Y= X-MC-Unique: rydJkXsHN7S4Zcxby0IEWA-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=jlY0Kaoccpxu0Z7znINrHN6ufu6pyEGXYRMIKp0FRTw=; b=RabmNxicRtZSDPVu4DlEJvqUddZhVI40PtiDk4mmzkZSJYsLiPnTiFbacj1jC8yFig rUuXVyX2kuaK4XJWhbKf7pGIo16Bq+Yh61bYbZ0JZ2NdyMg8k+FaKi9mHMTK3p4PPQUm Pavuk/2XbFNdqTx11grf2L/7zGIt6jNakFWGS8IVRtUt8V+8TgJmLe5BCxsfIFmpS4AC 2diwn6XhapOvxndTn+7Vj2qd5kZbMTy+wkcE753ZUYlUlPguJ9Ft76/cB34nG68mJsGS Zo8927HQYJVUqHr1tXF2nhOFp3gL6hQPm30G4gO+iPsA6gstu7wMKnSJhEmWCgLJheA7 bMQw== X-Gm-Message-State: AOAM530eKP3B/r9INgWPklUT73acv7rvccq+fh3SKsHTV5mxEAjsPDm2 44FHcId/APHb7Rm8Bt+x5G1iG+Qqcdro/JpZ1AEJpjtThIbZpU/uVK6ExQ+bbLxLYvhlTngUwSL rY+tq6ycWvTEVqg== X-Received: by 2002:a17:906:565a:: with SMTP id v26mr5145586ejr.516.1615401111534; Wed, 10 Mar 2021 10:31:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJw3LpsKoj2p9zOHybiY+Edt4HvewveyE/LAO8x5Rs3XfgqmSr4JgEhs077OfbxaoS+CuxbegQ== X-Received: by 2002:a17:906:565a:: with SMTP id v26mr5145573ejr.516.1615401111432; Wed, 10 Mar 2021 10:31:51 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jason Wang , Stefano Garzarella , Thomas Huth , Miroslav Rezanina , Dmitry Fleytman , Paolo Bonzini , Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v6 5/7] net/eth: Check iovec has enough data earlier Date: Wed, 10 Mar 2021 19:31:21 +0100 Message-Id: <20210310183123.1212612-6-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210310183123.1212612-1-philmd@redhat.com> References: <20210310183123.1212612-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 --- net/eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/eth.c b/net/eth.c index 492359afbbb..b78aa526efc 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