Search Linux Wireless

[PATCH 7/7] iw: fix fp handling inside handle_vendor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The fp can leak and should not be closed if we do i/o redirection.

Signed-off-by: John Crispin <john@xxxxxxxxxxx>
---
 vendor.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/vendor.c b/vendor.c
index 860cd48..d203d85 100644
--- a/vendor.c
+++ b/vendor.c
@@ -107,7 +107,8 @@ static int handle_vendor(struct nl80211_state *state,
 
 	if (file) {
 		count = read_file(file, buf, sizeof(buf));
-		fclose(file);
+		if (file != stdin)
+			fclose(file);
 	} else
 		count = read_hex(argc - 2, &argv[2], buf, sizeof(buf));
 
@@ -120,6 +121,8 @@ static int handle_vendor(struct nl80211_state *state,
 	return 0;
 
 nla_put_failure:
+	if (file && file != stdin)
+		fclose(file);
 	return -ENOBUFS;
 }
 
-- 
2.20.1




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux