* [PATCH] quota: fix coredump if projid file dose not exist
@ 2016-07-05 7:00 Wang Shilong
2016-07-06 9:44 ` Jan Kara
0 siblings, 1 reply; 2+ messages in thread
From: Wang Shilong @ 2016-07-05 7:00 UTC (permalink / raw)
To: jack; +Cc: linux-ext4, sihara, lixi, Wang Shilong
From: Wang Shilong <wshilong@ddn.com>
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@ddn.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] quota: fix coredump if projid file dose not exist
2016-07-05 7:00 [PATCH] quota: fix coredump if projid file dose not exist Wang Shilong
@ 2016-07-06 9:44 ` Jan Kara
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2016-07-06 9:44 UTC (permalink / raw)
To: Wang Shilong; +Cc: jack, linux-ext4, sihara, lixi, Wang Shilong
On Tue 05-07-16 16:00:40, Wang Shilong wrote:
> From: Wang Shilong <wshilong@ddn.com>
>
> 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@ddn.com>
Thanks. I've merged the patch.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-07-06 10:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-05 7:00 [PATCH] quota: fix coredump if projid file dose not exist Wang Shilong
2016-07-06 9:44 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).