From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 9EE541B411 for ; Fri, 23 Nov 2018 11:30:51 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 11C863138BB4; Fri, 23 Nov 2018 10:30:51 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id BFC9117C2D; Fri, 23 Nov 2018 10:30:49 +0000 (UTC) From: Kevin Traynor To: Stephen Hemminger Cc: dpdk stable Date: Fri, 23 Nov 2018 10:27:08 +0000 Message-Id: <20181123102713.17309-64-ktraynor@redhat.com> In-Reply-To: <20181123102713.17309-1-ktraynor@redhat.com> References: <20181123102713.17309-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 23 Nov 2018 10:30:51 +0000 (UTC) Subject: [dpdk-stable] patch 'bus/vmbus: fix directory handle leak on error' has been queued to stable release 18.08.1 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: , X-List-Received-Date: Fri, 23 Nov 2018 10:30:52 -0000 Hi, FYI, your patch has been queued to stable release 18.08.1 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/29/18. 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. If the code is different (ie: not only metadata diffs), due for example to a change in context or macro names, please double check it. Thanks. Kevin Traynor --- >>From 4e6f5483695e6f2b596b3c64d66170860351904e Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 6 Nov 2018 11:30:03 -0800 Subject: [PATCH] bus/vmbus: fix directory handle leak on error [ upstream commit 6521c9a2f7e00b0fcee940e0570ee12fcd9ca8dc ] If sysfs directory was incorrectly formatted then the vmbus setup code would leak a directory handle in the error path. Coverity issue: 302848 Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support") Signed-off-by: Stephen Hemminger --- drivers/bus/vmbus/linux/vmbus_uio.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c index 856c6d667..12e97e3a4 100644 --- a/drivers/bus/vmbus/linux/vmbus_uio.c +++ b/drivers/bus/vmbus/linux/vmbus_uio.c @@ -330,4 +330,5 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary, struct dirent *ent; DIR *chan_dir; + int err; snprintf(chan_path, sizeof(chan_path), @@ -345,5 +346,4 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary, unsigned long relid, subid, monid; char *endp; - int err; if (ent->d_name[0] == '.') @@ -365,6 +365,5 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary, VMBUS_LOG(NOTICE, "invalid subchannel id %lu", subid); - closedir(chan_dir); - return err; + goto fail; } @@ -383,5 +382,5 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary, VMBUS_LOG(NOTICE, "invalid monitor id %lu", monid); - return err; + goto fail; } @@ -389,5 +388,5 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary, if (err) { VMBUS_LOG(NOTICE, "subchannel setup failed"); - return err; + goto fail; } break; @@ -396,3 +395,6 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary, return (ent == NULL) ? -ENOENT : 0; +fail: + closedir(chan_dir); + return err; } -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-23 10:22:55.902566326 +0000 +++ 0064-bus-vmbus-fix-directory-handle-leak-on-error.patch 2018-11-23 10:22:54.000000000 +0000 @@ -1,14 +1,15 @@ -From 6521c9a2f7e00b0fcee940e0570ee12fcd9ca8dc Mon Sep 17 00:00:00 2001 +From 4e6f5483695e6f2b596b3c64d66170860351904e Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 6 Nov 2018 11:30:03 -0800 Subject: [PATCH] bus/vmbus: fix directory handle leak on error +[ upstream commit 6521c9a2f7e00b0fcee940e0570ee12fcd9ca8dc ] + If sysfs directory was incorrectly formatted then the vmbus setup code would leak a directory handle in the error path. Coverity issue: 302848 Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support") -Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger ---