From patchwork Fri Oct 10 16:11:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eelco Chaudron X-Patchwork-Id: 2148350 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=LYuuq9ro; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4cjsFP3bSbz1yGy for ; Sat, 11 Oct 2025 03:11:53 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id CE466413D3; Fri, 10 Oct 2025 16:11:51 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id ZSJlXC5sgXvz; Fri, 10 Oct 2025 16:11:49 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org C8E1540DB9 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=LYuuq9ro Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id C8E1540DB9; Fri, 10 Oct 2025 16:11:49 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A6DBEC060E; Fri, 10 Oct 2025 16:11:49 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1D978C060D for ; Fri, 10 Oct 2025 16:11:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 0F88B61510 for ; Fri, 10 Oct 2025 16:11:49 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id vHPWpl2iBQWh for ; Fri, 10 Oct 2025 16:11:48 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=echaudro@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 1C33E60D5B Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 1C33E60D5B Authentication-Results: smtp3.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=LYuuq9ro Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 1C33E60D5B for ; Fri, 10 Oct 2025 16:11:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1760112707; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zYeNroFRlDVyF50/B3IPiEXBHt6lwUjA73bXJKLbzKw=; b=LYuuq9roNFFMJz++JtB1Vsg2mGVKBOuMnceun2ihVSBJrFHk6VkBd5vcOc1UonnIZFcWsU cmPjz/RIoPAh9Y7ZX0ORLa8dIvBTH+jT4SLLO6oJ5QDOypFDEVRDypbqwWrn8VR8PLQ1Lx hc87q8GfRVas7c5ShmN8Vsj/MN70lT0= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-117-RBIIjN4gMeavJ9qVcQlZCw-1; Fri, 10 Oct 2025 12:11:43 -0400 X-MC-Unique: RBIIjN4gMeavJ9qVcQlZCw-1 X-Mimecast-MFC-AGG-ID: RBIIjN4gMeavJ9qVcQlZCw_1760112702 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 675DC195608E for ; Fri, 10 Oct 2025 16:11:42 +0000 (UTC) Received: from ebuild.redhat.com (unknown [10.44.32.55]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8E35B1800452 for ; Fri, 10 Oct 2025 16:11:41 +0000 (UTC) To: dev@openvswitch.org Date: Fri, 10 Oct 2025 18:11:19 +0200 Message-ID: <416509e9b0c733a07b2fe3959a8e616998e7a91c.1760112679.git.echaudro@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: VqyUWPcMTQM8pD9P7Nor-x2IXkXPbSqIThIOJL5ZXH4_1760112702 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH] odp-execute: Fix null pointer dereference on empty nlattr. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Eelco Chaudron via dev From: Eelco Chaudron Reply-To: Eelco Chaudron Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This patch fixes a potential null pointer dereference reported by Coverity if an empty action list is passed to odp_execute_sample(). Fixes: 26c6b6cd2b2e ("dpif-netdev: Implement OVS_ACTION_ATTR_SAMPLE action.") Signed-off-by: Eelco Chaudron --- lib/odp-execute.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/odp-execute.c b/lib/odp-execute.c index 7f4e337f8..4e2edb70d 100644 --- a/lib/odp-execute.c +++ b/lib/odp-execute.c @@ -714,6 +714,10 @@ odp_execute_sample(void *dp, struct dp_packet *packet, bool steal, struct dp_packet_batch pb; size_t left; + if (!action || nl_attr_get_size(action) == 0) { + return; + } + NL_NESTED_FOR_EACH_UNSAFE (a, left, action) { int type = nl_attr_type(a);