[PATCH] quota: fix coredump if projid file dose not exist

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

 



From: Wang Shilong <wshilong@xxxxxxx>

if '/etc/projid' dose not exist,@project_file will
be NULL pointer, fclose will cause coredump, add
check in endprent().

Signed-off-by: Wang Shilong <wshilong@xxxxxxx>
---
 quotasys.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/quotasys.c b/quotasys.c
index c78e02c..d04f25a 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -98,8 +98,10 @@ void setprent(void)
 /* Close /etc/projid file */
 void endprent(void)
 {
-	fclose(project_file);
-	project_file = NULL;
+	if (project_file) {
+		fclose(project_file);
+		project_file = NULL;
+	}
 }
 
 /* Get next entry in /etc/projid */
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux