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 3A9FD45BB6 for ; Wed, 23 Oct 2024 23:17:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3557140261; Wed, 23 Oct 2024 23:17:32 +0200 (CEST) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mails.dpdk.org (Postfix) with ESMTP id D8C3940261 for ; Wed, 23 Oct 2024 23:17:30 +0200 (CEST) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4315c1c7392so2134335e9.1 for ; Wed, 23 Oct 2024 14:17:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729718250; x=1730323050; 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=RwKiqT93wlQvleElTL/QO7m+k4xebNnaC7WzHAmlSrw=; b=c/L58mTEVZ/I7pQBneb1MjKAbW2l2/IZP5zoT3G0ZVUgs3b3usHRTIHRJmM0cgT/W1 ws1TptB0JGMRbmy1u/9Sw4Qf4vGKYyV8bg+HtBQlY6Kak98vOmFADgLoZBiEtwsRp2BU mAeKv3kvPXCr0GXqE8ubxHvMOH6iw7oYweKQSaFZgxDPRJUTi6zpMFN8sWKHzOGxyi2V CgALqjWvQ0qbfpuJgCz1S1grygfG/Y5tSLPcL70gPd4gBMq/eHZbmgySgGuIgZZ6M1ct QBXIQLPvYMaoD1PHB9UEcIOB2LbdjtjZqSuPKQ/a72Y3kzwePxD3QOdXk+NK6GQWHaST /smA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729718250; x=1730323050; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RwKiqT93wlQvleElTL/QO7m+k4xebNnaC7WzHAmlSrw=; b=mrho1xMp6ItR6HPNC6jVz5uyl4ZDUu1P+JdtQsMfrxQ/wXaztutiQy9EcX6gvK9Rq2 EzUpuZJ97Y8t8KL7VXKT/CGhmGlnwl/XOdpk9Nc9kzlQRTAmywAOUlOlWvQezbSbghl7 HeM/Sq1WJU0qdjIx44h0f6abas5USMU2VhJvAAtNOt6u64ziQj63QTh54p3zhXsK/6/S tJ/28F0A1FnQOrhEnYNbctm32gJtl68D/6wfDNpJm+tn8PWl+Om/kgVIvw56iQuut97O fB6sRKch4mhaQNakn9uIW2X1iZtygqxcxVtNux4v9AAouSMirpBjL3xSmOieWGBBT64a lI7w== X-Forwarded-Encrypted: i=1; AJvYcCV8PbZobLvD1KOBOwV4Rdnt1g/ZM2h7mmsdEtXjun6FyhunINWSJDhnpNjWztfmXP7UyeKaFcg=@dpdk.org X-Gm-Message-State: AOJu0YzSCZgiPNXt71zJv5kyNCH1fD/c3asMUmnczdCGO3KscaBCBe8L apLxLKwY7+QHf+NIPRXPuB9aRQJZ61XDZNan6CdZsqKr26WcoJDeQRFjeQ== X-Google-Smtp-Source: AGHT+IGV+o1zJFi2ej2CUrabK3X2e5aiJvvYLWGP01BLi/qd3h5LmeMaM036r5Kf9hlGPq5Il0yTSQ== X-Received: by 2002:a05:600c:3496:b0:431:4b88:d408 with SMTP id 5b1f17b1804b1-431841ee388mr33545025e9.5.1729718250316; Wed, 23 Oct 2024 14:17:30 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:21cd:def0:a01d:d2aa]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37ee0a47caesm9716929f8f.28.2024.10.23.14.17.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 14:17:29 -0700 (PDT) From: luca.boccassi@gmail.com To: Stephen Hemminger Cc: =?UTF-8?q?Morten=20Br=C3=B8rup?= , Konstantin Ananyev , Wathsala Vithanage , dpdk stable Subject: patch 'bpf: fix free function mismatch if convert fails' has been queued to stable release 22.11.7 Date: Wed, 23 Oct 2024 22:15:48 +0100 Message-ID: <20241023211704.1216956-8-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241023211704.1216956-1-luca.boccassi@gmail.com> References: <20241023211704.1216956-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 Hi, FYI, your patch has been queued to stable release 22.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 10/25/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/b6364f54063f11b70060268e8fc96ea24e9606e9 Thanks. Luca Boccassi --- >From b6364f54063f11b70060268e8fc96ea24e9606e9 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 8 Oct 2024 09:47:11 -0700 Subject: [PATCH] bpf: fix free function mismatch if convert fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ upstream commit a3923d6bd5c0b9838d8f4678233093ffad036193 ] If conversion of cBF to eBPF fails then an object allocated with rte_malloc() would be passed to free(). [908/3201] Compiling C object lib/librte_bpf.a.p/bpf_bpf_convert.c.o ../lib/bpf/bpf_convert.c: In function ‘rte_bpf_convert’: ../lib/bpf/bpf_convert.c:559:17: warning: ‘free’ called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc] 559 | free(prm); | ^~~~~~~~~ ../lib/bpf/bpf_convert.c:545:15: note: returned from ‘rte_zmalloc’ 545 | prm = rte_zmalloc("bpf_filter", | ^~~~~~~~~~~~~~~~~~~~~~~~~ 546 | sizeof(*prm) + ebpf_len * sizeof(*ebpf), 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: 2eccf6afbea9 ("bpf: add function to convert classic BPF to DPDK BPF") Signed-off-by: Stephen Hemminger Acked-by: Morten Brørup Acked-by: Konstantin Ananyev Acked-by: Wathsala Vithanage --- lib/bpf/bpf_convert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bpf/bpf_convert.c b/lib/bpf/bpf_convert.c index 9563274c9c..024c9edc9e 100644 --- a/lib/bpf/bpf_convert.c +++ b/lib/bpf/bpf_convert.c @@ -559,7 +559,7 @@ rte_bpf_convert(const struct bpf_program *prog) ret = bpf_convert_filter(prog->bf_insns, prog->bf_len, ebpf, &ebpf_len); if (ret < 0) { RTE_BPF_LOG(ERR, "%s: cannot convert cBPF to eBPF\n", __func__); - free(prm); + rte_free(prm); rte_errno = -ret; return NULL; } -- 2.45.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-10-23 22:16:40.858904428 +0100 +++ 0008-bpf-fix-free-function-mismatch-if-convert-fails.patch 2024-10-23 22:16:40.439940407 +0100 @@ -1 +1 @@ -From a3923d6bd5c0b9838d8f4678233093ffad036193 Mon Sep 17 00:00:00 2001 +From b6364f54063f11b70060268e8fc96ea24e9606e9 Mon Sep 17 00:00:00 2001 @@ -8,0 +9,2 @@ +[ upstream commit a3923d6bd5c0b9838d8f4678233093ffad036193 ] + @@ -26 +27,0 @@ -Cc: stable@dpdk.org @@ -37 +38 @@ -index d7ff2b4325..e7e298c9cb 100644 +index 9563274c9c..024c9edc9e 100644 @@ -40 +41 @@ -@@ -556,7 +556,7 @@ rte_bpf_convert(const struct bpf_program *prog) +@@ -559,7 +559,7 @@ rte_bpf_convert(const struct bpf_program *prog) @@ -43 +44 @@ - RTE_BPF_LOG_LINE(ERR, "%s: cannot convert cBPF to eBPF", __func__); + RTE_BPF_LOG(ERR, "%s: cannot convert cBPF to eBPF\n", __func__);