Re: [PATCH] xfs: fix a NULL pointer problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux