Re: [PATCH mdadm v1 04/14] mdadm/Grow: Fix use after close bug by closing after fork

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

 



On Thu,  9 Jun 2022 15:11:20 -0600
Logan Gunthorpe <logang@xxxxxxxxxxxx> wrote:
> ---
>  Grow.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/Grow.c b/Grow.c
> index 8a242b0f8725..ba5dc1aead64 100644
> --- a/Grow.c
> +++ b/Grow.c
> @@ -3506,7 +3506,6 @@ started:
>  			return 0;
>  		}
>  
> -	close(fd);
>  	/* Now we just need to kick off the reshape and watch, while
>  	 * handling backups of the data...
>  	 * This is all done by a forked background process.
> @@ -3527,6 +3526,9 @@ started:
>  		break;
>  	}
>  
> +	/* Close unused file descriptor in the forked process */
> +	close(fd);
> +
>  	/* If another array on the same devices is busy, the
>  	 * reshape will wait for them.  This would mean that
>  	 * the first section that we suspend will stay suspended

Please use close_fd() helper to invalidate fd too.



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux