linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ernesto A. Fernández" <ernesto.mnd.fernandez@gmail.com>
To: linux-fsdevel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>, "Xu, Wen" <wen.xu@gatech.edu>
Subject: [PATCH] hfsplus: fix NULL dereference in hfsplus_lookup()
Date: Thu, 12 Jul 2018 18:53:47 -0300	[thread overview]
Message-ID: <20180712215344.q44dyrhymm4ajkao@eaf> (raw)

Check that the hidden directory is not NULL before using it, instead of
after.

Reported-by: Wen Xu <wen.xu@gatech.edu>
Signed-off-by: Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
---
 fs/hfsplus/dir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index b5254378f011..cd017d7dbdfa 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -78,13 +78,13 @@ static struct dentry *hfsplus_lookup(struct inode *dir, struct dentry *dentry,
 				cpu_to_be32(HFSP_HARDLINK_TYPE) &&
 				entry.file.user_info.fdCreator ==
 				cpu_to_be32(HFSP_HFSPLUS_CREATOR) &&
+				HFSPLUS_SB(sb)->hidden_dir &&
 				(entry.file.create_date ==
 					HFSPLUS_I(HFSPLUS_SB(sb)->hidden_dir)->
 						create_date ||
 				entry.file.create_date ==
 					HFSPLUS_I(d_inode(sb->s_root))->
-						create_date) &&
-				HFSPLUS_SB(sb)->hidden_dir) {
+						create_date)) {
 			struct qstr str;
 			char name[32];
 
-- 
2.11.0

             reply	other threads:[~2018-07-12 22:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-12 21:53 Ernesto A. Fernández [this message]
2018-07-12 22:55 ` [PATCH] hfsplus: fix NULL dereference in hfsplus_lookup() Viacheslav Dubeyko
2018-08-21 23:05   ` Andrew Morton
2018-08-22 18:46     ` Ernesto A. Fernández
2018-08-22 20:18       ` Viacheslav Dubeyko
2018-08-22 21:38         ` Ernesto A. Fernández
     [not found] ` <20180712153311.71495c0ea5ba0115414f5301@linux-foundation.org>
2018-07-12 23:07   ` Ernesto A. Fernández
     [not found]     ` <20180712161907.c93f4e70e5d406fd3d2d373e@linux-foundation.org>
2018-07-12 23:23       ` Ernesto A. Fernández

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=20180712215344.q44dyrhymm4ajkao@eaf \
    --to=ernesto.mnd.fernandez@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=wen.xu@gatech.edu \
    /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).