From: Wang Shilong <wangshilong1991@gmail.com>
To: jack@suse.cz
Cc: linux-ext4@vger.kernel.org, sihara@ddn.com, lixi@ddn.com,
Wang Shilong <wshilong@ddn.com>
Subject: [PATCH] quota: fix coredump if projid file dose not exist
Date: Tue, 5 Jul 2016 16:00:40 +0900 [thread overview]
Message-ID: <1467702040-14764-1-git-send-email-wangshilong1991@gmail.com> (raw)
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
next reply other threads:[~2016-07-05 7:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-05 7:00 Wang Shilong [this message]
2016-07-06 9:44 ` [PATCH] quota: fix coredump if projid file dose not exist Jan Kara
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=1467702040-14764-1-git-send-email-wangshilong1991@gmail.com \
--to=wangshilong1991@gmail.com \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=lixi@ddn.com \
--cc=sihara@ddn.com \
--cc=wshilong@ddn.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 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).