All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hewenliang <hewenliang4@huawei.com>
To: <valentina.manea.m@gmail.com>, <shuah@kernel.org>,
	<gregkh@linuxfoundation.org>, <allison@lohutok.net>,
	<swinslow@gmail.com>, <tglx@linutronix.de>,
	<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <linfeilong@huawei.com>, <hewenliang4@huawei.com>
Subject: [PATCH] usbip: tools: fix fd leakage in the function of read_attr_usbip_status
Date: Fri, 25 Oct 2019 00:35:15 -0400	[thread overview]
Message-ID: <20191025043515.20053-1-hewenliang4@huawei.com> (raw)

We should close the fd before the return of read_attr_usbip_status.

Fixes: 3391ba0e279 ("usbip: tools: Extract generic code to be shared with vudc backend")
Signed-off-by: Hewenliang <hewenliang4@huawei.com>
---
 tools/usb/usbip/libsrc/usbip_host_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/usb/usbip/libsrc/usbip_host_common.c b/tools/usb/usbip/libsrc/usbip_host_common.c
index 2813aa821c82..d1d8ba2a4a40 100644
--- a/tools/usb/usbip/libsrc/usbip_host_common.c
+++ b/tools/usb/usbip/libsrc/usbip_host_common.c
@@ -57,7 +57,7 @@ static int32_t read_attr_usbip_status(struct usbip_usb_device *udev)
 	}
 
 	value = atoi(status);
-
+	close(fd);
 	return value;
 }
 
-- 
2.19.1


                 reply	other threads:[~2019-10-25  4:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191025043515.20053-1-hewenliang4@huawei.com \
    --to=hewenliang4@huawei.com \
    --cc=allison@lohutok.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linfeilong@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=swinslow@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=valentina.manea.m@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.