From 84a98615363ce1265133efe0ec9d18bbaa6cc634 Mon Sep 17 00:00:00 2001 From: Tony Hutter Date: Thu, 15 Aug 2024 14:05:58 -0700 Subject: [PATCH] Linux 6.10 compat: Fix zvol NULL pointer deference zvol_alloc_non_blk_mq()->blk_queue_set_write_cache() needs the disk queue setup to prevent a NULL pointer deference. Reviewed-by: Brian Behlendorf Signed-off-by: Tony Hutter Closes #16453 --- module/os/linux/zfs/zvol_os.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c index 99a755e7dc..a4a710cb92 100644 --- a/module/os/linux/zfs/zvol_os.c +++ b/module/os/linux/zfs/zvol_os.c @@ -1216,13 +1216,14 @@ zvol_alloc_non_blk_mq(struct zvol_state_os *zso, zvol_queue_limits_t *limits) return (1); } + zso->zvo_disk = disk; + zso->zvo_disk->minors = ZVOL_MINORS; + zso->zvo_queue = zso->zvo_disk->queue; + #ifndef HAVE_BLKDEV_QUEUE_LIMITS_FEATURES blk_queue_set_write_cache(zso->zvo_queue, B_TRUE); #endif - zso->zvo_disk = disk; - zso->zvo_disk->minors = ZVOL_MINORS; - zso->zvo_queue = zso->zvo_disk->queue; #else zso->zvo_queue = blk_alloc_queue(NUMA_NO_NODE); if (zso->zvo_queue == NULL)