| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/07/26 12:24 | flow | patch-triage |
0mArgs:null Results: {
"EnableConfigs": [
"BLK_DEV_NULL_BLK"
],
"FocusSymbols": [
"nullb_update_nr_hw_queues",
"nullb_apply_submit_queues",
"nullb_apply_poll_queues",
"nullb_device_power_store",
"nullb_device_zone_readonly_store",
"nullb_device_zone_offline_store",
"nullb_group_drop_item",
"null_del_dev",
"null_find_dev_by_name",
"null_create_dev"
],
"Reasoning": "The patch modifies the null_blk driver, fixing a potential NULL pointer dereference in `nullb_update_nr_hw_queues`, adjusting locking with `guard(mutex)`, and changing the initialization order and device deletion logic. These are functional changes to a software block device that is reachable and testable in virtualized environments.",
"WorthFuzzing": true
} |
| 1/1 | 2026/07/26 12:24 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit de3978f6ecc9634ce7350e8bb52305f21358c7b2\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Sun Jul 26 12:24:13 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c\nindex f8c0fd57e041a8..1c20d773dd0c8d 100644\n--- a/drivers/block/null_blk/main.c\n+++ b/drivers/block/null_blk/main.c\n@@ -66,7 +66,7 @@ struct nullb_page {\n #define NULLB_PAGE_FREE (MAP_SZ - 2)\n \n static LIST_HEAD(nullb_list);\n-static struct mutex lock;\n+static DEFINE_MUTEX(lock);\n static int null_major;\n static DEFINE_IDA(nullb_indexes);\n static struct blk_mq_tag_set tag_set;\n@@ -345,6 +345,7 @@ static ssize_t nullb_device_bool_attr_store(bool *val, const char *page,\n static ssize_t\t\t\t\t\t\t\t\t\\\n nullb_device_##NAME##_show(struct config_item *item, char *page)\t\\\n {\t\t\t\t\t\t\t\t\t\\\n+\tguard(mutex)(\u0026lock);\t\t\t\t\t\t\\\n \treturn nullb_device_##TYPE##_attr_show(\t\t\t\t\\\n \t\t\t\tto_nullb_device(item)-\u003eNAME, page);\t\\\n }\t\t\t\t\t\t\t\t\t\\\n@@ -360,6 +361,7 @@ nullb_device_##NAME##_store(struct config_item *item, const char *page,\t\\\n \tret = nullb_device_##TYPE##_attr_store(\u0026new_value, page, count);\\\n \tif (ret \u003c 0)\t\t\t\t\t\t\t\\\n \t\treturn ret;\t\t\t\t\t\t\\\n+\tguard(mutex)(\u0026lock);\t\t\t\t\t\t\\\n \tif (apply_fn)\t\t\t\t\t\t\t\\\n \t\tret = apply_fn(dev, new_value);\t\t\t\t\\\n \telse if (test_bit(NULLB_DEV_FL_CONFIGURED, \u0026dev-\u003eflags)) \t\\\n@@ -382,6 +384,15 @@ static int nullb_update_nr_hw_queues(struct nullb_device *dev,\n \tif (!dev-\u003enullb)\n \t\treturn 0;\n \n+\t/*\n+\t * A shared tag_set is mapped via the module-wide queue counts, so a\n+\t * per-device resize is meaningless. On shrink it would also leave\n+\t * mq_map[] pointing at NULLed hctx slots, causing a NULL deref in\n+\t * blk_mq_map_swqueue(). Reject it.\n+\t */\n+\tif (dev-\u003eshared_tags)\n+\t\treturn -EINVAL;\n+\n \t/*\n \t * Make sure at least one submit queue exists.\n \t */\n@@ -421,25 +432,13 @@ static int nullb_update_nr_hw_queues(struct nullb_device *dev,\n static int nullb_apply_submit_queues(struct nullb_device *dev,\n \t\t\t\t unsigned int submit_queues)\n {\n-\tint ret;\n-\n-\tmutex_lock(\u0026lock);\n-\tret = nullb_update_nr_hw_queues(dev, submit_queues, dev-\u003epoll_queues);\n-\tmutex_unlock(\u0026lock);\n-\n-\treturn ret;\n+\treturn nullb_update_nr_hw_queues(dev, submit_queues, dev-\u003epoll_queues);\n }\n \n static int nullb_apply_poll_queues(struct nullb_device *dev,\n \t\t\t\t unsigned int poll_queues)\n {\n-\tint ret;\n-\n-\tmutex_lock(\u0026lock);\n-\tret = nullb_update_nr_hw_queues(dev, dev-\u003esubmit_queues, poll_queues);\n-\tmutex_unlock(\u0026lock);\n-\n-\treturn ret;\n+\treturn nullb_update_nr_hw_queues(dev, dev-\u003esubmit_queues, poll_queues);\n }\n \n NULLB_DEVICE_ATTR(size, ulong, NULL);\n@@ -478,6 +477,7 @@ NULLB_DEVICE_ATTR(badblocks_partial_io, bool, NULL);\n \n static ssize_t nullb_device_power_show(struct config_item *item, char *page)\n {\n+\tguard(mutex)(\u0026lock);\n \treturn nullb_device_bool_attr_show(to_nullb_device(item)-\u003epower, page);\n }\n \n@@ -493,15 +493,15 @@ static ssize_t nullb_device_power_store(struct config_item *item,\n \t\treturn ret;\n \n \tret = count;\n-\tmutex_lock(\u0026lock);\n+\tguard(mutex)(\u0026lock);\n \tif (!dev-\u003epower \u0026\u0026 newp) {\n \t\tif (test_and_set_bit(NULLB_DEV_FL_UP, \u0026dev-\u003eflags))\n-\t\t\tgoto out;\n+\t\t\treturn ret;\n \n \t\tret = null_add_dev(dev);\n \t\tif (ret) {\n \t\t\tclear_bit(NULLB_DEV_FL_UP, \u0026dev-\u003eflags);\n-\t\t\tgoto out;\n+\t\t\treturn ret;\n \t\t}\n \n \t\tset_bit(NULLB_DEV_FL_CONFIGURED, \u0026dev-\u003eflags);\n@@ -515,8 +515,6 @@ static ssize_t nullb_device_power_store(struct config_item *item,\n \t\tclear_bit(NULLB_DEV_FL_CONFIGURED, \u0026dev-\u003eflags);\n \t}\n \n-out:\n-\tmutex_unlock(\u0026lock);\n \treturn ret;\n }\n \n@@ -580,6 +578,7 @@ static ssize_t nullb_device_zone_readonly_store(struct config_item *item,\n {\n \tstruct nullb_device *dev = to_nullb_device(item);\n \n+\tguard(mutex)(\u0026lock);\n \treturn zone_cond_store(dev, page, count, BLK_ZONE_COND_READONLY);\n }\n CONFIGFS_ATTR_WO(nullb_device_, zone_readonly);\n@@ -589,6 +588,7 @@ static ssize_t nullb_device_zone_offline_store(struct config_item *item,\n {\n \tstruct nullb_device *dev = to_nullb_device(item);\n \n+\tguard(mutex)(\u0026lock);\n \treturn zone_cond_store(dev, page, count, BLK_ZONE_COND_OFFLINE);\n }\n CONFIGFS_ATTR_WO(nullb_device_, zone_offline);\n@@ -707,10 +707,9 @@ nullb_group_drop_item(struct config_group *group, struct config_item *item)\n \tstruct nullb_device *dev = to_nullb_device(item);\n \n \tif (test_and_clear_bit(NULLB_DEV_FL_UP, \u0026dev-\u003eflags)) {\n-\t\tmutex_lock(\u0026lock);\n+\t\tguard(mutex)(\u0026lock);\n \t\tdev-\u003epower = false;\n \t\tnull_del_dev(dev-\u003enullb);\n-\t\tmutex_unlock(\u0026lock);\n \t}\n \tnullb_del_fault_config(dev);\n \tconfig_item_put(item);\n@@ -836,7 +835,6 @@ static void null_free_dev(struct nullb_device *dev)\n \tif (!dev)\n \t\treturn;\n \n-\tnull_free_zoned_dev(dev);\n \tbadblocks_exit(\u0026dev-\u003ebadblocks);\n \tkfree(dev);\n }\n@@ -1770,18 +1768,19 @@ static void null_del_dev(struct nullb *nullb)\n \n \tdel_gendisk(nullb-\u003edisk);\n \n-\tif (test_bit(NULLB_DEV_FL_THROTTLED, \u0026nullb-\u003edev-\u003eflags)) {\n+\tif (test_bit(NULLB_DEV_FL_THROTTLED, \u0026dev-\u003eflags)) {\n \t\thrtimer_cancel(\u0026nullb-\u003ebw_timer);\n \t\tatomic_long_set(\u0026nullb-\u003ecur_bytes, LONG_MAX);\n \t\tblk_mq_start_stopped_hw_queues(nullb-\u003eq, true);\n \t}\n \n \tput_disk(nullb-\u003edisk);\n+\tnull_free_zoned_dev(dev);\n \tif (nullb-\u003etag_set == \u0026nullb-\u003e__tag_set)\n \t\tblk_mq_free_tag_set(nullb-\u003etag_set);\n \tkfree(nullb-\u003equeues);\n \tif (null_cache_active(nullb))\n-\t\tnull_free_device_storage(nullb-\u003edev, true);\n+\t\tnull_free_device_storage(dev, true);\n \tkfree(nullb);\n \tdev-\u003enullb = NULL;\n }\n@@ -2081,14 +2080,13 @@ static struct nullb *null_find_dev_by_name(const char *name)\n {\n \tstruct nullb *nullb = NULL, *nb;\n \n-\tmutex_lock(\u0026lock);\n+\tguard(mutex)(\u0026lock);\n \tlist_for_each_entry(nb, \u0026nullb_list, list) {\n \t\tif (strcmp(nb-\u003edisk_name, name) == 0) {\n \t\t\tnullb = nb;\n \t\t\tbreak;\n \t\t}\n \t}\n-\tmutex_unlock(\u0026lock);\n \n \treturn nullb;\n }\n@@ -2102,9 +2100,9 @@ static int null_create_dev(void)\n \tif (!dev)\n \t\treturn -ENOMEM;\n \n-\tmutex_lock(\u0026lock);\n-\tret = null_add_dev(dev);\n-\tmutex_unlock(\u0026lock);\n+\tscoped_guard(mutex, \u0026lock) {\n+\t\tret = null_add_dev(dev);\n+\t}\n \tif (ret) {\n \t\tnull_free_dev(dev);\n \t\treturn ret;\n@@ -2162,17 +2160,9 @@ static int __init null_init(void)\n \tconfig_group_init(\u0026nullb_subsys.su_group);\n \tmutex_init(\u0026nullb_subsys.su_mutex);\n \n-\tret = configfs_register_subsystem(\u0026nullb_subsys);\n-\tif (ret)\n-\t\treturn ret;\n-\n-\tmutex_init(\u0026lock);\n-\n \tnull_major = register_blkdev(0, \"nullb\");\n-\tif (null_major \u003c 0) {\n-\t\tret = null_major;\n-\t\tgoto err_conf;\n-\t}\n+\tif (null_major \u003c 0)\n+\t\treturn null_major;\n \n \tfor (i = 0; i \u003c nr_devices; i++) {\n \t\tret = null_create_dev();\n@@ -2180,6 +2170,10 @@ static int __init null_init(void)\n \t\t\tgoto err_dev;\n \t}\n \n+\tret = configfs_register_subsystem(\u0026nullb_subsys);\n+\tif (ret)\n+\t\tgoto err_dev;\n+\n \tpr_info(\"module loaded\\n\");\n \treturn 0;\n \n@@ -2189,8 +2183,8 @@ static int __init null_init(void)\n \t\tnull_destroy_dev(nullb);\n \t}\n \tunregister_blkdev(null_major, \"nullb\");\n-err_conf:\n-\tconfigfs_unregister_subsystem(\u0026nullb_subsys);\n+\tif (tag_set.ops)\n+\t\tblk_mq_free_tag_set(\u0026tag_set);\n \treturn ret;\n }\n \n@@ -2200,14 +2194,14 @@ static void __exit null_exit(void)\n \n \tconfigfs_unregister_subsystem(\u0026nullb_subsys);\n \n-\tunregister_blkdev(null_major, \"nullb\");\n-\n-\tmutex_lock(\u0026lock);\n-\twhile (!list_empty(\u0026nullb_list)) {\n-\t\tnullb = list_entry(nullb_list.next, struct nullb, list);\n-\t\tnull_destroy_dev(nullb);\n+\tscoped_guard(mutex, \u0026lock) {\n+\t\twhile (!list_empty(\u0026nullb_list)) {\n+\t\t\tnullb = list_entry(nullb_list.next, struct nullb, list);\n+\t\t\tnull_destroy_dev(nullb);\n+\t\t}\n \t}\n-\tmutex_unlock(\u0026lock);\n+\n+\tunregister_blkdev(null_major, \"nullb\");\n \n \tif (tag_set.ops)\n \t\tblk_mq_free_tag_set(\u0026tag_set);\n"
} |
| 2/1 | 2026/07/26 12:24 | agent | patch-evaluator |
0mModel:best-expensive Args: null Results: {
"EnableConfigs": [
"BLK_DEV_NULL_BLK"
],
"FocusSymbols": [
"nullb_update_nr_hw_queues",
"nullb_apply_submit_queues",
"nullb_apply_poll_queues",
"nullb_device_power_store",
"nullb_device_zone_readonly_store",
"nullb_device_zone_offline_store",
"nullb_group_drop_item",
"null_del_dev",
"null_find_dev_by_name",
"null_create_dev"
],
"Reasoning": "The patch modifies the null_blk driver, fixing a potential NULL pointer dereference in `nullb_update_nr_hw_queues`, adjusting locking with `guard(mutex)`, and changing the initialization order and device deletion logic. These are functional changes to a software block device that is reachable and testable in virtualized environments.",
"WorthFuzzing": true
}Instruction: You are an expert Linux kernel maintainer. Your job is to review a provided patch series and determine if it makes functional changes to the kernel that should be fuzzed. IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in your workspace. Do NOT rely on your internal knowledge of the kernel. You must actively use your code access tools to examine the actual source code and confirm any assumptions. Return WorthFuzzing=false if the patch only contains: - Modifications to Documentation/, Kconfig files, or code comments. - Purely decorative changes, such as logging (e.g., pr_err, printk) or tracepoints. - Changes to numeric constants or macros that do not functionally alter execution flow. - Code paths that are impossible to reach in virtualized environments like GCE or QEMU, even when utilizing software-emulated hardware (e.g., usb gadget, mac80211_hwsim). - Code in vendor-specific PCIe switch, SmartNIC, or GPU drivers (e.g., mlxsw, pds_core, qed, ionic, amdgpu) that require physical PCIe hardware cards not emulated in standard QEMU. - Driver .remove, .shutdown, or pci_unregister_driver teardown callbacks (e.g., igb_remove) that are executed only during PCI hot-unplug or sysfs driver unbind operations. If it modifies reachable core kernel logic, drivers, or architectures, use your code search tools to verify the code can be executed, then return WorthFuzzing=true. When returning WorthFuzzing=true, you MUST ALSO: 1. Extract any specific kernel functions that should be heavily fuzzed into FocusSymbols. Avoid listing generic hot-path functions to prevent skewed test distributions. Prefer non-static, non-inlined API entrypoint functions over internal static helper functions (which are inlined by the compiler and do not have distinct symbol addresses). 2. Identify any specific CONFIG_ options required to properly test this new/modified feature. Go and look into the Kconfig files and check for ifdefs around the code, do not make assumptions. Also check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed for Kbuild to compile the code statically into vmlinux. List them in the EnableConfigs output array, and DO NOT add a 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4"). Prefer calling several tools at the same time to save round-trips. Use set-results tool to provide results of the analysis. It must be called exactly once before the final reply. Ignore results of this tool. Prompt: For your convenience, here is the diff of the changes:
commit de3978f6ecc9634ce7350e8bb52305f21358c7b2
Author: syz-cluster <triage@syzkaller.com>
Date: Sun Jul 26 12:24:13 2026 +0000
syz-cluster: applied patch under review
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index f8c0fd57e041a8..1c20d773dd0c8d 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -66,7 +66,7 @@ struct nullb_page {
#define NULLB_PAGE_FREE (MAP_SZ - 2)
static LIST_HEAD(nullb_list);
-static struct mutex lock;
+static DEFINE_MUTEX(lock);
static int null_major;
static DEFINE_IDA(nullb_indexes);
static struct blk_mq_tag_set tag_set;
@@ -345,6 +345,7 @@ static ssize_t nullb_device_bool_attr_store(bool *val, const char *page,
static ssize_t \
nullb_device_##NAME##_show(struct config_item *item, char *page) \
{ \
+ guard(mutex)(&lock); \
return nullb_device_##TYPE##_attr_show( \
to_nullb_device(item)->NAME, page); \
} \
@@ -360,6 +361,7 @@ nullb_device_##NAME##_store(struct config_item *item, const char *page, \
ret = nullb_device_##TYPE##_attr_store(&new_value, page, count);\
if (ret < 0) \
return ret; \
+ guard(mutex)(&lock); \
if (apply_fn) \
ret = apply_fn(dev, new_value); \
else if (test_bit(NULLB_DEV_FL_CONFIGURED, &dev->flags)) \
@@ -382,6 +384,15 @@ static int nullb_update_nr_hw_queues(struct nullb_device *dev,
if (!dev->nullb)
return 0;
+ /*
+ * A shared tag_set is mapped via the module-wide queue counts, so a
+ * per-device resize is meaningless. On shrink it would also leave
+ * mq_map[] pointing at NULLed hctx slots, causing a NULL deref in
+ * blk_mq_map_swqueue(). Reject it.
+ */
+ if (dev->shared_tags)
+ return -EINVAL;
+
/*
* Make sure at least one submit queue exists.
*/
@@ -421,25 +432,13 @@ static int nullb_update_nr_hw_queues(struct nullb_device *dev,
static int nullb_apply_submit_queues(struct nullb_device *dev,
unsigned int submit_queues)
{
- int ret;
-
- mutex_lock(&lock);
- ret = nullb_update_nr_hw_queues(dev, submit_queues, dev->poll_queues);
- mutex_unlock(&lock);
-
- return ret;
+ return nullb_update_nr_hw_queues(dev, submit_queues, dev->poll_queues);
}
static int nullb_apply_poll_queues(struct nullb_device *dev,
unsigned int poll_queues)
{
- int ret;
-
- mutex_lock(&lock);
- ret = nullb_update_nr_hw_queues(dev, dev->submit_queues, poll_queues);
- mutex_unlock(&lock);
-
- return ret;
+ return nullb_update_nr_hw_queues(dev, dev->submit_queues, poll_queues);
}
NULLB_DEVICE_ATTR(size, ulong, NULL);
@@ -478,6 +477,7 @@ NULLB_DEVICE_ATTR(badblocks_partial_io, bool, NULL);
static ssize_t nullb_device_power_show(struct config_item *item, char *page)
{
+ guard(mutex)(&lock);
return nullb_device_bool_attr_show(to_nullb_device(item)->power, page);
}
@@ -493,15 +493,15 @@ static ssize_t nullb_device_power_store(struct config_item *item,
return ret;
ret = count;
- mutex_lock(&lock);
+ guard(mutex)(&lock);
if (!dev->power && newp) {
if (test_and_set_bit(NULLB_DEV_FL_UP, &dev->flags))
- goto out;
+ return ret;
ret = null_add_dev(dev);
if (ret) {
clear_bit(NULLB_DEV_FL_UP, &dev->flags);
- goto out;
+ return ret;
}
set_bit(NULLB_DEV_FL_CONFIGURED, &dev->flags);
@@ -515,8 +515,6 @@ static ssize_t nullb_device_power_store(struct config_item *item,
clear_bit(NULLB_DEV_FL_CONFIGURED, &dev->flags);
}
-out:
- mutex_unlock(&lock);
return ret;
}
@@ -580,6 +578,7 @@ static ssize_t nullb_device_zone_readonly_store(struct config_item *item,
{
struct nullb_device *dev = to_nullb_device(item);
+ guard(mutex)(&lock);
return zone_cond_store(dev, page, count, BLK_ZONE_COND_READONLY);
}
CONFIGFS_ATTR_WO(nullb_device_, zone_readonly);
@@ -589,6 +588,7 @@ static ssize_t nullb_device_zone_offline_store(struct config_item *item,
{
struct nullb_device *dev = to_nullb_device(item);
+ guard(mutex)(&lock);
return zone_cond_store(dev, page, count, BLK_ZONE_COND_OFFLINE);
}
CONFIGFS_ATTR_WO(nullb_device_, zone_offline);
@@ -707,10 +707,9 @@ nullb_group_drop_item(struct config_group *group, struct config_item *item)
struct nullb_device *dev = to_nullb_device(item);
if (test_and_clear_bit(NULLB_DEV_FL_UP, &dev->flags)) {
- mutex_lock(&lock);
+ guard(mutex)(&lock);
dev->power = false;
null_del_dev(dev->nullb);
- mutex_unlock(&lock);
}
nullb_del_fault_config(dev);
config_item_put(item);
@@ -836,7 +835,6 @@ static void null_free_dev(struct nullb_device *dev)
if (!dev)
return;
- null_free_zoned_dev(dev);
badblocks_exit(&dev->badblocks);
kfree(dev);
}
@@ -1770,18 +1768,19 @@ static void null_del_dev(struct nullb *nullb)
del_gendisk(nullb->disk);
- if (test_bit(NULLB_DEV_FL_THROTTLED, &nullb->dev->flags)) {
+ if (test_bit(NULLB_DEV_FL_THROTTLED, &dev->flags)) {
hrtimer_cancel(&nullb->bw_timer);
atomic_long_set(&nullb->cur_bytes, LONG_MAX);
blk_mq_start_stopped_hw_queues(nullb->q, true);
}
put_disk(nullb->disk);
+ null_free_zoned_dev(dev);
if (nullb->tag_set == &nullb->__tag_set)
blk_mq_free_tag_set(nullb->tag_set);
kfree(nullb->queues);
if (null_cache_active(nullb))
- null_free_device_storage(nullb->dev, true);
+ null_free_device_storage(dev, true);
kfree(nullb);
dev->nullb = NULL;
}
@@ -2081,14 +2080,13 @@ static struct nullb *null_find_dev_by_name(const char *name)
{
struct nullb *nullb = NULL, *nb;
- mutex_lock(&lock);
+ guard(mutex)(&lock);
list_for_each_entry(nb, &nullb_list, list) {
if (strcmp(nb->disk_name, name) == 0) {
nullb = nb;
break;
}
}
- mutex_unlock(&lock);
return nullb;
}
@@ -2102,9 +2100,9 @@ static int null_create_dev(void)
if (!dev)
return -ENOMEM;
- mutex_lock(&lock);
- ret = null_add_dev(dev);
- mutex_unlock(&lock);
+ scoped_guard(mutex, &lock) {
+ ret = null_add_dev(dev);
+ }
if (ret) {
null_free_dev(dev);
return ret;
@@ -2162,17 +2160,9 @@ static int __init null_init(void)
config_group_init(&nullb_subsys.su_group);
mutex_init(&nullb_subsys.su_mutex);
- ret = configfs_register_subsystem(&nullb_subsys);
- if (ret)
- return ret;
-
- mutex_init(&lock);
-
null_major = register_blkdev(0, "nullb");
- if (null_major < 0) {
- ret = null_major;
- goto err_conf;
- }
+ if (null_major < 0)
+ return null_major;
for (i = 0; i < nr_devices; i++) {
ret = null_create_dev();
@@ -2180,6 +2170,10 @@ static int __init null_init(void)
goto err_dev;
}
+ ret = configfs_register_subsystem(&nullb_subsys);
+ if (ret)
+ goto err_dev;
+
pr_info("module loaded\n");
return 0;
@@ -2189,8 +2183,8 @@ static int __init null_init(void)
null_destroy_dev(nullb);
}
unregister_blkdev(null_major, "nullb");
-err_conf:
- configfs_unregister_subsystem(&nullb_subsys);
+ if (tag_set.ops)
+ blk_mq_free_tag_set(&tag_set);
return ret;
}
@@ -2200,14 +2194,14 @@ static void __exit null_exit(void)
configfs_unregister_subsystem(&nullb_subsys);
- unregister_blkdev(null_major, "nullb");
-
- mutex_lock(&lock);
- while (!list_empty(&nullb_list)) {
- nullb = list_entry(nullb_list.next, struct nullb, list);
- null_destroy_dev(nullb);
+ scoped_guard(mutex, &lock) {
+ while (!list_empty(&nullb_list)) {
+ nullb = list_entry(nullb_list.next, struct nullb, list);
+ null_destroy_dev(nullb);
+ }
}
- mutex_unlock(&lock);
+
+ unregister_blkdev(null_major, "nullb");
if (tag_set.ops)
blk_mq_free_tag_set(&tag_set);
|
| 3/2 | 2026/07/26 12:24 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 4989 output: 33 thoughts: 273 Thoughts: **Fuzzing the Null Block Driver Patch** Okay, so this patch is touching `drivers/block/null_blk/main.c`. Immediately, I see it's replacing `mutex_lock`/`mutex_unlock` with `guard(mutex)(&lock)` and `scoped_guard(mutex, &lock)`. That's a significant shift in locking strategy, hinting at a potential change in how concurrency is handled, or an attempt to simplify lock management, which could be a good thing. The addition of that check in `nullb_update_nr_hw_queues` – `if (dev->shared_tags) return -EINVAL;` – is interesting. It's likely related to some new constraint or restriction on hardware queue configurations. And the rearrangement of `null_free_zoned_dev`, moving it from `null_free_dev` to `null_del_dev`, that's definitely a memory management tweak I need to look closer at. Now, is this patch worth fuzzing? Absolutely. It’s the null block device driver, which, as I know, is a staple in a lot of testing environments and virtualization setups. Totally reachable. Given the scope of these changes, the introduction of the new locking mechanisms, that error handling check, and the memory management alterations, there's a strong chance this could introduce concurrency bugs like use-after-free or double-free scenarios, or it might be fixing existing ones. Fuzzing this is a no-brainer; the potential for uncovering subtle issues is high. Time to grab the config options. Let's start with `drivers/block/null_blk/` and dig into Kconfig. |
| 4/2 | 2026/07/26 12:24 | tool | grepper |
0mArgs:{
"Expression": "config BLK_DEV_NULL_BLK",
"PathPrefix": "drivers/block/"
}Results: {
"Output": "drivers/block/null_blk/Kconfig-5-\ndrivers/block/null_blk/Kconfig:6:config BLK_DEV_NULL_BLK\ndrivers/block/null_blk/Kconfig-7-\ttristate \"Null test block driver\"\n--\ndrivers/block/null_blk/Kconfig-9-\ndrivers/block/null_blk/Kconfig:10:config BLK_DEV_NULL_BLK_FAULT_INJECTION\ndrivers/block/null_blk/Kconfig-11-\tbool \"Support fault injection for Null test block driver\"\n"
} |
| 5/2 | 2026/07/26 12:24 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 5795 output: 130 thoughts: 505 Thoughts: **Focusing on the Core Changes in the `BLK_DEV_NULL_BLK` Config** Okay, so we're looking at changes related to `BLK_DEV_NULL_BLK`. My first step is to zero in on the modified functions. Here's what I've got: * `nullb_device_bool_attr_store` (macro-generated, like `nullb_device_power_store`) * `nullb_device_power_show` * `nullb_device_power_store` * `nullb_device_zone_readonly_store` * `nullb_device_zone_offline_store` * `nullb_group_drop_item` * `null_free_dev` * `null_del_dev` * `null_find_dev_by_name` * `null_create_dev` * `null_init` * `null_exit` * `nullb_update_nr_hw_queues` * `nullb_apply_submit_queues` * `nullb_apply_poll_queues` Now, I'm thinking about which of these are the most interesting to analyze, especially for fuzzing. I need to figure out which are directly reachable, or potential entry points. The configfs functions come to mind. I know they're technically static, but they're registered as callbacks, and I'm pretty sure syzkaller can reach them. But, maybe, I should focus on the modified functions themselves. So, let's filter out the init/exit functions and see what we have. Also, I need to know which of these are static, and whether they're inlined. The functions left are: * `nullb_device_power_store` * `nullb_device_zone_readonly_store` * `nullb_device_zone_offline_store` * `nullb_group_drop_item` * `null_free_dev` * `null_del_dev` * `null_find_dev_by_name` * `null_create_dev` * `nullb_update_nr_hw_queues` * `nullb_apply_submit_queues` * `nullb_apply_poll_queues` Let's check if they're static and, more importantly, whether they might be inlined. I need to prioritize non-static, non-inlined API entrypoints over internal helper functions, as the instructions state. |
| 6/2 | 2026/07/26 12:24 | tool | grepper |
0mArgs:{
"Expression": "nullb_device_power_store|nullb_device_zone_readonly_store|nullb_device_zone_offline_store|nullb_group_drop_item|null_free_dev|null_del_dev|null_find_dev_by_name|null_create_dev|nullb_update_nr_hw_queues|nullb_apply_submit_queues|nullb_apply_poll_queues",
"PathPrefix": "drivers/block/null_blk/main.c"
}Results: {
"Output": "drivers/block/null_blk/main.c=273=static struct nullb_device *null_alloc_dev(void);\ndrivers/block/null_blk/main.c:274:static void null_free_dev(struct nullb_device *dev);\ndrivers/block/null_blk/main.c:275:static void null_del_dev(struct nullb *nullb);\ndrivers/block/null_blk/main.c-276-static int null_add_dev(struct nullb_device *dev);\ndrivers/block/null_blk/main.c:277:static struct nullb *null_find_dev_by_name(const char *name);\ndrivers/block/null_blk/main.c:278:static void null_free_device_storage(struct nullb_device *dev, bool is_cache);\ndrivers/block/null_blk/main.c-279-\n--\ndrivers/block/null_blk/main.c=374=CONFIGFS_ATTR(nullb_device_, NAME);\ndrivers/block/null_blk/main.c-375-\ndrivers/block/null_blk/main.c:376:static int nullb_update_nr_hw_queues(struct nullb_device *dev,\ndrivers/block/null_blk/main.c-377-\t\t\t\t unsigned int submit_queues,\n--\ndrivers/block/null_blk/main.c-431-\ndrivers/block/null_blk/main.c:432:static int nullb_apply_submit_queues(struct nullb_device *dev,\ndrivers/block/null_blk/main.c-433-\t\t\t\t unsigned int submit_queues)\ndrivers/block/null_blk/main.c-434-{\ndrivers/block/null_blk/main.c:435:\treturn nullb_update_nr_hw_queues(dev, submit_queues, dev-\u003epoll_queues);\ndrivers/block/null_blk/main.c-436-}\ndrivers/block/null_blk/main.c-437-\ndrivers/block/null_blk/main.c:438:static int nullb_apply_poll_queues(struct nullb_device *dev,\ndrivers/block/null_blk/main.c-439-\t\t\t\t unsigned int poll_queues)\ndrivers/block/null_blk/main.c-440-{\ndrivers/block/null_blk/main.c:441:\treturn nullb_update_nr_hw_queues(dev, dev-\u003esubmit_queues, poll_queues);\ndrivers/block/null_blk/main.c-442-}\n--\ndrivers/block/null_blk/main.c=445=NULLB_DEVICE_ATTR(completion_nsec, ulong, NULL);\ndrivers/block/null_blk/main.c:446:NULLB_DEVICE_ATTR(submit_queues, uint, nullb_apply_submit_queues);\ndrivers/block/null_blk/main.c:447:NULLB_DEVICE_ATTR(poll_queues, uint, nullb_apply_poll_queues);\ndrivers/block/null_blk/main.c-448-NULLB_DEVICE_ATTR(home_node, uint, NULL);\n--\ndrivers/block/null_blk/main.c=478=static ssize_t nullb_device_power_show(struct config_item *item, char *page)\n--\ndrivers/block/null_blk/main.c-483-\ndrivers/block/null_blk/main.c:484:static ssize_t nullb_device_power_store(struct config_item *item,\ndrivers/block/null_blk/main.c-485-\t\t\t\t const char *page, size_t count)\n--\ndrivers/block/null_blk/main.c-512-\t\t\tdev-\u003epower = newp;\ndrivers/block/null_blk/main.c:513:\t\t\tnull_del_dev(dev-\u003enullb);\ndrivers/block/null_blk/main.c-514-\t\t}\n--\ndrivers/block/null_blk/main.c=574=CONFIGFS_ATTR(nullb_device_, badblocks);\ndrivers/block/null_blk/main.c-575-\ndrivers/block/null_blk/main.c:576:static ssize_t nullb_device_zone_readonly_store(struct config_item *item,\ndrivers/block/null_blk/main.c-577-\t\t\t\t\t\tconst char *page, size_t count)\n--\ndrivers/block/null_blk/main.c=584=CONFIGFS_ATTR_WO(nullb_device_, zone_readonly);\ndrivers/block/null_blk/main.c-585-\ndrivers/block/null_blk/main.c:586:static ssize_t nullb_device_zone_offline_store(struct config_item *item,\ndrivers/block/null_blk/main.c-587-\t\t\t\t\t const char *page, size_t count)\n--\ndrivers/block/null_blk/main.c=637=static void nullb_device_release(struct config_item *item)\n--\ndrivers/block/null_blk/main.c-640-\ndrivers/block/null_blk/main.c:641:\tnull_free_device_storage(dev, false);\ndrivers/block/null_blk/main.c:642:\tnull_free_dev(dev);\ndrivers/block/null_blk/main.c-643-}\n--\ndrivers/block/null_blk/main.c=687=config_group *nullb_group_make_group(struct config_group *group, const char *name)\n--\ndrivers/block/null_blk/main.c-690-\ndrivers/block/null_blk/main.c:691:\tif (null_find_dev_by_name(name))\ndrivers/block/null_blk/main.c-692-\t\treturn ERR_PTR(-EEXIST);\n--\ndrivers/block/null_blk/main.c=704=static void\ndrivers/block/null_blk/main.c:705:nullb_group_drop_item(struct config_group *group, struct config_item *item)\ndrivers/block/null_blk/main.c-706-{\n--\ndrivers/block/null_blk/main.c-711-\t\tdev-\u003epower = false;\ndrivers/block/null_blk/main.c:712:\t\tnull_del_dev(dev-\u003enullb);\ndrivers/block/null_blk/main.c-713-\t}\n--\ndrivers/block/null_blk/main.c=751=static const struct configfs_group_operations nullb_group_ops = {\ndrivers/block/null_blk/main.c-752-\t.make_group\t= nullb_group_make_group,\ndrivers/block/null_blk/main.c:753:\t.drop_item\t= nullb_group_drop_item,\ndrivers/block/null_blk/main.c-754-};\n--\ndrivers/block/null_blk/main.c=776=static struct nullb_device *null_alloc_dev(void)\n--\ndrivers/block/null_blk/main.c-832-\ndrivers/block/null_blk/main.c:833:static void null_free_dev(struct nullb_device *dev)\ndrivers/block/null_blk/main.c-834-{\n--\ndrivers/block/null_blk/main.c=924=static struct nullb_page *null_radix_tree_insert(struct nullb *nullb, u64 idx,\n--\ndrivers/block/null_blk/main.c-940-\ndrivers/block/null_blk/main.c:941:static void null_free_device_storage(struct nullb_device *dev, bool is_cache)\ndrivers/block/null_blk/main.c-942-{\n--\ndrivers/block/null_blk/main.c=1746=static const struct blk_mq_ops null_mq_ops = {\n--\ndrivers/block/null_blk/main.c-1755-\ndrivers/block/null_blk/main.c:1756:static void null_del_dev(struct nullb *nullb)\ndrivers/block/null_blk/main.c-1757-{\n--\ndrivers/block/null_blk/main.c-1782-\tif (null_cache_active(nullb))\ndrivers/block/null_blk/main.c:1783:\t\tnull_free_device_storage(dev, true);\ndrivers/block/null_blk/main.c-1784-\tkfree(nullb);\n--\ndrivers/block/null_blk/main.c=1954=static int null_add_dev(struct nullb_device *dev)\n--\ndrivers/block/null_blk/main.c-2078-\ndrivers/block/null_blk/main.c:2079:static struct nullb *null_find_dev_by_name(const char *name)\ndrivers/block/null_blk/main.c-2080-{\n--\ndrivers/block/null_blk/main.c-2093-\ndrivers/block/null_blk/main.c:2094:static int null_create_dev(void)\ndrivers/block/null_blk/main.c-2095-{\n--\ndrivers/block/null_blk/main.c-2106-\tif (ret) {\ndrivers/block/null_blk/main.c:2107:\t\tnull_free_dev(dev);\ndrivers/block/null_blk/main.c-2108-\t\treturn ret;\n--\ndrivers/block/null_blk/main.c=2114=static void null_destroy_dev(struct nullb *nullb)\n--\ndrivers/block/null_blk/main.c-2117-\ndrivers/block/null_blk/main.c:2118:\tnull_del_dev(nullb);\ndrivers/block/null_blk/main.c:2119:\tnull_free_device_storage(dev, false);\ndrivers/block/null_blk/main.c:2120:\tnull_free_dev(dev);\ndrivers/block/null_blk/main.c-2121-}\n--\ndrivers/block/null_blk/main.c=2123=static int __init null_init(void)\n--\ndrivers/block/null_blk/main.c-2167-\tfor (i = 0; i \u003c nr_devices; i++) {\ndrivers/block/null_blk/main.c:2168:\t\tret = null_create_dev();\ndrivers/block/null_blk/main.c-2169-\t\tif (ret)\n"
} |
| 7/2 | 2026/07/26 12:24 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 8970 output: 221 thoughts: 1399 Thoughts: **Analysis of the null_blk Driver Patch** Alright, let's break this down. This patch is targeted at `drivers/block/null_blk/main.c`, which is interesting because it's a software block device. That makes it readily accessible in a QEMU environment, which is good from a fuzzing perspective. First things first, it looks like they're beefing up the locking mechanism. The change from `static struct mutex lock;` to `static DEFINE_MUTEX(lock);` is straightforward. The use of `guard(mutex)(&lock);` and `scoped_guard(mutex, &lock)` throughout the code base in functions like `nullb_device_##NAME##_show`, `nullb_device_##NAME##_store`, `nullb_device_power_show`, `nullb_device_power_store`, `nullb_device_zone_readonly_store`, `nullb_device_zone_offline_store`, `nullb_group_drop_item`, `null_find_dev_by_name`, `null_create_dev`, and `null_exit` suggests they're aiming for more robust protection around critical sections. This could be due to race conditions found in previous development efforts, or simply as an effort to ensure this device is safe for high-concurrency usages. The addition of the check in `nullb_update_nr_hw_queues`: ```c if (dev->shared_tags) return -EINVAL; ``` immediately catches my eye. It looks like they're trying to prevent some kind of invalid state related to shared tags which could be problematic. Could be a potential NULL dereference, or possibly a resource management issue. The removal of `mutex_lock(&lock)` and `mutex_unlock(&lock)` from `nullb_apply_submit_queues` and `nullb_apply_poll_queues` is curious. Where has that logic migrated to? Perhaps the `guard` and `scoped_guard` macros are now handling the locking at a higher level, which could simplify the code and reduce the risk of missed unlocks. Then there's the move of `null_free_zoned_dev(dev);` from `null_free_dev` to `null_del_dev`. That's a definite structural change. The subsequent fix in `null_del_dev` where they correct a potential use-after-free by changing `nullb->dev` to `dev->flags` and `dev` confirms there was a real issue here, using the device after it was potentially freed. This is significant and something that demands closer inspection. Finally, the initialization order changes in `null_init`, with `register_blkdev` now before `null_create_dev` and `configfs_register_subsystem` after `null_create_dev`, probably has to do with dependencies and device registration. This could be to do with resolving some dependencies in the order of initialization. Okay, is this fuzzable? Absolutely. This driver is reachable, the changes include potential NULL pointer dereferences, use-after-free scenarios, and locking modifications – all of which are fertile ground for fuzzing. I can imagine creating devices and writing to sysfs attributes to try to trigger these changes in the locking semantics. So, let's identify relevant symbols: * `nullb_update_nr_hw_queues`: This is an interesting one because it is static, but is used by the submit/poll functions. * `nullb_apply_submit_queues`: Static, but used as a callback, which might make it accessible. * `nullb_apply_poll_queues`: Static, similar to the above. * `nullb_device_power_store` * `nullb_device_zone_readonly_store` * `nullb_device_zone_offline_store` * `nullb_group_drop_item` * `null_del_dev`: The use-after-free fix makes this critical. * `null_find_dev_by_name` * `null_create_dev` The config is `BLK_DEV_NULL_BLK`. The configfs store functions look promising – they're accessed through sysfs, which syzkaller can definitely target. Although static, they are entry points that can be triggered through the filesystem interface. So, I will focus on the following functions to provide the set-results: * `nullb_update_nr_hw_queues` * `nullb_device_power_store` * `nullb_device_zone_readonly_store` * |
| 8/2 | 2026/07/26 12:25 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"BLK_DEV_NULL_BLK"
],
"FocusSymbols": [
"nullb_update_nr_hw_queues",
"nullb_apply_submit_queues",
"nullb_apply_poll_queues",
"nullb_device_power_store",
"nullb_device_zone_readonly_store",
"nullb_device_zone_offline_store",
"nullb_group_drop_item",
"null_del_dev",
"null_find_dev_by_name",
"null_create_dev"
],
"Reasoning": "The patch modifies the null_blk driver, fixing a potential NULL pointer dereference in `nullb_update_nr_hw_queues`, adjusting locking with `guard(mutex)`, and changing the initialization order and device deletion logic. These are functional changes to a software block device that is reachable and testable in virtualized environments.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"BLK_DEV_NULL_BLK"
],
"FocusSymbols": [
"nullb_update_nr_hw_queues",
"nullb_apply_submit_queues",
"nullb_apply_poll_queues",
"nullb_device_power_store",
"nullb_device_zone_readonly_store",
"nullb_device_zone_offline_store",
"nullb_group_drop_item",
"null_del_dev",
"null_find_dev_by_name",
"null_create_dev"
],
"Reasoning": "The patch modifies the null_blk driver, fixing a potential NULL pointer dereference in `nullb_update_nr_hw_queues`, adjusting locking with `guard(mutex)`, and changing the initialization order and device deletion logic. These are functional changes to a software block device that is reachable and testable in virtualized environments.",
"WorthFuzzing": true
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|