Re: [PATCH 2/4] xfs_scrub: close dir_fd if we don't get a DIR pointer

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

 



On 2/2/18 3:36 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> 
> If we don't get a directory pointer, close dir_fd before jumping out.
> 
> Fixes-coverity-id: 1428799
> Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

Reviewed-by: Eric Sandeen <sandeen@xxxxxxxxxx>

> ---
>  scrub/vfs.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> 
> diff --git a/scrub/vfs.c b/scrub/vfs.c
> index e3c8e62..573a2d0 100644
> --- a/scrub/vfs.c
> +++ b/scrub/vfs.c
> @@ -88,6 +88,7 @@ scan_fs_dir(
>  	/* Caller-specific directory checks. */
>  	if (!sft->dir_fn(ctx, sftd->path, dir_fd, sft->arg)) {
>  		sft->moveon = false;
> +		close(dir_fd);
>  		goto out;
>  	}
>  
> @@ -95,6 +96,7 @@ scan_fs_dir(
>  	dir = fdopendir(dir_fd);
>  	if (!dir) {
>  		str_errno(ctx, sftd->path);
> +		close(dir_fd);
>  		goto out;
>  	}
>  	rewinddir(dir);
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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