Fix bug reported by Coverity where directory being scanned was
not closed in error path (leaking file descriptor).

Coverity issue: 302848
Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support")
Signed-off-by: Stephen Hemminger <sthem...@microsoft.com>
---
 drivers/bus/vmbus/linux/vmbus_uio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c 
b/drivers/bus/vmbus/linux/vmbus_uio.c
index b0f8ebaea6ea..0b1b153cc017 100644
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
@@ -357,6 +357,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
                if (err) {
                        VMBUS_LOG(NOTICE, "invalid subchannel id %lu",
                                  subid);
+                       closedir(chan_dir);
                        return err;
                }
 
-- 
2.18.0

Reply via email to