All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Luís Henriques" <lhenriques@suse.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: fio@vger.kernel.org, "Luís Henriques" <lhenriques@suse.de>
Subject: [PATCH] fio: make sure io_u->file isn't NULL before using it
Date: Mon, 11 Oct 2021 11:27:39 +0100	[thread overview]
Message-ID: <20211011102739.10429-1-lhenriques@suse.de> (raw)
In-Reply-To: <6f867fa0-c3e9-6f65-d97f-4779c029ef81@kernel.dk>

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@suse.de>
---
 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;
 			}

  parent reply	other threads:[~2021-10-11 10:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 17:11 generic/095 failing in ext4 and xfs Luis Henriques
2021-10-01 20:07 ` Theodore Ts'o
2021-10-01 20:46 ` Jens Axboe
2021-10-01 21:59   ` Theodore Ts'o
2021-10-02 10:16     ` Luis Henriques
2021-10-02 14:59       ` Jens Axboe
2021-10-04 10:08         ` Luis Henriques
2021-10-04 10:15           ` Luis Henriques
2021-10-04 12:17             ` Luis Henriques
2021-10-04 16:18               ` Theodore Ts'o
2021-10-06 13:39                 ` Luis Henriques
2021-10-11 10:27         ` Luís Henriques [this message]
2021-10-11 12:58           ` [PATCH] fio: make sure io_u->file isn't NULL before using it Jens Axboe
2021-10-11 13:44             ` Luís Henriques
2021-10-11 15:15               ` Jens Axboe
2021-10-11 15:45                 ` Luís Henriques
2021-10-10  8:31 ` generic/095 failing in ext4 and xfs Zorro Lang
2021-10-11  9:09   ` Luís Henriques
2021-10-11  9:31     ` Ming Lei
2021-10-11 10:16       ` Luís Henriques
2021-10-11 11:13         ` Ming Lei
2021-10-11 13:41           ` Luís Henriques
2021-10-11 12:44         ` Theodore Ts'o
2021-10-11 13:41           ` Luís Henriques

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=20211011102739.10429-1-lhenriques@suse.de \
    --to=lhenriques@suse.de \
    --cc=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.