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 1C56BA04DD for ; Wed, 28 Oct 2020 11:57:02 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 30ED3CAFC; Wed, 28 Oct 2020 11:57:00 +0100 (CET) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id 54B35CB41 for ; Wed, 28 Oct 2020 11:56:58 +0100 (CET) Received: by mail-wr1-f68.google.com with SMTP id s9so5173480wro.8 for ; Wed, 28 Oct 2020 03:56:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xI2sC6OPTB44ake/MTJdqmNvhigGzUF4Ie9IS0XHT10=; b=H7SDP7sQwzQX9gnUzYznor7vC/EkKXm9BdxRM4fcubbJwnwhuY/dWNG3D733AEJv3w QHEPCZ+PScJZ7/Ne95b+wCQFLGS3JR4bMJzPdFL50tAc+Y2cMY8EncbnGF9/ziZDTNH5 JyyNjZQjaX+3uvVZ4fPHgNoBcczhb/pl2prAgCSl2b93D4R64dwtE6J1yG3UwRm1hZZY rwlioImoiyN9cZmQQCCgLEm5nwjX+mPStzzX2Aad13LLkYy5TK530ZsdE0TuPA7ygVjB gC6KTTlSxGhS9hW2wSEEIT7wbaMLOcaaPmRzjb8c85hBGUzGvvift9VLp8fMi29ut5FV scSQ== 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=xI2sC6OPTB44ake/MTJdqmNvhigGzUF4Ie9IS0XHT10=; b=eGF/+t07ivJ2NAm5JHXKphMCJ2NMSRfprIQ1aooLOKrqe8BqjQacngGJb2cCPk0m/F 1FLhTDdPmDOAF1qhkXKqUzjqhLSIvK0R1fHA/Yk1Hiw3QwrzZxv4yvl3USj8Tbw1UZw7 PblUOmfO/auExdqUBDB3DfOhfsv6X1QFlX5a1oB4qHOvVNn3odt9qk9C2A2/TBK2q+Zf tNd/8/dAInb9rkZ0PyJ6LtZsn9l/sImT3+vH2luKn4sNFr0StX/hqGWB3mOHghOaHl0g VYiy7aLa7XSTvBrcj36vNe3gMiZ+ateRiKRFJpBb1L4PwdbOfwHHKqQZ29hJ1bLYf3ch K87A== X-Gm-Message-State: AOAM533eMdkjm5cXgIEmgQ3ysKnBTKy9WIXsbAv2kFr9MkSjhbbRA1D1 oVDbUr8vOxUjB6FfectjuJQ= X-Google-Smtp-Source: ABdhPJx/5+qTw6BBde1iYhgbfRU/3ivIhPFghkhCDtDZUiP2WCIDYu4qF/6gw2RXgUYXn4dQmzLxzw== X-Received: by 2002:a05:6000:104c:: with SMTP id c12mr7869314wrx.133.1603882617050; Wed, 28 Oct 2020 03:56:57 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id c8sm897140wrv.26.2020.10.28.03.56.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 03:56:56 -0700 (PDT) From: luca.boccassi@gmail.com To: Yunjian Wang Cc: David Marchand , dpdk stable Date: Wed, 28 Oct 2020 10:46:04 +0000 Message-Id: <20201028104606.3504127-205-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201028104606.3504127-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'eal/linux: fix memory leak in uevent handling' has been queued to stable release 19.11.6 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 stable release 19.11.6 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/30/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. Thanks. Luca Boccassi --- >From 5594a7c182d5d66b1c3ad94dbc3a25cbcc540270 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/linux/eal/eal_dev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/linux/eal/eal_dev.c b/lib/librte_eal/linux/eal/eal_dev.c index 83b6068264..803979ff46 100644 --- a/lib/librte_eal/linux/eal/eal_dev.c +++ b/lib/librte_eal/linux/eal/eal_dev.c @@ -189,7 +189,7 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length) else if (!strncmp(subsystem, "vfio", 4)) event->subsystem = EAL_DEV_EVENT_SUBSYSTEM_VFIO; else - return -1; + goto err; /* parse the action type */ if (!strncmp(action, "add", 3)) @@ -197,8 +197,11 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length) else if (!strncmp(action, "remove", 6)) event->type = RTE_DEV_EVENT_REMOVE; else - return -1; + goto err; return 0; +err: + free(event->devname); + return -1; } static void @@ -276,12 +279,14 @@ dev_uev_handler(__rte_unused void *param) rte_spinlock_unlock(&failure_handle_lock); } rte_dev_event_callback_process(uevent.devname, uevent.type); + free(uevent.devname); } return; failure_handle_err: rte_spinlock_unlock(&failure_handle_lock); + free(uevent.devname); } int -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-10-28 10:35:18.034048101 +0000 +++ 0205-eal-linux-fix-memory-leak-in-uevent-handling.patch 2020-10-28 10:35:11.812834558 +0000 @@ -1,27 +1,28 @@ -From 01072d52affac0f7fb6b8a5c8dd98015c4cef4c3 Mon Sep 17 00:00:00 2001 +From 5594a7c182d5d66b1c3ad94dbc3a25cbcc540270 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") -Cc: stable@dpdk.org Signed-off-by: Yunjian Wang Reviewed-by: David Marchand --- - lib/librte_eal/linux/eal_dev.c | 9 +++++++-- + lib/librte_eal/linux/eal/eal_dev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -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 -@@ -195,7 +195,7 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length) +diff --git a/lib/librte_eal/linux/eal/eal_dev.c b/lib/librte_eal/linux/eal/eal_dev.c +index 83b6068264..803979ff46 100644 +--- a/lib/librte_eal/linux/eal/eal_dev.c ++++ b/lib/librte_eal/linux/eal/eal_dev.c +@@ -189,7 +189,7 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length) else if (!strncmp(subsystem, "vfio", 4)) event->subsystem = EAL_DEV_EVENT_SUBSYSTEM_VFIO; else @@ -30,7 +31,7 @@ /* parse the action type */ if (!strncmp(action, "add", 3)) -@@ -203,8 +203,11 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length) +@@ -197,8 +197,11 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length) else if (!strncmp(action, "remove", 6)) event->type = RTE_DEV_EVENT_REMOVE; else @@ -43,7 +44,7 @@ } static void -@@ -282,12 +285,14 @@ dev_uev_handler(__rte_unused void *param) +@@ -276,12 +279,14 @@ dev_uev_handler(__rte_unused void *param) rte_spinlock_unlock(&failure_handle_lock); } rte_dev_event_callback_process(uevent.devname, uevent.type);