linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ernesto A. Fernández" <ernesto.mnd.fernandez@gmail.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: syzbot <syzbot+01ffaf5d9568dd1609f7@syzkaller.appspotmail.com>,
	syzkaller-bugs@googlegroups.com, viro@zeniv.linux.org.uk,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	akpm@linux-foundation.org
Subject: Re: [PATCH] hfsplus: don't return 0 when fill_super() failed
Date: Wed, 20 Jun 2018 22:45:56 -0300	[thread overview]
Message-ID: <20180621014555.4ul7w7wwkzbeifr6@eaf> (raw)
In-Reply-To: <d83ce31a-874c-dd5b-f790-41405983a5be@I-love.SAKURA.ne.jp>

On Tue, May 15, 2018 at 07:08:24PM +0900, Tetsuo Handa wrote:
> From f78a5fe168290cb9e009f4d907d04b5bfe277831 Mon Sep 17 00:00:00 2001
> From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Date: Tue, 15 May 2018 11:38:38 +0900
> Subject: [PATCH] hfsplus: don't return 0 when fill_super() failed
> 
> syzbot is reporting NULL pointer dereference at mount_fs() [1].
> This is because hfsplus_fill_super() is by error returning 0 when
> hfsplus_fill_super() detected invalid filesystem image, and mount_bdev()
> is returning NULL because dget(s->s_root) == NULL if s->s_root == NULL,
> and mount_fs() is accessing root->d_sb because IS_ERR(root) == false
> if root == NULL. Fix this by returning -EINVAL when hfsplus_fill_super()
> detected invalid filesystem image.
> 
> [1] https://syzkaller.appspot.com/bug?id=21acb6850cecbc960c927229e597158cf35f33d0
> 
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Reported-by: syzbot <syzbot+01ffaf5d9568dd1609f7@syzkaller.appspotmail.com>
> Cc: Al Viro <viro@zeniv.linux.org.uk>

It's been too long. I think I should give up on my patch. Maybe a review
can help your version get merged.

Reviewed-by: Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com>

> ---
>  fs/hfsplus/super.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
> index 513c357..9e690ae 100644
> --- a/fs/hfsplus/super.c
> +++ b/fs/hfsplus/super.c
> @@ -524,8 +524,10 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
>  		goto out_put_root;
>  	if (!hfs_brec_read(&fd, &entry, sizeof(entry))) {
>  		hfs_find_exit(&fd);
> -		if (entry.type != cpu_to_be16(HFSPLUS_FOLDER))
> +		if (entry.type != cpu_to_be16(HFSPLUS_FOLDER)) {
> +			err = -EINVAL;
>  			goto out_put_root;
> +		}
>  		inode = hfsplus_iget(sb, be32_to_cpu(entry.folder.id));
>  		if (IS_ERR(inode)) {
>  			err = PTR_ERR(inode);
> -- 
> 1.8.3.1
> 
> 

      parent reply	other threads:[~2018-06-21  1:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05  2:02 general protection fault in mount_fs syzbot
2018-05-15 10:08 ` [PATCH] hfsplus: don't return 0 when fill_super() failed Tetsuo Handa
     [not found]   ` <20180515164221.57cbosgvu6ahslon@eaf>
     [not found]     ` <201805192255.CAD48427.HLtFMOFVOSOQJF@I-love.SAKURA.ne.jp>
2018-05-19 23:25       ` Ernesto A. Fernández
2018-05-19 23:47         ` Al Viro
2018-06-21  1:45   ` Ernesto A. Fernández [this message]

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=20180621014555.4ul7w7wwkzbeifr6@eaf \
    --to=ernesto.mnd.fernandez@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=syzbot+01ffaf5d9568dd1609f7@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=viro@zeniv.linux.org.uk \
    --subject='Re: [PATCH] hfsplus: don'\''t return 0 when fill_super() failed' \
    /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

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).