public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Tinguely <tinguely@sgi.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: shutdown filesystem if xfs_perag_get fails
Date: Mon, 22 Apr 2013 08:45:02 -0500	[thread overview]
Message-ID: <51753EDE.6000301@sgi.com> (raw)
In-Reply-To: <5174603A.8030208@sandeen.net>

On 04/21/13 16:55, Eric Sandeen wrote:
> On 4/21/13 12:41 PM, Mark Tinguely wrote:
>
>> This problem happened locally with a bad inode number from xfs
>> recovery. xfs_perag_get() can return NULL if given a bad agno.
>> Most callers of xfs_perag_get() do not check for a NULL before
>> using the pointer. This patch forces a shutdown of the filesystem
>> for those callers that do not check the return value rather than
>> crashing on a dereferenced NULL pointer.
>
> Hi Mark -
>
> I'm curious, what was the callchain when this happened?  Was it
> during recovery?  If so, would aborting recovery be more prudent?
>
> I might be missing something, but I'm not sure how shutting
> down avoids a subsequent null ptr deref&  crash.
>
> i.e. if a caller does something like:
>
>          pag = xfs_perag_get(mp, agno);
>          spin_lock(&pag->pagb_lock);
>
> shutting down in xfs_perag_get doesn't save us from a
> null pag pointer, would it?
>
> Thanks,
> -Eric

You are correct, we have to exit the routine(s) to avoid the 
dereference. Let the callers handle the error.

Sorry for the noise.

--Mark.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2013-04-22 13:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20130419204102.736961610@sgi.com>
2013-04-21 17:41 ` [PATCH] xfs: shutdown filesystem if xfs_perag_get fails Mark Tinguely
2013-04-21 21:55   ` Eric Sandeen
2013-04-22 13:45     ` Mark Tinguely [this message]
2013-04-22 14:32       ` Eric Sandeen
2013-04-22 15:11         ` Mark Tinguely
2013-04-22 23:30           ` Dave Chinner
2013-04-23 13:48             ` Mark Tinguely
2013-04-23 15:54               ` Chandra Seetharaman
2013-04-23 20:49                 ` Dave Chinner
2013-04-25 22:41                   ` Chandra Seetharaman
2013-04-26  1:32                     ` Dave Chinner
2013-04-26 15:32                     ` Mark Tinguely
2013-04-26 16:07                       ` Ben Myers
2013-04-29 22:30                         ` Dave Chinner

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=51753EDE.6000301@sgi.com \
    --to=tinguely@sgi.com \
    --cc=sandeen@sandeen.net \
    --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