Re: [PATCH] fio: make sure io_u->file isn't NULL before using it

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

 



On 10/11/21 4:27 AM, Luís Henriques wrote:
> While running fstests generic/095 against ext4 on a zram device I started
> seeing fio crashing.  Fix it by making sure io_u->file isn't NULL before
> accessing it.
> 
> Signed-off-by: Luís Henriques <lhenriques@xxxxxxx>
> ---
>  io_u.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/io_u.c b/io_u.c
> index 5289b5d1d9c6..b8e715d4118c 100644
> --- a/io_u.c
> +++ b/io_u.c
> @@ -2009,7 +2009,8 @@ static void io_completed(struct thread_data *td, struct io_u **io_u_ptr,
>  			io_u->xfer_buf += bytes;
>  			io_u->offset += bytes;
>  			td->ts.short_io_u[io_u->ddir]++;
> -			if (io_u->offset < io_u->file->real_file_size) {
> +			if (io_u->file &&
> +			    (io_u->offset < io_u->file->real_file_size)) {
>  				requeue_io_u(td, io_u_ptr);
>  				return;
>  			}

This will prevent the crash, but I'm wondering why io_u-> == NULL for this case.
It really should be a valid file.

Can you let me know exactly how you're reproducing this? Then I'll give it
a whirl too.

-- 
Jens Axboe




[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux