public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: shaozongfan <shaozongfan@kylinos.cn>
Cc: chandan.babu@oracle.com, djwong@kernel.org,
	linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xfs: fix a NULL pointer problem
Date: Thu, 20 Jun 2024 01:09:08 -0700	[thread overview]
Message-ID: <ZnPjpCovlQq7_ptP@infradead.org> (raw)
In-Reply-To: <20240620074312.646085-1-shaozongfan@kylinos.cn>

On Thu, Jun 20, 2024 at 03:43:13PM +0800, shaozongfan wrote:
> when a process using getdents64() api to get a Folder inside
> the file directory,meantime other process delete the file
> directory.it would cause an error like this:

Can you share your reproducer?

>  	if (ctx->pos <= dotdot_offset) {
> -		ino = xfs_dir2_sf_get_parent_ino(sfp);
> +		sfp1 = sfp;
> +		if (sfp1 == NULL)
> +			return 0;
> +		ino = xfs_dir2_sf_get_parent_ino(sfp1);

This looks ... odd.  Assigning one pointer variable to another
doesn't revalidate anything.  And xfs_dir2_sf_getdents is called
with the iolock held, which should prevent xfs_idestroy_fork
from racing with it.  And if for some reason it doesn't we need
to fix the synchronization.


  reply	other threads:[~2024-06-20  8:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-20  7:43 [PATCH] xfs: fix a NULL pointer problem shaozongfan
2024-06-20  8:09 ` Christoph Hellwig [this message]
2024-06-21  6:34   ` [PATCH] xfs:trigger a-NULL-pointer-problem shaozongfan
2024-06-22  4:53     ` Christoph Hellwig

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=ZnPjpCovlQq7_ptP@infradead.org \
    --to=hch@infradead.org \
    --cc=chandan.babu@oracle.com \
    --cc=djwong@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=shaozongfan@kylinos.cn \
    /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