From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 865DD4623C for ; Sun, 16 Feb 2025 17:08:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8262940BA6; Sun, 16 Feb 2025 17:08:50 +0100 (CET) Received: from mail-lf1-f97.google.com (mail-lf1-f97.google.com [209.85.167.97]) by mails.dpdk.org (Postfix) with ESMTP id A079740150 for ; Sun, 16 Feb 2025 17:08:47 +0100 (CET) Received: by mail-lf1-f97.google.com with SMTP id 2adb3069b0e04-5439a6179a7so3771768e87.1 for ; Sun, 16 Feb 2025 08:08:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; t=1739722127; x=1740326927; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GFhtqmcqr1OkrzyWug/9cVU1zdzPSo7kuIbFQVP4ksc=; b=RuTRs0oyAeVXswzGn1Ikpx87ta8Q08R6imf1isHCNDY9ogsmIR/gtrAlbiqHcadKwk OK7eevjTgIgUhywZPqfpSkpk0nwaHo/VNzzgPv1b4Gby4ojF8QL3toiNJWDvql8VWB33 nowsPplk3jXAux+syOHaIjqPd17haQcG74PfFRjARld1Qosa7PnHKPB9qYRV/UB3auCw pev1dYnwCa+L5c4UbTNFmgJKK0hHeXZ+QzoA5Ay7hmHIaAG94uoSFsxKgMSANYN4o2dv /t4xFF+4vW/FpTqaXnVZAgmdZ1rQg0mFjOpT+XzQKaChNHLXlSTwhh6iMujv8rDUHnB3 Albw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739722127; x=1740326927; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:c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tp-Source: AGHT+IHroqXXfjhLABxpnuPfTIGwcrKwwn3VuRGoL5sG4nbfOjN7e4ylsBvhmWEFYtOfy/SJGS0t9bQFM/7b X-Received: by 2002:a05:6512:b12:b0:545:a70:74c5 with SMTP id 2adb3069b0e04-54530327a4fmr1889556e87.13.1739722126819; Sun, 16 Feb 2025 08:08:46 -0800 (PST) Received: from smtpservice.6wind.com ([185.13.181.2]) by smtp-relay.gmail.com with ESMTP id 2adb3069b0e04-5451f0b2001sm393475e87.24.2025.02.16.08.08.46; Sun, 16 Feb 2025 08:08:46 -0800 (PST) X-Relaying-Domain: 6wind.com Received: from localhost (rainbow.dev.6wind.com [10.17.1.165]) by smtpservice.6wind.com (Postfix) with ESMTP id 6E16D11327; Sun, 16 Feb 2025 17:08:46 +0100 (CET) From: Ariel Otilibili To: dev@dpdk.org Cc: Thomas Monjalon , David Marchand , Ariel Otilibili , Reshma Pattan , Stephen Hemminger , stable@dpdk.org Subject: [PATCH 1/1] pcapng: fix null dereference in rte_pcapng_close Date: Sun, 16 Feb 2025 17:08:33 +0100 Message-Id: <20250216160833.3216001-2-ariel.otilibili@6wind.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20250216160833.3216001-1-ariel.otilibili@6wind.com> References: <20250216160833.3216001-1-ariel.otilibili@6wind.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org rte_pcapng_close() might dereference a null pointer; as example, PVS-Studio gives its usage in test_pcapng.c: indeed, that call to rte_pcapng_close() might receive a null pointer. Link: https://pvs-studio.com/en/docs/warnings/v522/ Link: https://github.com/DPDK/dpdk/blob/e5176f23ae8b31437c3e5eb875c81f95bf3a9942/app/test/test_pcapng.c#L438 Fixes: 8d23ce8f5ee9 ("pcapng: add new library for writing pcapng files") Signed-off-by: Ariel Otilibili --- .mailmap | 2 +- lib/pcapng/rte_pcapng.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index a03d3cfb591b..ea68d6180ccc 100644 --- a/.mailmap +++ b/.mailmap @@ -135,7 +135,7 @@ Anupam Kapoor Apeksha Gupta Archana Muniganti Archit Pandey -Ariel Otilibili +Ariel Otilibili Arkadiusz Kubalewski Arkadiusz Kusztal Arnaud Fiorini diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c index 16485b27cb46..efd96a16ede7 100644 --- a/lib/pcapng/rte_pcapng.c +++ b/lib/pcapng/rte_pcapng.c @@ -716,6 +716,9 @@ rte_pcapng_fdopen(int fd, void rte_pcapng_close(rte_pcapng_t *self) { + if (!self) + return; + close(self->outfd); free(self); } -- 2.30.2