From: Dave Chinner <david@fromorbit.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: Adrien Nader <adrien@notk.org>, xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH] xfs: don't release NULL pip in xfs_filestream_lookup_ag()
Date: Wed, 4 Mar 2015 08:30:35 +1100 [thread overview]
Message-ID: <20150303213035.GO18360@dastard> (raw)
In-Reply-To: <54F61641.1010708@redhat.com>
On Tue, Mar 03, 2015 at 02:14:57PM -0600, Eric Sandeen wrote:
> If xfs_filestream_get_parent() fails, we have a null pip,
> goto out, and attempt to IRELE(NULL). This causes a null
> pointer dereference and BUG().
>
> Fix this by testing for pip before trying to release it.
>
> Reported-by: Adrien Nader <adrien@notk.org>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> diff --git a/fs/xfs/xfs_filestream.c b/fs/xfs/xfs_filestream.c
> index a2e86e8..fb09a63 100644
> --- a/fs/xfs/xfs_filestream.c
> +++ b/fs/xfs/xfs_filestream.c
> @@ -348,7 +348,8 @@ xfs_filestream_lookup_ag(
> if (xfs_filestream_pick_ag(pip, startag, &ag, 0, 0))
> ag = NULLAGNUMBER;
> out:
> - IRELE(pip);
> + if (pip)
> + IRELE(pip);
> return ag;
> }
>
I'd just convert the error case when get_parent fails to:
if (!pip)
return NULLAGNUMBER;
rather than using the goto and adding conditional cleanup for this
case.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-03-03 21:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-03 20:14 [PATCH] xfs: don't release NULL pip in xfs_filestream_lookup_ag() Eric Sandeen
2015-03-03 21:30 ` Dave Chinner [this message]
2015-03-04 21:08 ` [PATCH V2] xfs: fix NULL pointer dereference " Eric Sandeen
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=20150303213035.GO18360@dastard \
--to=david@fromorbit.com \
--cc=adrien@notk.org \
--cc=sandeen@redhat.com \
--cc=xfs@oss.sgi.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