From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 99738A04DD for ; Wed, 18 Nov 2020 17:38:08 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CAABBC97A; Wed, 18 Nov 2020 17:37:34 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by dpdk.org (Postfix) with ESMTP id A5481C90A for ; Wed, 18 Nov 2020 17:37:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605717452; 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=9A34g1C/lFr2YMbZwzLTMFSVbYYXDQRM7TXhM9DUnQM=; b=c0/T6tM+n01n5v3ZHqmZ4kNFP04Pfm0pPK5jxbKazmzKyF8eGF3PULin3rpFkxYKxT+how blqLkLiC5Jja7/m9SRU/J/ELpMc3TxlhYGcX2iOMod4cCSaZALHCXpqYTPu157r9K7+GmK kCKeEZD2mp+QeqSZTgBUJDRjncfVQQ8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-177-0oE3MmDrMTCwKSJLKV1MTg-1; Wed, 18 Nov 2020 11:37:29 -0500 X-MC-Unique: 0oE3MmDrMTCwKSJLKV1MTg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9491B190D375; Wed, 18 Nov 2020 16:37:20 +0000 (UTC) Received: from rh.redhat.com (ovpn-113-249.ams2.redhat.com [10.36.113.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 56B9D5C1A3; Wed, 18 Nov 2020 16:37:19 +0000 (UTC) From: Kevin Traynor To: Yunjian Wang Cc: David Marchand , dpdk stable Date: Wed, 18 Nov 2020 16:35:24 +0000 Message-Id: <20201118163558.1101823-38-ktraynor@redhat.com> In-Reply-To: <20201118163558.1101823-1-ktraynor@redhat.com> References: <20201118163558.1101823-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-stable] patch 'eal/linux: fix memory leak in uevent handling' has been queued to LTS release 18.11.11 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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 Sender: "stable" Hi, FYI, your patch has been queued to LTS release 18.11.11 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/24/20. 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/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/9d7c95022a36cc2282aa8953806da2acaaea47df Thanks. Kevin. --- >From 9d7c95022a36cc2282aa8953806da2acaaea47df Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Sat, 23 May 2020 18:52:21 +0800 Subject: [PATCH] eal/linux: fix memory leak in uevent handling [ upstream commit 01072d52affac0f7fb6b8a5c8dd98015c4cef4c3 ] When the memory for uevent.devname is allocated in dev_uev_parse(). It is not freed when parse the subsystem layer fails in dev_uev_parse(). Before return, it is also not freed in dev_uev_handler(). These cause a memory leak. Fixes: 0d0f478d0483 ("eal/linux: add uevent parse and process") Signed-off-by: Yunjian Wang Reviewed-by: David Marchand --- lib/librte_eal/linuxapp/eal/eal_dev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_dev.c b/lib/librte_eal/linuxapp/eal/eal_dev.c index c41809380d..07172d2109 100644 --- a/lib/librte_eal/linuxapp/eal/eal_dev.c +++ b/lib/librte_eal/linuxapp/eal/eal_dev.c @@ -190,5 +190,5 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length) event->subsystem = EAL_DEV_EVENT_SUBSYSTEM_VFIO; else - return -1; + goto err; /* parse the action type */ @@ -198,6 +198,9 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length) event->type = RTE_DEV_EVENT_REMOVE; else - return -1; + goto err; return 0; +err: + free(event->devname); + return -1; } @@ -278,4 +281,5 @@ dev_uev_handler(__rte_unused void *param) } rte_dev_event_callback_process(uevent.devname, uevent.type); + free(uevent.devname); } @@ -284,4 +288,5 @@ dev_uev_handler(__rte_unused void *param) failure_handle_err: rte_spinlock_unlock(&failure_handle_lock); + free(uevent.devname); } -- 2.26.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-11-18 16:33:38.659061661 +0000 +++ 0038-eal-linux-fix-memory-leak-in-uevent-handling.patch 2020-11-18 16:33:37.937215067 +0000 @@ -1 +1 @@ -From 01072d52affac0f7fb6b8a5c8dd98015c4cef4c3 Mon Sep 17 00:00:00 2001 +From 9d7c95022a36cc2282aa8953806da2acaaea47df Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 01072d52affac0f7fb6b8a5c8dd98015c4cef4c3 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -17 +18 @@ - lib/librte_eal/linux/eal_dev.c | 9 +++++++-- + lib/librte_eal/linuxapp/eal/eal_dev.c | 9 +++++++-- @@ -20,5 +21,5 @@ -diff --git a/lib/librte_eal/linux/eal_dev.c b/lib/librte_eal/linux/eal_dev.c -index 2e15762b56..5c0e752b2d 100644 ---- a/lib/librte_eal/linux/eal_dev.c -+++ b/lib/librte_eal/linux/eal_dev.c -@@ -196,5 +196,5 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length) +diff --git a/lib/librte_eal/linuxapp/eal/eal_dev.c b/lib/librte_eal/linuxapp/eal/eal_dev.c +index c41809380d..07172d2109 100644 +--- a/lib/librte_eal/linuxapp/eal/eal_dev.c ++++ b/lib/librte_eal/linuxapp/eal/eal_dev.c +@@ -190,5 +190,5 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length) @@ -31 +32 @@ -@@ -204,6 +204,9 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length) +@@ -198,6 +198,9 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length) @@ -42 +43 @@ -@@ -283,4 +286,5 @@ dev_uev_handler(__rte_unused void *param) +@@ -278,4 +281,5 @@ dev_uev_handler(__rte_unused void *param) @@ -48 +49 @@ -@@ -289,4 +293,5 @@ dev_uev_handler(__rte_unused void *param) +@@ -284,4 +288,5 @@ dev_uev_handler(__rte_unused void *param)