lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 15 Nov 2013 00:32:31 +0800
From:	Peng Tao <bergwolf@...il.com>
To:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:	linux-kernel@...r.kernel.org,
	Bob Glossman <bob.glossman@...el.com>,
	Peng Tao <bergwolf@...il.com>,
	Andreas Dilger <andreas.dilger@...el.com>
Subject: [PATCH 08/39] staging/lustre/libcfs: improve validity test for valid file descriptors

From: Bob Glossman <bob.glossman@...el.com>

File descriptor members of struct lustre_kernelcomm aren't set to
anything special at start time.
This leads to incorrect tests and skipping valid fd closes at stop time.
Fixed by defining, setting, and testing against a specific LK_NOFD value.

Lustre-change: http://review.whamcloud.com/7275
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3683
Signed-off-by: Bob Glossman <bob.glossman@...el.com>
Reviewed-by: John L. Hammond <john.hammond@...el.com>
Reviewed-by: Keith Mannthey <keith.mannthey@...el.com>
Reviewed-by: Oleg Drokin <oleg.drokin@...el.com>
Signed-off-by: Peng Tao <bergwolf@...il.com>
Signed-off-by: Andreas Dilger <andreas.dilger@...el.com>
---
 .../include/linux/libcfs/libcfs_kernelcomm.h       |    1 +
 .../lustre/lustre/libcfs/kernel_user_comm.c        |   10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h
index 596a15f..4e12ffc 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h
@@ -97,6 +97,7 @@ extern int libcfs_kkuc_group_foreach(int group, libcfs_kkuc_cb_t cb_func,
 				     void *cb_arg);
 
 #define LK_FLG_STOP 0x01
+#define LK_NOFD -1U
 
 /* kernelcomm control structure, passed from userspace to kernel */
 typedef struct lustre_kernelcomm {
diff --git a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
index 74a0db5..9e5e3cc 100644
--- a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
+++ b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
@@ -56,6 +56,8 @@ int libcfs_ukuc_start(lustre_kernelcomm *link, int group)
 {
 	int pfd[2];
 
+	link->lk_rfd = link->lk_wfd = LK_NOFD;
+
 	if (pipe(pfd) < 0)
 		return -errno;
 
@@ -69,9 +71,13 @@ int libcfs_ukuc_start(lustre_kernelcomm *link, int group)
 
 int libcfs_ukuc_stop(lustre_kernelcomm *link)
 {
-	if (link->lk_wfd > 0)
+	int rc;
+
+	if (link->lk_wfd != LK_NOFD)
 		close(link->lk_wfd);
-	return close(link->lk_rfd);
+	rc = close(link->lk_rfd);
+	link->lk_rfd = link->lk_wfd = LK_NOFD;
+	return rc;
 }
 
 #define lhsz sizeof(*kuch)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ