Blame SOURCES/0001-ioengines-fix-crash-with-enghelp-option.patch

fd38b0
From 2459bd33b3dbb7a34f28c612d595311a6bc7593d Mon Sep 17 00:00:00 2001
fd38b0
From: Vincent Fu <vincent.fu@samsung.com>
fd38b0
Date: Wed, 4 Aug 2021 18:29:05 +0000
fd38b0
Subject: [PATCH] ioengines: fix crash with --enghelp option
fd38b0
fd38b0
Since f6931a1dd35896433c8cc2e10de51372a2c496c4 commands like the
fd38b0
following segfault:
fd38b0
fd38b0
fio --enghelp=sg
fd38b0
fio --enghelp=sg,sg_write_mode
fd38b0
fd38b0
This is because free_ioengine() assumes that td->io_ops is not NULL.
fd38b0
Make this true when free_ioengine() is called by
fd38b0
fio_show_ioengine_help() to avoid the crash.
fd38b0
fd38b0
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
fd38b0
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fd38b0
---
fd38b0
 ioengines.c | 10 +++++-----
fd38b0
 1 file changed, 5 insertions(+), 5 deletions(-)
fd38b0
fd38b0
diff --git a/ioengines.c b/ioengines.c
fd38b0
index dd61af07..d08a511a 100644
fd38b0
--- a/ioengines.c
fd38b0
+++ b/ioengines.c
fd38b0
@@ -692,17 +692,17 @@ int fio_show_ioengine_help(const char *engine)
fd38b0
 	}
fd38b0
 
fd38b0
 	td.o.ioengine = (char *)engine;
fd38b0
-	io_ops = load_ioengine(&td);
fd38b0
+	td.io_ops = load_ioengine(&td);
fd38b0
 
fd38b0
-	if (!io_ops) {
fd38b0
+	if (!td.io_ops) {
fd38b0
 		log_info("IO engine %s not found\n", engine);
fd38b0
 		return 1;
fd38b0
 	}
fd38b0
 
fd38b0
-	if (io_ops->options)
fd38b0
-		ret = show_cmd_help(io_ops->options, sep);
fd38b0
+	if (td.io_ops->options)
fd38b0
+		ret = show_cmd_help(td.io_ops->options, sep);
fd38b0
 	else
fd38b0
-		log_info("IO engine %s has no options\n", io_ops->name);
fd38b0
+		log_info("IO engine %s has no options\n", td.io_ops->name);
fd38b0
 
fd38b0
 	free_ioengine(&td);
fd38b0
 	return ret;
fd38b0
-- 
fd38b0
2.17.0
fd38b0