AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/11/02 23:48 flow patch-triage
4m Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "KMSANReasoning": "",
  "NeedsKMSAN": false,
  "Reasoning": "The patch introduces KUnit regression tests for ath11k and updates error handling and allocation logic within the ath11k driver (drivers/net/wireless/ath/ath11k/). The ath11k driver is a vendor-specific wireless driver for Qualcomm IEEE 802.11ax PCIe/AHB chipsets. It requires physical ASIC hardware not emulated in standard virtualized fuzzing environments (QEMU/GCE), making the modified code structurally unreachable for syzkaller fuzzing.",
  "WorthFuzzing": false
}

1/1 2026/11/02 23:48 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit d7ac0d080052867380d9d2a1ce096e658c77fd99\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Mon Nov 2 23:48:02 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/drivers/net/wireless/ath/ath11k/.kunitconfig b/drivers/net/wireless/ath/ath11k/.kunitconfig\nnew file mode 100644\nindex 00000000000000..b13aaaecf04a44\n--- /dev/null\n+++ b/drivers/net/wireless/ath/ath11k/.kunitconfig\n@@ -0,0 +1,14 @@\n+CONFIG_KUNIT=y\n+CONFIG_VIRTIO_UML=y\n+CONFIG_UML_PCI_OVER_VIRTIO=y\n+CONFIG_NET=y\n+CONFIG_INET=y\n+CONFIG_WIRELESS=y\n+CONFIG_CFG80211=y\n+CONFIG_MAC80211=y\n+CONFIG_CRYPTO=y\n+CONFIG_ATH_COMMON=y\n+CONFIG_QCOM_QMI_HELPERS=y\n+CONFIG_QRTR=y\n+CONFIG_ATH11K=y\n+CONFIG_ATH11K_KUNIT_TEST=y\ndiff --git a/drivers/net/wireless/ath/ath11k/Kconfig b/drivers/net/wireless/ath/ath11k/Kconfig\nindex 44b520d2e66ee8..2b688f10934572 100644\n--- a/drivers/net/wireless/ath/ath11k/Kconfig\n+++ b/drivers/net/wireless/ath/ath11k/Kconfig\n@@ -71,3 +71,14 @@ config ATH11K_CFR\n \t  to enable, disable, and dump data.\n \n \t  Say Y to enable CFR data dump collection via debugfs.\n+\n+config ATH11K_KUNIT_TEST\n+\tbool \"KUnit tests for ath11k\" if !KUNIT_ALL_TESTS\n+\tdepends on KUNIT=y \u0026\u0026 ATH11K=y\n+\tdefault KUNIT_ALL_TESTS\n+\thelp\n+\t  This builds KUnit tests for ath11k recovery and resource management.\n+\t  It tests crash recovery flow, dynamic allocation failure handling,\n+\t  resource cleanup ordering, and subsequent send protection.\n+\n+\t  If unsure, say N.\ndiff --git a/drivers/net/wireless/ath/ath11k/Makefile b/drivers/net/wireless/ath/ath11k/Makefile\nindex b1435fcf3e1bfe..e42a38a2d0269c 100644\n--- a/drivers/net/wireless/ath/ath11k/Makefile\n+++ b/drivers/net/wireless/ath/ath11k/Makefile\n@@ -29,6 +29,7 @@ ath11k-$(CONFIG_ATH11K_SPECTRAL) += spectral.o\n ath11k-$(CONFIG_PM) += wow.o\n ath11k-$(CONFIG_DEV_COREDUMP) += coredump.o\n ath11k-$(CONFIG_ATH11K_CFR) += cfr.o\n+ath11k-$(CONFIG_ATH11K_KUNIT_TEST) += test.o\n \n obj-$(CONFIG_ATH11K_AHB) += ath11k_ahb.o\n ath11k_ahb-y += ahb.o\ndiff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c\nindex 766ae27306f43d..27c08721c6a722 100644\n--- a/drivers/net/wireless/ath/ath11k/core.c\n+++ b/drivers/net/wireless/ath/ath11k/core.c\n@@ -2245,6 +2245,11 @@ static int ath11k_core_start_firmware(struct ath11k_base *ab,\n {\n \tint ret;\n \n+#if IS_ENABLED(CONFIG_ATH11K_KUNIT_TEST)\n+\tif (ab-\u003etest_ops.start_firmware)\n+\t\treturn ab-\u003etest_ops.start_firmware(ab, mode);\n+#endif\n+\n \tath11k_ce_get_shadow_config(ab, \u0026ab-\u003eqmi.ce_cfg.shadow_reg_v2,\n \t\t\t\t    \u0026ab-\u003eqmi.ce_cfg.shadow_reg_v2_len);\n \n@@ -2297,13 +2302,27 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)\n \t\tset_bit(ATH11K_FLAG_RAW_MODE, \u0026ab-\u003edev_flags);\n \n \tmutex_lock(\u0026ab-\u003ecore_lock);\n+#if IS_ENABLED(CONFIG_ATH11K_KUNIT_TEST)\n+\tif (ab-\u003etest_ops.core_start)\n+\t\tret = ab-\u003etest_ops.core_start(ab);\n+\telse\n+\t\tret = ath11k_core_start(ab);\n+#else\n \tret = ath11k_core_start(ab);\n+#endif\n \tif (ret) {\n \t\tath11k_err(ab, \"failed to start core: %d\\n\", ret);\n \t\tgoto err_dp_free;\n \t}\n \n+#if IS_ENABLED(CONFIG_ATH11K_KUNIT_TEST)\n+\tif (ab-\u003etest_ops.pdev_create)\n+\t\tret = ab-\u003etest_ops.pdev_create(ab);\n+\telse\n+\t\tret = ath11k_core_pdev_create(ab);\n+#else\n \tret = ath11k_core_pdev_create(ab);\n+#endif\n \tif (ret) {\n \t\tath11k_err(ab, \"failed to create pdev core: %d\\n\", ret);\n \t\tgoto err_core_stop;\n@@ -2320,12 +2339,21 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)\n \tath11k_dp_free(ab);\n \tmutex_unlock(\u0026ab-\u003ecore_lock);\n err_firmware_stop:\n+#if IS_ENABLED(CONFIG_ATH11K_KUNIT_TEST)\n+\tif (ab-\u003etest_ops.stop_firmware) {\n+\t\tab-\u003etest_ops.stop_firmware_called++;\n+\t\tab-\u003etest_ops.stop_firmware(ab);\n+\t} else {\n+\t\tath11k_qmi_firmware_stop(ab);\n+\t}\n+#else\n \tath11k_qmi_firmware_stop(ab);\n+#endif\n \n \treturn ret;\n }\n \n-static int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)\n+VISIBLE_IF_KUNIT int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)\n {\n \tint ret;\n \n@@ -2349,16 +2377,24 @@ static int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)\n \tclear_bit(ATH11K_FLAG_CRASH_FLUSH, \u0026ab-\u003edev_flags);\n \n \tret = ath11k_core_qmi_firmware_ready(ab);\n-\tif (ret)\n-\t\tgoto err_hal_srng_deinit;\n+\tif (ret) {\n+\t\t/* The firmware has been stopped and the data path is gone,\n+\t\t * but mac80211 may still call into the driver (e.g. drv_start\n+\t\t * from the wiphy resume). Treat the device as crashed so that\n+\t\t * WMI, CE and DP TX bail out until a later recovery succeeds.\n+\t\t *\n+\t\t * Do not free the HAL SRNG memory here: it is allocated at\n+\t\t * probe and freed at remove, and rings that were already set\n+\t\t * up again (e.g. by ath11k_ce_init_pipes()) still point into\n+\t\t * it.\n+\t\t */\n+\t\tset_bit(ATH11K_FLAG_CRASH_FLUSH, \u0026ab-\u003edev_flags);\n+\t\treturn ret;\n+\t}\n \n \tclear_bit(ATH11K_FLAG_RECOVERY, \u0026ab-\u003edev_flags);\n \n \treturn 0;\n-\n-err_hal_srng_deinit:\n-\tath11k_hal_srng_deinit(ab);\n-\treturn ret;\n }\n \n void ath11k_core_halt(struct ath11k *ar)\ndiff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h\nindex a0d725923ef24d..57895e4bafffec 100644\n--- a/drivers/net/wireless/ath/ath11k/core.h\n+++ b/drivers/net/wireless/ath/ath11k/core.h\n@@ -18,6 +18,7 @@\n #include \u003clinux/firmware.h\u003e\n #include \u003clinux/suspend.h\u003e\n #include \u003clinux/of.h\u003e\n+#include \u003ckunit/visibility.h\u003e\n \n #include \"qmi.h\"\n #include \"htc.h\"\n@@ -1092,6 +1093,18 @@ struct ath11k_base {\n \tenum ath11k_pm_policy actual_pm_policy;\n \tstruct notifier_block pm_nb;\n \n+#if IS_ENABLED(CONFIG_ATH11K_KUNIT_TEST)\n+\tstruct {\n+\t\tint (*start_firmware)(struct ath11k_base *ab,\n+\t\t\t\t      enum ath11k_firmware_mode mode);\n+\t\tvoid (*stop_firmware)(struct ath11k_base *ab);\n+\t\tint (*core_start)(struct ath11k_base *ab);\n+\t\tint (*pdev_create)(struct ath11k_base *ab);\n+\t\tbool fail_tx_status_alloc;\n+\t\tint stop_firmware_called;\n+\t} test_ops;\n+#endif\n+\n \t/* must be last */\n \tu8 drv_priv[] __aligned(sizeof(void *));\n };\n@@ -1372,4 +1385,8 @@ static inline const char *ath11k_bus_str(enum ath11k_bus bus)\n \n void ath11k_core_pm_notifier_unregister(struct ath11k_base *ab);\n \n+#if IS_ENABLED(CONFIG_KUNIT)\n+int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab);\n+#endif\n+\n #endif /* _CORE_H_ */\ndiff --git a/drivers/net/wireless/ath/ath11k/dp.c b/drivers/net/wireless/ath/ath11k/dp.c\nindex be65d73b904b61..d1918f5d5e1a6d 100644\n--- a/drivers/net/wireless/ath/ath11k/dp.c\n+++ b/drivers/net/wireless/ath/ath11k/dp.c\n@@ -1040,7 +1040,7 @@ void ath11k_dp_free(struct ath11k_base *ab)\n \t\t\t     ath11k_dp_tx_pending_cleanup, ab);\n \t\tidr_destroy(\u0026dp-\u003etx_ring[i].txbuf_idr);\n \t\tspin_unlock_bh(\u0026dp-\u003etx_ring[i].tx_idr_lock);\n-\t\tkfree(dp-\u003etx_ring[i].tx_status);\n+\t\tkvfree(dp-\u003etx_ring[i].tx_status);\n \t\tdp-\u003etx_ring[i].tx_status = NULL;\n \t}\n \n@@ -1093,10 +1093,17 @@ int ath11k_dp_alloc(struct ath11k_base *ab)\n \n \t\tdp-\u003etx_ring[i].tx_status_head = 0;\n \t\tdp-\u003etx_ring[i].tx_status_tail = DP_TX_COMP_RING_SIZE - 1;\n-\t\tdp-\u003etx_ring[i].tx_status = kmalloc(size, GFP_KERNEL);\n+#if IS_ENABLED(CONFIG_ATH11K_KUNIT_TEST)\n+\t\tif (ab-\u003etest_ops.fail_tx_status_alloc)\n+\t\t\tdp-\u003etx_ring[i].tx_status = NULL;\n+\t\telse\n+\t\t\tdp-\u003etx_ring[i].tx_status = kvmalloc(size, GFP_KERNEL);\n+#else\n+\t\tdp-\u003etx_ring[i].tx_status = kvmalloc(size, GFP_KERNEL);\n+#endif\n \t\tif (!dp-\u003etx_ring[i].tx_status) {\n \t\t\tret = -ENOMEM;\n-\t\t\tgoto fail_cmn_srng_cleanup;\n+\t\t\tgoto fail_tx_status;\n \t\t}\n \t}\n \n@@ -1107,7 +1114,14 @@ int ath11k_dp_alloc(struct ath11k_base *ab)\n \n \treturn 0;\n \n-fail_cmn_srng_cleanup:\n+fail_tx_status:\n+\twhile (i \u003e= 0) {\n+\t\tidr_destroy(\u0026dp-\u003etx_ring[i].txbuf_idr);\n+\t\tkvfree(dp-\u003etx_ring[i].tx_status);\n+\t\tdp-\u003etx_ring[i].tx_status = NULL;\n+\t\ti--;\n+\t}\n+\n \tath11k_dp_srng_common_cleanup(ab);\n \n fail_link_desc_cleanup:\ndiff --git a/drivers/net/wireless/ath/ath11k/test.c b/drivers/net/wireless/ath/ath11k/test.c\nnew file mode 100644\nindex 00000000000000..cdf7bd4289946a\n--- /dev/null\n+++ b/drivers/net/wireless/ath/ath11k/test.c\n@@ -0,0 +1,330 @@\n+// SPDX-License-Identifier: BSD-3-Clause-Clear\n+/*\n+ * KUnit regression tests for ath11k crash recovery and resource ownership\n+ *\n+ * Exercises ath11k production crash recovery flow (ath11k_core_reconfigure_on_crash),\n+ * verifying error recovery paths, deterministic TX status allocation failure,\n+ * preservation of HAL SRNG lifecycle, and enforcement of -ESHUTDOWN on subsequent sends.\n+ */\n+\n+#include \u003ckunit/test.h\u003e\n+#include \u003ckunit/device.h\u003e\n+#include \u003clinux/dma-mapping.h\u003e\n+#include \u003clinux/skbuff.h\u003e\n+#include \u003clinux/vmalloc.h\u003e\n+\n+#include \"core.h\"\n+#include \"hal.h\"\n+#include \"hal_desc.h\"\n+#include \"ce.h\"\n+#include \"dp.h\"\n+#include \"dp_tx.h\"\n+#include \"hif.h\"\n+\n+struct ath11k_test_fixture {\n+\tstruct device *dev;\n+\tstruct ath11k_base *ab;\n+};\n+\n+static void ath11k_test_dummy_timer(struct timer_list *t)\n+{\n+}\n+\n+static u32 ath11k_test_read32(struct ath11k_base *ab, u32 address)\n+{\n+\treturn 0;\n+}\n+\n+static void ath11k_test_write32(struct ath11k_base *ab, u32 address, u32 data)\n+{\n+}\n+\n+static void ath11k_test_irq_enable(struct ath11k_base *ab)\n+{\n+}\n+\n+static void ath11k_test_irq_disable(struct ath11k_base *ab)\n+{\n+}\n+\n+static int ath11k_test_hif_start(struct ath11k_base *ab)\n+{\n+\treturn 0;\n+}\n+\n+static void ath11k_test_hif_stop(struct ath11k_base *ab)\n+{\n+}\n+\n+static int ath11k_test_map_service_to_pipe(struct ath11k_base *ab, u16 service_id,\n+\t\t\t\t\t   u8 *ul_pipe, u8 *dl_pipe)\n+{\n+\treturn 0;\n+}\n+\n+static const struct ath11k_hif_ops ath11k_test_hif_ops = {\n+\t.read32 = ath11k_test_read32,\n+\t.write32 = ath11k_test_write32,\n+\t.irq_enable = ath11k_test_irq_enable,\n+\t.irq_disable = ath11k_test_irq_disable,\n+\t.start = ath11k_test_hif_start,\n+\t.stop = ath11k_test_hif_stop,\n+\t.map_service_to_pipe = ath11k_test_map_service_to_pipe,\n+};\n+\n+static int ath11k_test_start_firmware(struct ath11k_base *ab,\n+\t\t\t\t      enum ath11k_firmware_mode mode)\n+{\n+\treturn 0;\n+}\n+\n+static void ath11k_test_stop_firmware(struct ath11k_base *ab)\n+{\n+}\n+\n+static int ath11k_test_core_start(struct ath11k_base *ab)\n+{\n+\treturn 0;\n+}\n+\n+static int ath11k_test_pdev_create(struct ath11k_base *ab)\n+{\n+\treturn 0;\n+}\n+\n+static int ath11k_test_init(struct kunit *test)\n+{\n+\tstruct ath11k_test_fixture *fx;\n+\tstruct ath11k_base *ab;\n+\tstruct device *dev;\n+\tint ret;\n+\n+\tfx = kunit_kzalloc(test, sizeof(*fx), GFP_KERNEL);\n+\tKUNIT_ASSERT_NOT_NULL(test, fx);\n+\n+\tdev = kunit_device_register(test, \"ath11k_kunit_dev\");\n+\tKUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);\n+\tdma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));\n+\tfx-\u003edev = dev;\n+\n+\tab = ath11k_core_alloc(dev, 0, ATH11K_BUS_PCI);\n+\tKUNIT_ASSERT_NOT_NULL(test, ab);\n+\tfx-\u003eab = ab;\n+\ttest-\u003epriv = fx;\n+\n+\tab-\u003ehif.ops = \u0026ath11k_test_hif_ops;\n+\n+\ttimer_setup(\u0026ab-\u003emon_reap_timer, ath11k_test_dummy_timer, 0);\n+\n+\tab-\u003ehw_rev = ATH11K_HW_WCN6855_HW21;\n+\tret = ath11k_core_pre_init(ab);\n+\tKUNIT_ASSERT_EQ(test, ret, 0);\n+\n+\tret = ath11k_hal_srng_init(ab);\n+\tKUNIT_ASSERT_EQ(test, ret, 0);\n+\n+\tret = ath11k_ce_alloc_pipes(ab);\n+\tKUNIT_ASSERT_EQ(test, ret, 0);\n+\n+\tret = ath11k_ce_init_pipes(ab);\n+\tKUNIT_ASSERT_EQ(test, ret, 0);\n+\n+\tret = ath11k_dp_alloc(ab);\n+\tKUNIT_ASSERT_EQ(test, ret, 0);\n+\n+\tab-\u003etest_ops.start_firmware = ath11k_test_start_firmware;\n+\tab-\u003etest_ops.stop_firmware = ath11k_test_stop_firmware;\n+\tab-\u003etest_ops.core_start = ath11k_test_core_start;\n+\tab-\u003etest_ops.pdev_create = ath11k_test_pdev_create;\n+\tab-\u003etest_ops.fail_tx_status_alloc = false;\n+\tab-\u003etest_ops.stop_firmware_called = 0;\n+\n+\treturn 0;\n+}\n+\n+static void ath11k_test_exit(struct kunit *test)\n+{\n+\tstruct ath11k_test_fixture *fx = test-\u003epriv;\n+\tstruct ath11k_base *ab;\n+\n+\tif (!fx || !fx-\u003eab)\n+\t\treturn;\n+\n+\tab = fx-\u003eab;\n+\tath11k_dp_free(ab);\n+\tath11k_ce_free_pipes(ab);\n+\tath11k_hal_srng_deinit(ab);\n+\tath11k_fw_destroy(ab);\n+\tath11k_core_free(ab);\n+}\n+\n+/*\n+ * Test 1: Successful recovery.\n+ * Verifies that standard crash reconfiguration succeeds, clears recovery and\n+ * crash-flush flags, allocates DP resources, and keeps HAL SRNG intact.\n+ */\n+static void ath11k_test_recovery_success(struct kunit *test)\n+{\n+\tstruct ath11k_test_fixture *fx = test-\u003epriv;\n+\tstruct ath11k_base *ab = fx-\u003eab;\n+\tint ret;\n+\n+\tset_bit(ATH11K_FLAG_RECOVERY, \u0026ab-\u003edev_flags);\n+\n+\tret = ath11k_core_reconfigure_on_crash(ab);\n+\tKUNIT_EXPECT_EQ(test, ret, 0);\n+\n+\tKUNIT_EXPECT_FALSE(test, test_bit(ATH11K_FLAG_CRASH_FLUSH, \u0026ab-\u003edev_flags));\n+\tKUNIT_EXPECT_FALSE(test, test_bit(ATH11K_FLAG_RECOVERY, \u0026ab-\u003edev_flags));\n+\tKUNIT_EXPECT_NOT_NULL(test, ab-\u003edp.tx_ring[0].tx_status);\n+\tKUNIT_EXPECT_NOT_NULL(test, ab-\u003ehal.rdp.vaddr);\n+\tKUNIT_EXPECT_NOT_NULL(test, ab-\u003ehal.srng_config);\n+}\n+\n+/*\n+ * Test 2: Failure at TX status allocation during recovery.\n+ * Verifies that when TX status allocation fails during crash recovery:\n+ * 1. Recovery returns -ENOMEM.\n+ * 2. ATH11K_FLAG_CRASH_FLUSH is set to protect against subsequent traffic.\n+ * 3. Firmware stop is invoked.\n+ * 4. DP tx_status is NULL.\n+ * 5. HAL SRNG memory and config are preserved (not freed prematurely).\n+ */\n+static void ath11k_test_recovery_tx_status_alloc_fail(struct kunit *test)\n+{\n+\tstruct ath11k_test_fixture *fx = test-\u003epriv;\n+\tstruct ath11k_base *ab = fx-\u003eab;\n+\tint ret;\n+\n+\t/* Run initial successful recovery to establish initialized state */\n+\tset_bit(ATH11K_FLAG_RECOVERY, \u0026ab-\u003edev_flags);\n+\tret = ath11k_core_reconfigure_on_crash(ab);\n+\tKUNIT_ASSERT_EQ(test, ret, 0);\n+\tKUNIT_ASSERT_NOT_NULL(test, ab-\u003edp.tx_ring[0].tx_status);\n+\n+\t/* Trigger recovery with injected TX status allocation failure */\n+\tset_bit(ATH11K_FLAG_RECOVERY, \u0026ab-\u003edev_flags);\n+\tab-\u003etest_ops.fail_tx_status_alloc = true;\n+\tab-\u003etest_ops.stop_firmware_called = 0;\n+\n+\tret = ath11k_core_reconfigure_on_crash(ab);\n+\tKUNIT_EXPECT_EQ(test, ret, -ENOMEM);\n+\n+\t/* CRASH_FLUSH must be set to protect the driver against entry calls */\n+\tKUNIT_EXPECT_TRUE(test, test_bit(ATH11K_FLAG_CRASH_FLUSH, \u0026ab-\u003edev_flags));\n+\tKUNIT_EXPECT_GT(test, ab-\u003etest_ops.stop_firmware_called, 0);\n+\tKUNIT_EXPECT_NULL(test, ab-\u003edp.tx_ring[0].tx_status);\n+\n+\t/* HAL SRNG memory must NOT be deinited on recovery failure */\n+\tKUNIT_EXPECT_NOT_NULL(test, ab-\u003ehal.rdp.vaddr);\n+\tKUNIT_EXPECT_NOT_NULL(test, ab-\u003ehal.srng_config);\n+}\n+\n+/*\n+ * Test 3: Prevention of subsequent unsafe operations after recovery failure.\n+ * Verifies that after TX status allocation fails during recovery, subsequent\n+ * CE and DP send operations return -ESHUTDOWN rather than touching hardware\n+ * or dereferencing freed/uninitialized memory.\n+ */\n+static void ath11k_test_recovery_subsequent_send_prevented(struct kunit *test)\n+{\n+\tstruct ath11k_test_fixture *fx = test-\u003epriv;\n+\tstruct ath11k_base *ab = fx-\u003eab;\n+\tstruct sk_buff *skb;\n+\tint ret;\n+\n+\t/* Run recovery with allocation failure */\n+\tset_bit(ATH11K_FLAG_RECOVERY, \u0026ab-\u003edev_flags);\n+\tab-\u003etest_ops.fail_tx_status_alloc = true;\n+\tret = ath11k_core_reconfigure_on_crash(ab);\n+\tKUNIT_ASSERT_EQ(test, ret, -ENOMEM);\n+\tKUNIT_ASSERT_TRUE(test, test_bit(ATH11K_FLAG_CRASH_FLUSH, \u0026ab-\u003edev_flags));\n+\n+\t/* CE send on CE 3 (WMI control pipe) must be blocked with -ESHUTDOWN */\n+\tskb = dev_alloc_skb(64);\n+\tKUNIT_ASSERT_NOT_NULL(test, skb);\n+\tret = ath11k_ce_send(ab, skb, 3, 0);\n+\tKUNIT_EXPECT_EQ(test, ret, -ESHUTDOWN);\n+\tdev_kfree_skb(skb);\n+\n+\t/* DP TX REO command must also be blocked with -ESHUTDOWN */\n+\tret = ath11k_dp_tx_send_reo_cmd(ab, NULL, 0, NULL, NULL);\n+\tKUNIT_EXPECT_EQ(test, ret, -ESHUTDOWN);\n+}\n+\n+/*\n+ * Test 4: Resource ownership and cleanup after recovery failure.\n+ * Verifies that after recovery failure, a subsequent recovery attempt\n+ * when memory is available succeeds, clears CRASH_FLUSH, and tears down\n+ * cleanly without double-free or corruption.\n+ */\n+static void ath11k_test_recovery_resource_cleanup_and_teardown(struct kunit *test)\n+{\n+\tstruct ath11k_test_fixture *fx = test-\u003epriv;\n+\tstruct ath11k_base *ab = fx-\u003eab;\n+\tint ret;\n+\n+\t/* Step 1: Initial failure */\n+\tset_bit(ATH11K_FLAG_RECOVERY, \u0026ab-\u003edev_flags);\n+\tab-\u003etest_ops.fail_tx_status_alloc = true;\n+\tret = ath11k_core_reconfigure_on_crash(ab);\n+\tKUNIT_ASSERT_EQ(test, ret, -ENOMEM);\n+\tKUNIT_ASSERT_TRUE(test, test_bit(ATH11K_FLAG_CRASH_FLUSH, \u0026ab-\u003edev_flags));\n+\n+\t/* Step 2: Memory becomes available, retry recovery */\n+\tab-\u003etest_ops.fail_tx_status_alloc = false;\n+\tset_bit(ATH11K_FLAG_RECOVERY, \u0026ab-\u003edev_flags);\n+\tret = ath11k_core_reconfigure_on_crash(ab);\n+\tKUNIT_EXPECT_EQ(test, ret, 0);\n+\tKUNIT_EXPECT_FALSE(test, test_bit(ATH11K_FLAG_CRASH_FLUSH, \u0026ab-\u003edev_flags));\n+\tKUNIT_EXPECT_FALSE(test, test_bit(ATH11K_FLAG_RECOVERY, \u0026ab-\u003edev_flags));\n+\tKUNIT_EXPECT_NOT_NULL(test, ab-\u003edp.tx_ring[0].tx_status);\n+\tKUNIT_EXPECT_NOT_NULL(test, ab-\u003ehal.rdp.vaddr);\n+\tKUNIT_EXPECT_NOT_NULL(test, ab-\u003ehal.srng_config);\n+}\n+\n+/*\n+ * Test 5: DP TX status allocation sizing and kvmalloc lifecycle.\n+ * Verifies that TX status ring size is 1 MiB (order-8 contiguous allocation),\n+ * that ath11k_dp_alloc allocates it, and ath11k_dp_free frees and NULLs it.\n+ */\n+static void ath11k_test_dp_tx_status_kvmalloc(struct kunit *test)\n+{\n+\tstruct ath11k_test_fixture *fx = test-\u003epriv;\n+\tstruct ath11k_base *ab = fx-\u003eab;\n+\tsize_t size;\n+\tint ret;\n+\n+\tsize = DP_TX_COMP_RING_SIZE * sizeof(struct hal_wbm_release_ring);\n+\tKUNIT_EXPECT_EQ(test, size, (size_t)1048576);\n+\n+\t/* DP was allocated in fixture init, verify tx_status is present */\n+\tKUNIT_EXPECT_NOT_NULL(test, ab-\u003edp.tx_ring[0].tx_status);\n+\n+\t/* Free and verify tx_status is NULLed */\n+\tath11k_dp_free(ab);\n+\tKUNIT_EXPECT_NULL(test, ab-\u003edp.tx_ring[0].tx_status);\n+\n+\t/* Reallocate and verify kvmalloc successfully allocates it again */\n+\tret = ath11k_dp_alloc(ab);\n+\tKUNIT_ASSERT_EQ(test, ret, 0);\n+\tKUNIT_EXPECT_NOT_NULL(test, ab-\u003edp.tx_ring[0].tx_status);\n+}\n+\n+static struct kunit_case ath11k_recovery_test_cases[] = {\n+\tKUNIT_CASE(ath11k_test_recovery_success),\n+\tKUNIT_CASE(ath11k_test_recovery_tx_status_alloc_fail),\n+\tKUNIT_CASE(ath11k_test_recovery_subsequent_send_prevented),\n+\tKUNIT_CASE(ath11k_test_recovery_resource_cleanup_and_teardown),\n+\tKUNIT_CASE(ath11k_test_dp_tx_status_kvmalloc),\n+\t{}\n+};\n+\n+static struct kunit_suite ath11k_recovery_test_suite = {\n+\t.name = \"ath11k-recovery\",\n+\t.init = ath11k_test_init,\n+\t.exit = ath11k_test_exit,\n+\t.test_cases = ath11k_recovery_test_cases,\n+};\n+\n+kunit_test_suite(ath11k_recovery_test_suite);\n"
}

2/1 2026/11/02 23:48 agent patch-evaluator
4m Model:
core

Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch introduces KUnit regression tests for ath11k and updates error handling and allocation logic within the ath11k driver (drivers/net/wireless/ath/ath11k/). The ath11k driver is a vendor-specific wireless driver for Qualcomm IEEE 802.11ax PCIe/AHB chipsets. It requires physical ASIC hardware not emulated in standard virtualized fuzzing environments (QEMU/GCE), making the modified code structurally unreachable for syzkaller fuzzing.",
  "WorthFuzzing": false
}

Instruction:
You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.

IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.

================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.

- REACHABILITY IS THE PRIMARY GATE:
  Fuzzing can only discover bugs in code that can actually execute in standard virtualized
  environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
  If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
  regardless of whether it adds assertions or complex logic.

- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
  Patch authors routinely label changes as "cleanups", "refactorings", or state
  "No functional change intended". Do NOT take these claims at face value.
  Code refactorings that rearrange logic, introduce helper functions, or alter state management
  in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
  If reachable executable code is modified or refactored, it MUST be fuzzed.

- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
  When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
  BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
  Even if the author believes the invariant always holds, fuzzing is essential to verify whether
  an unusual sequence of operations can violate it.

================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:

- Non-kernel and non-executable changes:
  * Modifications to Documentation/, comments, or spelling fixes.
  * User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
    that do not affect the compiled kernel image (vmlinux) or kernel modules.
  * Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
    that do not alter control flow or data structures.
  * Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
  * Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
    ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
  * Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
    physical PCI hot-unplug or manual sysfs driver unbinding.
  * Code paths exclusive to architectures other than the target architecture.

================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
  * Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
    BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
  * Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
  * Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
  * Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).

================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:

- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
  Do NOT list generic, ubiquitous functions called by almost every program in the corpus
  (including, but not limited to: general memory allocators and deallocators, page fault
  and trap handlers, or core synchronization primitives; this is not an exhaustive list).
  Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
  which severely dilutes fuzzing effort away from the actual changes.

- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
  List functions that specifically implement the logic being added or altered, or direct API entrypoints
  for the subsystem feature under review.

- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
  Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
  distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
  If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
  functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).

================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any '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:
Target architecture: amd64

For your convenience, here is the diff of the changes:
commit d7ac0d080052867380d9d2a1ce096e658c77fd99
Author: syz-cluster <triage@syzkaller.com>
Date:   Mon Nov 2 23:48:02 2026 +0000

    syz-cluster: applied patch under review

diff --git a/drivers/net/wireless/ath/ath11k/.kunitconfig b/drivers/net/wireless/ath/ath11k/.kunitconfig
new file mode 100644
index 00000000000000..b13aaaecf04a44
--- /dev/null
+++ b/drivers/net/wireless/ath/ath11k/.kunitconfig
@@ -0,0 +1,14 @@
+CONFIG_KUNIT=y
+CONFIG_VIRTIO_UML=y
+CONFIG_UML_PCI_OVER_VIRTIO=y
+CONFIG_NET=y
+CONFIG_INET=y
+CONFIG_WIRELESS=y
+CONFIG_CFG80211=y
+CONFIG_MAC80211=y
+CONFIG_CRYPTO=y
+CONFIG_ATH_COMMON=y
+CONFIG_QCOM_QMI_HELPERS=y
+CONFIG_QRTR=y
+CONFIG_ATH11K=y
+CONFIG_ATH11K_KUNIT_TEST=y
diff --git a/drivers/net/wireless/ath/ath11k/Kconfig b/drivers/net/wireless/ath/ath11k/Kconfig
index 44b520d2e66ee8..2b688f10934572 100644
--- a/drivers/net/wireless/ath/ath11k/Kconfig
+++ b/drivers/net/wireless/ath/ath11k/Kconfig
@@ -71,3 +71,14 @@ config ATH11K_CFR
 	  to enable, disable, and dump data.
 
 	  Say Y to enable CFR data dump collection via debugfs.
+
+config ATH11K_KUNIT_TEST
+	bool "KUnit tests for ath11k" if !KUNIT_ALL_TESTS
+	depends on KUNIT=y && ATH11K=y
+	default KUNIT_ALL_TESTS
+	help
+	  This builds KUnit tests for ath11k recovery and resource management.
+	  It tests crash recovery flow, dynamic allocation failure handling,
+	  resource cleanup ordering, and subsequent send protection.
+
+	  If unsure, say N.
diff --git a/drivers/net/wireless/ath/ath11k/Makefile b/drivers/net/wireless/ath/ath11k/Makefile
index b1435fcf3e1bfe..e42a38a2d0269c 100644
--- a/drivers/net/wireless/ath/ath11k/Makefile
+++ b/drivers/net/wireless/ath/ath11k/Makefile
@@ -29,6 +29,7 @@ ath11k-$(CONFIG_ATH11K_SPECTRAL) += spectral.o
 ath11k-$(CONFIG_PM) += wow.o
 ath11k-$(CONFIG_DEV_COREDUMP) += coredump.o
 ath11k-$(CONFIG_ATH11K_CFR) += cfr.o
+ath11k-$(CONFIG_ATH11K_KUNIT_TEST) += test.o
 
 obj-$(CONFIG_ATH11K_AHB) += ath11k_ahb.o
 ath11k_ahb-y += ahb.o
diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index 766ae27306f43d..27c08721c6a722 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -2245,6 +2245,11 @@ static int ath11k_core_start_firmware(struct ath11k_base *ab,
 {
 	int ret;
 
+#if IS_ENABLED(CONFIG_ATH11K_KUNIT_TEST)
+	if (ab->test_ops.start_firmware)
+		return ab->test_ops.start_firmware(ab, mode);
+#endif
+
 	ath11k_ce_get_shadow_config(ab, &ab->qmi.ce_cfg.shadow_reg_v2,
 				    &ab->qmi.ce_cfg.shadow_reg_v2_len);
 
@@ -2297,13 +2302,27 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
 		set_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags);
 
 	mutex_lock(&ab->core_lock);
+#if IS_ENABLED(CONFIG_ATH11K_KUNIT_TEST)
+	if (ab->test_ops.core_start)
+		ret = ab->test_ops.core_start(ab);
+	else
+		ret = ath11k_core_start(ab);
+#else
 	ret = ath11k_core_start(ab);
+#endif
 	if (ret) {
 		ath11k_err(ab, "failed to start core: %d\n", ret);
 		goto err_dp_free;
 	}
 
+#if IS_ENABLED(CONFIG_ATH11K_KUNIT_TEST)
+	if (ab->test_ops.pdev_create)
+		ret = ab->test_ops.pdev_create(ab);
+	else
+		ret = ath11k_core_pdev_create(ab);
+#else
 	ret = ath11k_core_pdev_create(ab);
+#endif
 	if (ret) {
 		ath11k_err(ab, "failed to create pdev core: %d\n", ret);
 		goto err_core_stop;
@@ -2320,12 +2339,21 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
 	ath11k_dp_free(ab);
 	mutex_unlock(&ab->core_lock);
 err_firmware_stop:
+#if IS_ENABLED(CONFIG_ATH11K_KUNIT_TEST)
+	if (ab->test_ops.stop_firmware) {
+		ab->test_ops.stop_firmware_called++;
+		ab->test_ops.stop_firmware(ab);
+	} else {
+		ath11k_qmi_firmware_stop(ab);
+	}
+#else
 	ath11k_qmi_firmware_stop(ab);
+#endif
 
 	return ret;
 }
 
-static int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)
+VISIBLE_IF_KUNIT int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)
 {
 	int ret;
 
@@ -2349,16 +2377,24 @@ static int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)
 	clear_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags);
 
 	ret = ath11k_core_qmi_firmware_ready(ab);
-	if (ret)
-		goto err_hal_srng_deinit;
+	if (ret) {
+		/* The firmware has been stopped and the data path is gone,
+		 * but mac80211 may still call into the driver (e.g. drv_start
+		 * from the wiphy resume). Treat the device as crashed so that
+		 * WMI, CE and DP TX bail out until a later recovery succeeds.
+		 *
+		 * Do not free the HAL SRNG memory here: it is allocated at
+		 * probe and freed at remove, and rings that were already set
+		 * up again (e.g. by ath11k_ce_init_pipes()) still point into
+		 * it.
+		 */
+		set_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags);
+		return ret;
+	}
 
 	clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
 
 	return 0;
-
-err_hal_srng_deinit:
-	ath11k_hal_srng_deinit(ab);
-	return ret;
 }
 
 void ath11k_core_halt(struct ath11k *ar)
diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index a0d725923ef24d..57895e4bafffec 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -18,6 +18,7 @@
 #include <linux/firmware.h>
 #include <linux/suspend.h>
 #include <linux/of.h>
+#include <kunit/visibility.h>
 
 #include "qmi.h"
 #include "htc.h"
@@ -1092,6 +1093,18 @@ struct ath11k_base {
 	enum ath11k_pm_policy actual_pm_policy;
 	struct notifier_block pm_nb;
 
+#if IS_ENABLED(CONFIG_ATH11K_KUNIT_TEST)
+	struct {
+		int (*start_firmware)(struct ath11k_base *ab,
+				      enum ath11k_firmware_mode mode);
+		void (*stop_firmware)(struct ath11k_base *ab);
+		int (*core_start)(struct ath11k_base *ab);
+		int (*pdev_create)(struct ath11k_base *ab);
+		bool fail_tx_status_alloc;
+		int stop_firmware_called;
+	} test_ops;
+#endif
+
 	/* must be last */
 	u8 drv_priv[] __aligned(sizeof(void *));
 };
@@ -1372,4 +1385,8 @@ static inline const char *ath11k_bus_str(enum ath11k_bus bus)
 
 void ath11k_core_pm_notifier_unregister(struct ath11k_base *ab);
 
+#if IS_ENABLED(CONFIG_KUNIT)
+int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab);
+#endif
+
 #endif /* _CORE_H_ */
diff --git a/drivers/net/wireless/ath/ath11k/dp.c b/drivers/net/wireless/ath/ath11k/dp.c
index be65d73b904b61..d1918f5d5e1a6d 100644
--- a/drivers/net/wireless/ath/ath11k/dp.c
+++ b/drivers/net/wireless/ath/ath11k/dp.c
@@ -1040,7 +1040,7 @@ void ath11k_dp_free(struct ath11k_base *ab)
 			     ath11k_dp_tx_pending_cleanup, ab);
 		idr_destroy(&dp->tx_ring[i].txbuf_idr);
 		spin_unlock_bh(&dp->tx_ring[i].tx_idr_lock);
-		kfree(dp->tx_ring[i].tx_status);
+		kvfree(dp->tx_ring[i].tx_status);
 		dp->tx_ring[i].tx_status = NULL;
 	}
 
@@ -1093,10 +1093,17 @@ int ath11k_dp_alloc(struct ath11k_base *ab)
 
 		dp->tx_ring[i].tx_status_head = 0;
 		dp->tx_ring[i].tx_status_tail = DP_TX_COMP_RING_SIZE - 1;
-		dp->tx_ring[i].tx_status = kmalloc(size, GFP_KERNEL);
+#if IS_ENABLED(CONFIG_ATH11K_KUNIT_TEST)
+		if (ab->test_ops.fail_tx_status_alloc)
+			dp->tx_ring[i].tx_status = NULL;
+		else
+			dp->tx_ring[i].tx_status = kvmalloc(size, GFP_KERNEL);
+#else
+		dp->tx_ring[i].tx_status = kvmalloc(size, GFP_KERNEL);
+#endif
 		if (!dp->tx_ring[i].tx_status) {
 			ret = -ENOMEM;
-			goto fail_cmn_srng_cleanup;
+			goto fail_tx_status;
 		}
 	}
 
@@ -1107,7 +1114,14 @@ int ath11k_dp_alloc(struct ath11k_base *ab)
 
 	return 0;
 
-fail_cmn_srng_cleanup:
+fail_tx_status:
+	while (i >= 0) {
+		idr_destroy(&dp->tx_ring[i].txbuf_idr);
+		kvfree(dp->tx_ring[i].tx_status);
+		dp->tx_ring[i].tx_status = NULL;
+		i--;
+	}
+
 	ath11k_dp_srng_common_cleanup(ab);
 
 fail_link_desc_cleanup:
diff --git a/drivers/net/wireless/ath/ath11k/test.c b/drivers/net/wireless/ath/ath11k/test.c
new file mode 100644
index 00000000000000..cdf7bd4289946a
--- /dev/null
+++ b/drivers/net/wireless/ath/ath11k/test.c
@@ -0,0 +1,330 @@
+// SPDX-License-Identifier: BSD-3-Clause-Clear
+/*
+ * KUnit regression tests for ath11k crash recovery and resource ownership
+ *
+ * Exercises ath11k production crash recovery flow (ath11k_core_reconfigure_on_crash),
+ * verifying error recovery paths, deterministic TX status allocation failure,
+ * preservation of HAL SRNG lifecycle, and enforcement of -ESHUTDOWN on subsequent sends.
+ */
+
+#include <kunit/test.h>
+#include <kunit/device.h>
+#include <linux/dma-mapping.h>
+#include <linux/skbuff.h>
+#include <linux/vmalloc.h>
+
+#include "core.h"
+#include "hal.h"
+#include "hal_desc.h"
+#include "ce.h"
+#include "dp.h"
+#include "dp_tx.h"
+#include "hif.h"
+
+struct ath11k_test_fixture {
+	struct device *dev;
+	struct ath11k_base *ab;
+};
+
+static void ath11k_test_dummy_timer(struct timer_list *t)
+{
+}
+
+static u32 ath11k_test_read32(struct ath11k_base *ab, u32 address)
+{
+	return 0;
+}
+
+static void ath11k_test_write32(struct ath11k_base *ab, u32 address, u32 data)
+{
+}
+
+static void ath11k_test_irq_enable(struct ath11k_base *ab)
+{
+}
+
+static void ath11k_test_irq_disable(struct ath11k_base *ab)
+{
+}
+
+static int ath11k_test_hif_start(struct ath11k_base *ab)
+{
+	return 0;
+}
+
+static void ath11k_test_hif_stop(struct ath11k_base *ab)
+{
+}
+
+static int ath11k_test_map_service_to_pipe(struct ath11k_base *ab, u16 service_id,
+					   u8 *ul_pipe, u8 *dl_pipe)
+{
+	return 0;
+}
+
+static const struct ath11k_hif_ops ath11k_test_hif_ops = {
+	.read32 = ath11k_test_read32,
+	.write32 = ath11k_test_write32,
+	.irq_enable = ath11k_test_irq_enable,
+	.irq_disable = ath11k_test_irq_disable,
+	.start = ath11k_test_hif_start,
+	.stop = ath11k_test_hif_stop,
+	.map_service_to_pipe = ath11k_test_map_service_to_pipe,
+};
+
+static int ath11k_test_start_firmware(struct ath11k_base *ab,
+				      enum ath11k_firmware_mode mode)
+{
+	return 0;
+}
+
+static void ath11k_test_stop_firmware(struct ath11k_base *ab)
+{
+}
+
+static int ath11k_test_core_start(struct ath11k_base *ab)
+{
+	return 0;
+}
+
+static int ath11k_test_pdev_create(struct ath11k_base *ab)
+{
+	return 0;
+}
+
+static int ath11k_test_init(struct kunit *test)
+{
+	struct ath11k_test_fixture *fx;
+	struct ath11k_base *ab;
+	struct device *dev;
+	int ret;
+
+	fx = kunit_kzalloc(test, sizeof(*fx), GFP_KERNEL);
+	KUNIT_ASSERT_NOT_NULL(test, fx);
+
+	dev = kunit_device_register(test, "ath11k_kunit_dev");
+	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);
+	dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
+	fx->dev = dev;
+
+	ab = ath11k_core_alloc(dev, 0, ATH11K_BUS_PCI);
+	KUNIT_ASSERT_NOT_NULL(test, ab);
+	fx->ab = ab;
+	test->priv = fx;
+
+	ab->hif.ops = &ath11k_test_hif_ops;
+
+	timer_setup(&ab->mon_reap_timer, ath11k_test_dummy_timer, 0);
+
+	ab->hw_rev = ATH11K_HW_WCN6855_HW21;
+	ret = ath11k_core_pre_init(ab);
+	KUNIT_ASSERT_EQ(test, ret, 0);
+
+	ret = ath11k_hal_srng_init(ab);
+	KUNIT_ASSERT_EQ(test, ret, 0);
+
+	ret = ath11k_ce_alloc_pipes(ab);
+	KUNIT_ASSERT_EQ(test, ret, 0);
+
+	ret = ath11k_ce_init_pipes(ab);
+	KUNIT_ASSERT_EQ(test, ret, 0);
+
+	ret = ath11k_dp_alloc(ab);
+	KUNIT_ASSERT_EQ(test, ret, 0);
+
+	ab->test_ops.start_firmware = ath11k_test_start_firmware;
+	ab->test_ops.stop_firmware = ath11k_test_stop_firmware;
+	ab->test_ops.core_start = ath11k_test_core_start;
+	ab->test_ops.pdev_create = ath11k_test_pdev_create;
+	ab->test_ops.fail_tx_status_alloc = false;
+	ab->test_ops.stop_firmware_called = 0;
+
+	return 0;
+}
+
+static void ath11k_test_exit(struct kunit *test)
+{
+	struct ath11k_test_fixture *fx = test->priv;
+	struct ath11k_base *ab;
+
+	if (!fx || !fx->ab)
+		return;
+
+	ab = fx->ab;
+	ath11k_dp_free(ab);
+	ath11k_ce_free_pipes(ab);
+	ath11k_hal_srng_deinit(ab);
+	ath11k_fw_destroy(ab);
+	ath11k_core_free(ab);
+}
+
+/*
+ * Test 1: Successful recovery.
+ * Verifies that standard crash reconfiguration succeeds, clears recovery and
+ * crash-flush flags, allocates DP resources, and keeps HAL SRNG intact.
+ */
+static void ath11k_test_recovery_success(struct kunit *test)
+{
+	struct ath11k_test_fixture *fx = test->priv;
+	struct ath11k_base *ab = fx->ab;
+	int ret;
+
+	set_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
+
+	ret = ath11k_core_reconfigure_on_crash(ab);
+	KUNIT_EXPECT_EQ(test, ret, 0);
+
+	KUNIT_EXPECT_FALSE(test, test_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags));
+	KUNIT_EXPECT_FALSE(test, test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags));
+	KUNIT_EXPECT_NOT_NULL(test, ab->dp.tx_ring[0].tx_status);
+	KUNIT_EXPECT_NOT_NULL(test, ab->hal.rdp.vaddr);
+	KUNIT_EXPECT_NOT_NULL(test, ab->hal.srng_config);
+}
+
+/*
+ * Test 2: Failure at TX status allocation during recovery.
+ * Verifies that when TX status allocation fails during crash recovery:
+ * 1. Recovery returns -ENOMEM.
+ * 2. ATH11K_FLAG_CRASH_FLUSH is set to protect against subsequent traffic.
+ * 3. Firmware stop is invoked.
+ * 4. DP tx_status is NULL.
+ * 5. HAL SRNG memory and config are preserved (not freed prematurely).
+ */
+static void ath11k_test_recovery_tx_status_alloc_fail(struct kunit *test)
+{
+	struct ath11k_test_fixture *fx = test->priv;
+	struct ath11k_base *ab = fx->ab;
+	int ret;
+
+	/* Run initial successful recovery to establish initialized state */
+	set_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
+	ret = ath11k_core_reconfigure_on_crash(ab);
+	KUNIT_ASSERT_EQ(test, ret, 0);
+	KUNIT_ASSERT_NOT_NULL(test, ab->dp.tx_ring[0].tx_status);
+
+	/* Trigger recovery with injected TX status allocation failure */
+	set_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
+	ab->test_ops.fail_tx_status_alloc = true;
+	ab->test_ops.stop_firmware_called = 0;
+
+	ret = ath11k_core_reconfigure_on_crash(ab);
+	KUNIT_EXPECT_EQ(test, ret, -ENOMEM);
+
+	/* CRASH_FLUSH must be set to protect the driver against entry calls */
+	KUNIT_EXPECT_TRUE(test, test_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags));
+	KUNIT_EXPECT_GT(test, ab->test_ops.stop_firmware_called, 0);
+	KUNIT_EXPECT_NULL(test, ab->dp.tx_ring[0].tx_status);
+
+	/* HAL SRNG memory must NOT be deinited on recovery failure */
+	KUNIT_EXPECT_NOT_NULL(test, ab->hal.rdp.vaddr);
+	KUNIT_EXPECT_NOT_NULL(test, ab->hal.srng_config);
+}
+
+/*
+ * Test 3: Prevention of subsequent unsafe operations after recovery failure.
+ * Verifies that after TX status allocation fails during recovery, subsequent
+ * CE and DP send operations return -ESHUTDOWN rather than touching hardware
+ * or dereferencing freed/uninitialized memory.
+ */
+static void ath11k_test_recovery_subsequent_send_prevented(struct kunit *test)
+{
+	struct ath11k_test_fixture *fx = test->priv;
+	struct ath11k_base *ab = fx->ab;
+	struct sk_buff *skb;
+	int ret;
+
+	/* Run recovery with allocation failure */
+	set_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
+	ab->test_ops.fail_tx_status_alloc = true;
+	ret = ath11k_core_reconfigure_on_crash(ab);
+	KUNIT_ASSERT_EQ(test, ret, -ENOMEM);
+	KUNIT_ASSERT_TRUE(test, test_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags));
+
+	/* CE send on CE 3 (WMI control pipe) must be blocked with -ESHUTDOWN */
+	skb = dev_alloc_skb(64);
+	KUNIT_ASSERT_NOT_NULL(test, skb);
+	ret = ath11k_ce_send(ab, skb, 3, 0);
+	KUNIT_EXPECT_EQ(test, ret, -ESHUTDOWN);
+	dev_kfree_skb(skb);
+
+	/* DP TX REO command must also be blocked with -ESHUTDOWN */
+	ret = ath11k_dp_tx_send_reo_cmd(ab, NULL, 0, NULL, NULL);
+	KUNIT_EXPECT_EQ(test, ret, -ESHUTDOWN);
+}
+
+/*
+ * Test 4: Resource ownership and cleanup after recovery failure.
+ * Verifies that after recovery failure, a subsequent recovery attempt
+ * when memory is available succeeds, clears CRASH_FLUSH, and tears down
+ * cleanly without double-free or corruption.
+ */
+static void ath11k_test_recovery_resource_cleanup_and_teardown(struct kunit *test)
+{
+	struct ath11k_test_fixture *fx = test->priv;
+	struct ath11k_base *ab = fx->ab;
+	int ret;
+
+	/* Step 1: Initial failure */
+	set_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
+	ab->test_ops.fail_tx_status_alloc = true;
+	ret = ath11k_core_reconfigure_on_crash(ab);
+	KUNIT_ASSERT_EQ(test, ret, -ENOMEM);
+	KUNIT_ASSERT_TRUE(test, test_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags));
+
+	/* Step 2: Memory becomes available, retry recovery */
+	ab->test_ops.fail_tx_status_alloc = false;
+	set_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
+	ret = ath11k_core_reconfigure_on_crash(ab);
+	KUNIT_EXPECT_EQ(test, ret, 0);
+	KUNIT_EXPECT_FALSE(test, test_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags));
+	KUNIT_EXPECT_FALSE(test, test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags));
+	KUNIT_EXPECT_NOT_NULL(test, ab->dp.tx_ring[0].tx_status);
+	KUNIT_EXPECT_NOT_NULL(test, ab->hal.rdp.vaddr);
+	KUNIT_EXPECT_NOT_NULL(test, ab->hal.srng_config);
+}
+
+/*
+ * Test 5: DP TX status allocation sizing and kvmalloc lifecycle.
+ * Verifies that TX status ring size is 1 MiB (order-8 contiguous allocation),
+ * that ath11k_dp_alloc allocates it, and ath11k_dp_free frees and NULLs it.
+ */
+static void ath11k_test_dp_tx_status_kvmalloc(struct kunit *test)
+{
+	struct ath11k_test_fixture *fx = test->priv;
+	struct ath11k_base *ab = fx->ab;
+	size_t size;
+	int ret;
+
+	size = DP_TX_COMP_RING_SIZE * sizeof(struct hal_wbm_release_ring);
+	KUNIT_EXPECT_EQ(test, size, (size_t)1048576);
+
+	/* DP was allocated in fixture init, verify tx_status is present */
+	KUNIT_EXPECT_NOT_NULL(test, ab->dp.tx_ring[0].tx_status);
+
+	/* Free and verify tx_status is NULLed */
+	ath11k_dp_free(ab);
+	KUNIT_EXPECT_NULL(test, ab->dp.tx_ring[0].tx_status);
+
+	/* Reallocate and verify kvmalloc successfully allocates it again */
+	ret = ath11k_dp_alloc(ab);
+	KUNIT_ASSERT_EQ(test, ret, 0);
+	KUNIT_EXPECT_NOT_NULL(test, ab->dp.tx_ring[0].tx_status);
+}
+
+static struct kunit_case ath11k_recovery_test_cases[] = {
+	KUNIT_CASE(ath11k_test_recovery_success),
+	KUNIT_CASE(ath11k_test_recovery_tx_status_alloc_fail),
+	KUNIT_CASE(ath11k_test_recovery_subsequent_send_prevented),
+	KUNIT_CASE(ath11k_test_recovery_resource_cleanup_and_teardown),
+	KUNIT_CASE(ath11k_test_dp_tx_status_kvmalloc),
+	{}
+};
+
+static struct kunit_suite ath11k_recovery_test_suite = {
+	.name = "ath11k-recovery",
+	.init = ath11k_test_init,
+	.exit = ath11k_test_exit,
+	.test_cases = ath11k_recovery_test_cases,
+};
+
+kunit_test_suite(ath11k_recovery_test_suite);

3/2 2026/11/02 23:48 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 10715
							output: 41
							thoughts: 1286
						

Thoughts:
**Analyzing the ath11k KUnit Test Patch**

Okay, so this patch introduces KUnit tests for the `ath11k` driver, specifically focusing on `drivers/net/wireless/ath/ath11k/test.c`. It also includes the necessary `.kunitconfig` and modifications to `Kconfig` and `Makefile`, which is standard for KUnit integration. The core changes, however, are in `core.c` and `dp.c`, which warrant a closer look.

In `core.c`, I see hooks added under `#if IS_ENABLED(CONFIG_ATH11K_KUNIT_TEST)` within `ath11k_core_start_firmware` and `ath11k_core_qmi_firmware_ready`. This suggests the KUnit tests are designed to be conditionally compiled and run. The more interesting change is in `ath11k_core_reconfigure_on_crash`. It looks like the patch modifies the error handling. Instead of deinitializing the HAL SRNG in the error case, it now sets the `ATH11K_FLAG_CRASH_FLUSH` flag. The original code unconditionally deinitializes SRNG, but it seems there are cases where the firmware is stopped while the data path is still in use, like when `mac80211` calls into the driver (e.g. `drv_start` from `wiphy resume`). Now, we set `ATH11K_FLAG_CRASH_FLUSH` to indicate that WMI, CE, and DP TX bail out until a later recovery succeeds.

Now looking at `dp.c`, it's clear there's a memory allocation change using `kvmalloc` and `kvfree` instead of `kmalloc` and `kfree` for the `tx_status` buffers within the data path. Also added a cleanup loop to ensure proper deallocation in case of failure.

The key question now is, can this be tested effectively in a standard environment? My initial thought is that ath11k is a Qualcomm Atheros 802.11ax wireless driver. It supports PCI and AHB hardware via `ath11k_pci` and `ath11k_ahb`. The core issue is whether standard virtualized environments like QEMU or syzkaller, *without* specific ath11k hardware, can emulate or provide access to this hardware. Based on my understanding of the rules, this likely fails the "Structurally unreachable hardware" criteria. The changes might be significant, but if I can't trigger them without physical hardware, then the patch isn't suitable for fuzzing in a standard setup. `mac80211_hwsim` is interesting, but that's a *software* simulator for mac80211, not a substitute for running the vendor driver (`ath11k`) with actual hardware emulation. I need to make sure I am not mistaken and can look at the `ath11k` Kconfig to confirm.



4/2 2026/11/02 23:48 tool grepper
0m Args:
{
  "Expression": "config ATH11K",
  "PathPrefixes": [
    "drivers/net/wireless/ath/ath11k/Kconfig"
  ]
}

Results:
{
  "Output": "drivers/net/wireless/ath/ath11k/Kconfig-1-# SPDX-License-Identifier: BSD-3-Clause-Clear\ndrivers/net/wireless/ath/ath11k/Kconfig:2:config ATH11K\ndrivers/net/wireless/ath/ath11k/Kconfig-3-\ttristate \"Qualcomm 802.11ax chipset support\"\n--\ndrivers/net/wireless/ath/ath11k/Kconfig-12-\ndrivers/net/wireless/ath/ath11k/Kconfig:13:config ATH11K_AHB\ndrivers/net/wireless/ath/ath11k/Kconfig-14-\ttristate \"Atheros ath11k AHB support\"\n--\ndrivers/net/wireless/ath/ath11k/Kconfig-22-\ndrivers/net/wireless/ath/ath11k/Kconfig:23:config ATH11K_PCI\ndrivers/net/wireless/ath/ath11k/Kconfig-24-\ttristate \"Atheros ath11k PCI support\"\n--\ndrivers/net/wireless/ath/ath11k/Kconfig-32-\ndrivers/net/wireless/ath/ath11k/Kconfig:33:config ATH11K_DEBUG\ndrivers/net/wireless/ath/ath11k/Kconfig-34-\tbool \"QCA ath11k debugging\"\n--\ndrivers/net/wireless/ath/ath11k/Kconfig-40-\ndrivers/net/wireless/ath/ath11k/Kconfig:41:config ATH11K_DEBUGFS\ndrivers/net/wireless/ath/ath11k/Kconfig-42-\tbool \"QCA ath11k debugfs support\"\n--\ndrivers/net/wireless/ath/ath11k/Kconfig-48-\ndrivers/net/wireless/ath/ath11k/Kconfig:49:config ATH11K_TRACING\ndrivers/net/wireless/ath/ath11k/Kconfig-50-\tbool \"ath11k tracing support\"\n--\ndrivers/net/wireless/ath/ath11k/Kconfig-54-\ndrivers/net/wireless/ath/ath11k/Kconfig:55:config ATH11K_SPECTRAL\ndrivers/net/wireless/ath/ath11k/Kconfig-56-\tbool \"QCA ath11k spectral scan support\"\n--\ndrivers/net/wireless/ath/ath11k/Kconfig-63-\ndrivers/net/wireless/ath/ath11k/Kconfig:64:config ATH11K_CFR\ndrivers/net/wireless/ath/ath11k/Kconfig-65-\tbool \"ath11k channel frequency response support\"\n--\ndrivers/net/wireless/ath/ath11k/Kconfig-74-\ndrivers/net/wireless/ath/ath11k/Kconfig:75:config ATH11K_KUNIT_TEST\ndrivers/net/wireless/ath/ath11k/Kconfig-76-\tbool \"KUnit tests for ath11k\" if !KUNIT_ALL_TESTS\n"
}

5/2 2026/11/02 23:48 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 13465
							output: 35
							thoughts: 706
						

Thoughts:
**Analyzing the Potential for Syzkaller Fuzzing of an ath11k Patch**

Okay, so this patch is touching `ath11k`, which I know is Qualcomm's 802.11ax chipset driver. My first thought is: can this even be fuzzed by syzkaller? The key question is whether the code is reachable in standard virtualized environments.

I need to figure out how this `KUnit` thing fits in. What's the relationship between `KUnit` tests and syzkaller? Are `KUnit` tests considered just unit test code, or are they integrated differently? It looks like `KUnit` tests run either during boot or through `debugfs`, so that makes me think they might be reachable.

Looking at the patch itself, it's modifying several files within the `ath11k` directory: `.kunitconfig`, `Kconfig`, `Makefile`, and the usual `.c` and `.h` files, plus a `test.c`. That's a good sign because it touches the build process and some source code.

Now I remember, the key constraint from the guide is about reachability. I have to make sure the code can actually *execute* in standard virtualized environments like GCE or QEMU. Specifically, that means emulated devices like USB gadgets or network devices (tun/tap).

The guide explicitly flags "Structurally unreachable hardware" – vendor-specific PCIe switches, SmartNICs, GPU drivers that need specific hardware not emulated in QEMU. Wait a minute... is `ath11k` one of those? Yes, it's Qualcomm, and it's a wireless chipset. That means it likely requires specific hardware, right? My initial gut feeling is that QEMU doesn't emulate Qualcomm WCN6855 or IPQ8074, which `ath11k` drives, it only emulates standard Ethernet cards and some USB devices. So, is there any USB support in ath11k? I need to check. This is critical. If it's pure PCIe/AHB, then it's likely unreachable, and this patch can't be fuzzed.



6/2 2026/11/02 23:48 tool grepper
0m Args:
{
  "Expression": "USB",
  "PathPrefixes": [
    "drivers/net/wireless/ath/ath11k/"
  ]
}

Results:
{
  "Output": "no matches"
}

7/2 2026/11/02 23:48 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 14687
							output: 41
							thoughts: 22
						

Thoughts:
Okay, here's my take on those thoughts, tailored for an expert audience:

**Troubleshooting ath11k USB Connectivity**

Alright, the initial diagnostic is in. I'm seeing no USB device matches with ath11k. This is a bit unexpected, so it's time to dig deeper. My first instinct is to confirm my assumptions and quickly re-evaluate the bus architecture in play. I need to refresh my understanding of *precisely* which bus types ath11k is designed to interface with. My expectation is there *should* be at least one, and knowing the supported ones is key. I'll need to double-check my configuration assumptions here, perhaps related to driver loading, firmware, or device tree entries. Time to map the landscape and see what we are dealing with. Let's see what buses this target platform supports with ath11k. I'll be able to then see if there's any obvious mismatch.



8/2 2026/11/02 23:48 tool grepper
0m Args:
{
  "Expression": "enum ath11k_bus",
  "PathPrefixes": [
    "drivers/net/wireless/ath/ath11k/"
  ]
}

Results:
{
  "Output": "drivers/net/wireless/ath/ath11k/core.c=2778=struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,\ndrivers/net/wireless/ath/ath11k/core.c:2779:\t\t\t\t      enum ath11k_bus bus)\ndrivers/net/wireless/ath/ath11k/core.c-2780-{\n--\ndrivers/net/wireless/ath/ath11k/core.h=925=struct ath11k_base {\n--\ndrivers/net/wireless/ath/ath11k/core.h-949-\tstruct {\ndrivers/net/wireless/ath/ath11k/core.h:950:\t\tenum ath11k_bus bus;\ndrivers/net/wireless/ath/ath11k/core.h-951-\t\tconst struct ath11k_hif_ops *ops;\n--\ndrivers/net/wireless/ath/ath11k/core.h=1286=struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,\ndrivers/net/wireless/ath/ath11k/core.h:1287:\t\t\t\t      enum ath11k_bus bus);\ndrivers/net/wireless/ath/ath11k/core.h-1288-void ath11k_core_free(struct ath11k_base *ath11k);\n--\ndrivers/net/wireless/ath/ath11k/core.h=1355=static inline void ath11k_core_create_firmware_path(struct ath11k_base *ab,\n--\ndrivers/net/wireless/ath/ath11k/core.h-1373-\ndrivers/net/wireless/ath/ath11k/core.h:1374:static inline const char *ath11k_bus_str(enum ath11k_bus bus)\ndrivers/net/wireless/ath/ath11k/core.h-1375-{\n--\ndrivers/net/wireless/ath/ath11k/hw.h=96=enum ath11k_hw_rate_ofdm {\n--\ndrivers/net/wireless/ath/ath11k/hw.h-106-\ndrivers/net/wireless/ath/ath11k/hw.h:107:enum ath11k_bus {\ndrivers/net/wireless/ath/ath11k/hw.h-108-\tATH11K_BUS_AHB,\n"
}

9/2 2026/11/02 23:48 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 15603
							output: 44
							thoughts: 29
						

Thoughts:
Here's a summary of my thought process, tailored for an expert like yourself:

**Diving into the Atheros Wireless Hardware Abstraction**

Okay, time to get my hands dirty. I'm focusing in on the ath11k driver, specifically its hardware abstraction layer. Let's start by navigating directly to `drivers/net/wireless/ath/ath11k/hw.h` because that's usually where the foundational definitions for the hardware interaction live. I'm betting that around line 107 there'll be some key structs, enums, or macros related to how the driver communicates with the Qualcomm Atheros chipset. I anticipate finding some of the essential data structures for hardware register access, command definitions, or perhaps even some of the low-level constants for controlling the radio. I'm particularly interested in seeing how the register mappings are structured and if there are any hints on the various hardware components like MAC, PHY, and the DMA engines. Let's see what gems are waiting to be uncovered.



10/2 2026/11/02 23:49 tool read-file
0m Args:
{
  "File": "drivers/net/wireless/ath/ath11k/hw.h",
  "FirstLine": 105,
  "LineCount": 15
}

Results:
{
  "Contents": " 105:\t};\n 106:\t\n 107:\tenum ath11k_bus {\n 108:\t\tATH11K_BUS_AHB,\n 109:\t\tATH11K_BUS_PCI,\n 110:\t};\n 111:\t\n 112:\t#define ATH11K_EXT_IRQ_GRP_NUM_MAX 11\n 113:\t\n 114:\tstruct hal_rx_desc;\n 115:\tstruct hal_tcl_data_cmd;\n 116:\t\n 117:\tstruct ath11k_hw_ring_mask {\n 118:\t\tu8 tx[ATH11K_EXT_IRQ_GRP_NUM_MAX];\n 119:\t\tu8 rx_mon_status[ATH11K_EXT_IRQ_GRP_NUM_MAX];\n"
}

11/2 2026/11/02 23:49 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 16129
							output: 27
							thoughts: 1031
						

Thoughts:
**Unreachable Code Paths and the Limits of Fuzzing**

Okay, so I'm digging into this `ath11k` driver, specifically concerning its potential for fuzzing. I'm focusing on `ATH11K_BUS_AHB` and `ATH11K_BUS_PCI` here. The bottom line is, I realize, that neither AHB (Qualcomm's IPQ platform bus) nor PCI (as found in Qualcomm's WCN6855, QCA6390, and so on) can be emulated in a standard QEMU or GCE environment without actual Qualcomm hardware. That's the core issue.

Then I paused and thought, "Wait a minute, what about KUnit? Are there calls to this driver via KUnit?" I quickly found that there's a KUnit test suite, specifically `ath11k_recovery_test_suite` within `test.c`. It uses `kunit_device_register`, then calls functions like `ath11k_core_alloc`, `ath11k_core_pre_init`, `ath11k_dp_alloc`, and `ath11k_core_reconfigure_on_crash`.

This got me thinking, "Can syzkaller fuzz KUnit test suites or unit tests?" The answer, after a moment, is a firm "NO." Syzkaller is a coverage-guided *kernel syscall fuzzer*. It's designed to generate sequences of system calls, userspace-facing interfaces, to test kernel interactions. KUnit tests, however, are in-kernel unit test frameworks, meant to be run at boot or triggered via kunit.py or debugfs. They are NOT userspace-facing syscall interfaces that syzkaller fuzzes. So, I need to treat them as distinct.

I then went back to ensure KUnit itself would be considered unreachable, or effectively ignored, by the fuzzer. I checked the documentation regarding what constitutes unreachable code paths for fuzzing. It's clear that changes in test code, samples, or scripts that don't affect the compiled kernel image are excluded. Also, structurally unreachable hardware like vendor-specific PCIe switches is also excluded, especially if the hardware can't be emulated in standard QEMU.

Then I considered a possible counter-argument: "But this patch *also* modifies `core.c` and `dp.c`!" But, `core.c` and `dp.c` are parts of `ath11k`! And `ath11k`, as a whole, is structurally unreachable in standard virtualized environments. It is a vendor-specific wireless driver for Qualcomm Atheros 802.11ax hardware, interfacing with PCI and AHB. The key here is, in standard QEMU/GCE instances, there isn't a Qualcomm ath11k PCI card or AHB device! Since this hardware is not present, the `ath11k` driver's `probe` function is never invoked. This means `ath11k_base` is never created during standard kernel operation. The driver is completely dormant and unreachable from any userspace syscalls.

I then did a quick sanity check to see if this driver could be loaded or instantiated virtually through other means. I confirmed that `mac80211_hwsim` cannot use `ath11k`, as it is its own dedicated driver. There is no `virtio-wifi` to test with and, crucially, `ath11k` does not have any USB driver or interface. Finally, I confirmed that standard QEMU does not have an ath11k device emulation for PCI.

To be absolutely sure, I'll need to double-check that `ath11k_core_reconfigure_on_crash` or `ath11k_dp_alloc` are not called anywhere outside of `ath11k` itself.



12/2 2026/11/02 23:49 tool grepper
0m Args:
{
  "Expression": "ath11k_core_reconfigure_on_crash"
}

Results:
{
  "Output": "drivers/net/wireless/ath/ath11k/core.c=2265=int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)\n--\ndrivers/net/wireless/ath/ath11k/core.c-2355-\ndrivers/net/wireless/ath/ath11k/core.c:2356:VISIBLE_IF_KUNIT int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)\ndrivers/net/wireless/ath/ath11k/core.c-2357-{\n--\ndrivers/net/wireless/ath/ath11k/core.c=2547=static void ath11k_core_restart(struct work_struct *work)\n--\ndrivers/net/wireless/ath/ath11k/core.c-2551-\ndrivers/net/wireless/ath/ath11k/core.c:2552:\tret = ath11k_core_reconfigure_on_crash(ab);\ndrivers/net/wireless/ath/ath11k/core.c-2553-\tif (ret) {\n--\ndrivers/net/wireless/ath/ath11k/core.h=1386=void ath11k_core_pm_notifier_unregister(struct ath11k_base *ab);\n--\ndrivers/net/wireless/ath/ath11k/core.h-1388-#if IS_ENABLED(CONFIG_KUNIT)\ndrivers/net/wireless/ath/ath11k/core.h:1389:int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab);\ndrivers/net/wireless/ath/ath11k/core.h-1390-#endif\n--\ndrivers/net/wireless/ath/ath11k/test.c-4- *\ndrivers/net/wireless/ath/ath11k/test.c:5: * Exercises ath11k production crash recovery flow (ath11k_core_reconfigure_on_crash),\ndrivers/net/wireless/ath/ath11k/test.c-6- * verifying error recovery paths, deterministic TX status allocation failure,\n--\ndrivers/net/wireless/ath/ath11k/test.c=166=static void ath11k_test_recovery_success(struct kunit *test)\n--\ndrivers/net/wireless/ath/ath11k/test.c-173-\ndrivers/net/wireless/ath/ath11k/test.c:174:\tret = ath11k_core_reconfigure_on_crash(ab);\ndrivers/net/wireless/ath/ath11k/test.c-175-\tKUNIT_EXPECT_EQ(test, ret, 0);\n--\ndrivers/net/wireless/ath/ath11k/test.c=193=static void ath11k_test_recovery_tx_status_alloc_fail(struct kunit *test)\n--\ndrivers/net/wireless/ath/ath11k/test.c-200-\tset_bit(ATH11K_FLAG_RECOVERY, \u0026ab-\u003edev_flags);\ndrivers/net/wireless/ath/ath11k/test.c:201:\tret = ath11k_core_reconfigure_on_crash(ab);\ndrivers/net/wireless/ath/ath11k/test.c-202-\tKUNIT_ASSERT_EQ(test, ret, 0);\n--\ndrivers/net/wireless/ath/ath11k/test.c-209-\ndrivers/net/wireless/ath/ath11k/test.c:210:\tret = ath11k_core_reconfigure_on_crash(ab);\ndrivers/net/wireless/ath/ath11k/test.c-211-\tKUNIT_EXPECT_EQ(test, ret, -ENOMEM);\n--\ndrivers/net/wireless/ath/ath11k/test.c=229=static void ath11k_test_recovery_subsequent_send_prevented(struct kunit *test)\n--\ndrivers/net/wireless/ath/ath11k/test.c-238-\tab-\u003etest_ops.fail_tx_status_alloc = true;\ndrivers/net/wireless/ath/ath11k/test.c:239:\tret = ath11k_core_reconfigure_on_crash(ab);\ndrivers/net/wireless/ath/ath11k/test.c-240-\tKUNIT_ASSERT_EQ(test, ret, -ENOMEM);\n--\ndrivers/net/wireless/ath/ath11k/test.c=261=static void ath11k_test_recovery_resource_cleanup_and_teardown(struct kunit *test)\n--\ndrivers/net/wireless/ath/ath11k/test.c-269-\tab-\u003etest_ops.fail_tx_status_alloc = true;\ndrivers/net/wireless/ath/ath11k/test.c:270:\tret = ath11k_core_reconfigure_on_crash(ab);\ndrivers/net/wireless/ath/ath11k/test.c-271-\tKUNIT_ASSERT_EQ(test, ret, -ENOMEM);\n--\ndrivers/net/wireless/ath/ath11k/test.c-276-\tset_bit(ATH11K_FLAG_RECOVERY, \u0026ab-\u003edev_flags);\ndrivers/net/wireless/ath/ath11k/test.c:277:\tret = ath11k_core_reconfigure_on_crash(ab);\ndrivers/net/wireless/ath/ath11k/test.c-278-\tKUNIT_EXPECT_EQ(test, ret, 0);\n"
}

13/2 2026/11/02 23:49 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 19473
							output: 37
							thoughts: 116
						

Thoughts:
**Analyzing Ath11k Driver Function Calls**

Okay, so let me break this down. From what I'm seeing, `ath11k_core_reconfigure_on_crash` is triggered in very specific circumstances. It's only called by `ath11k_core_restart`, which, if I recall correctly, is that workqueue function the ath11k driver uses when the hardware goes belly up. So, it's a critical recovery path. I'm also seeing it called within this new KUnit test, `test.c`. That makes sense; they're probably trying to simulate a crash scenario to validate the recovery mechanism.

Now, `ath11k_dp_alloc` is called during the probe and recovery phases of the ath11k driver. We're allocating data pipes during those processes. Conversely, `ath11k_dp_free` is triggered during the cleanup process for these data pipes. 

My next move is to check the ath11k PCI driver IDs. I need to understand the hardware compatibility at this point.



14/2 2026/11/02 23:49 tool grepper
0m Args:
{
  "Expression": "PCI_DEVICE",
  "PathPrefixes": [
    "drivers/net/wireless/ath/ath11k/"
  ]
}

Results:
{
  "Output": "drivers/net/wireless/ath/ath11k/pci.c=524=static int ath11k_pci_claim(struct ath11k_pci *ab_pci, struct pci_dev *pdev)\n--\ndrivers/net/wireless/ath/ath11k/pci.c-529-\ndrivers/net/wireless/ath/ath11k/pci.c:530:\tpci_read_config_word(pdev, PCI_DEVICE_ID, \u0026device_id);\ndrivers/net/wireless/ath/ath11k/pci.c-531-\tif (device_id != ab_pci-\u003edev_id)  {\n"
}

15/2 2026/11/02 23:49 llm patch-evaluator
2m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 20040
							output: 40
							thoughts: 23
						

Thoughts:
Okay, let's dive into this. Here's my perspective on `drivers/net/wireless/ath/ath11k/pci.c`:

**Dissecting the Ath11k PCI Driver**

Alright, so I'm focusing in on `drivers/net/wireless/ath/ath11k/pci.c`, which, as the name implies, is the PCI driver implementation for the Atheros/Qualcomm ath11k wireless chipset. Immediately, I'm thinking about the standard PCI initialization sequence, device probing, and resource allocation. I need to refresh my memory on the likely interrupt handling setup – how are interrupts configured for this specific hardware and how does the driver interface with the generic PCI subsystem and the mac80211 stack? I'm expecting to see calls to `pci_request_regions()`, `pci_enable_device()`, and likely some specific register reads to determine device capabilities and configuration.

I'll be looking for the crucial `ath11k_pci_probe()` function. That's where the magic starts. It'll be responsible for detecting the PCI device, verifying its existence and expected ID, claiming the PCI resources, and potentially loading firmware. I'll need to pay close attention to the error handling within this function – what happens if the device isn't present, if resource allocation fails, or if firmware loading hits a snag? Error reporting is crucial here, as is graceful fallback strategies.

Then, there'll be the `ath11k_pci_remove()` function to handle device removal. Proper resource cleanup is essential to prevent system instability, so I'll be looking at calls to `pci_release_regions()`, device disabling, and the unregistering of any associated hardware interfaces with the kernel. I also want to see how the driver handles power management. Is it using the standard PCI power management callbacks? What are the power-down and power-up sequences? This is a key area for potential bugs and performance optimization.

Furthermore, I'll be scrutinizing how the driver interfaces with the ath11k core code. Is it using a well-defined set of callbacks or structures to communicate with the hardware-independent part of the ath11k driver? I'm expecting some kind of `ath11k_pci_ops` structure or similar construct, providing functions for things like DMA setup, register access, and interrupt handling. The goal here is to understand the driver's role as a bridge between the PCI bus and the core ath11k functionality.

Finally, interrupt handling is always a key area to scrutinize. I'll need to know exactly how the driver handles interrupts: Which interrupts are used? What's the interrupt handler function? Is it a shared interrupt? How are interrupts masked and unmasked? Are there any interrupt coalescing mechanisms? Proper interrupt handling is essential for performance and reliability. I want to see how the driver deals with the potential for lost or spurious interrupts. Overall, I'm aiming to understand the driver's role in establishing a reliable and efficient communication channel between the Linux kernel and the ath11k wireless hardware over the PCI bus.



16/2 2026/11/02 23:51 tool grepper
0m Args:
{
  "Expression": "pci_device_id",
  "PathPrefixes": [
    "drivers/net/wireless/ath/ath11k/"
  ]
}

Results:
{
  "Output": "drivers/net/wireless/ath/ath11k/pci.c-35-\ndrivers/net/wireless/ath/ath11k/pci.c:36:static const struct pci_device_id ath11k_pci_id_table[] = {\ndrivers/net/wireless/ath/ath11k/pci.c-37-\t{ PCI_VDEVICE(QCOM, QCA6390_DEVICE_ID) },\n--\ndrivers/net/wireless/ath/ath11k/pci.c=949=static int ath11k_pci_probe(struct pci_dev *pdev,\ndrivers/net/wireless/ath/ath11k/pci.c:950:\t\t\t    const struct pci_device_id *pci_dev)\ndrivers/net/wireless/ath/ath11k/pci.c-951-{\n"
}

17/2 2026/11/02 23:51 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 21005
							output: 138
							thoughts: 1193
						

Thoughts:
**WorthFuzzing Assessment: ath11k Driver Modifications**

Okay, let's break this down. My initial assessment is that this patch series isn't worth fuzzing. I need to make sure I'm following the guidelines to avoid wasted effort.

First, I see the modifications are specifically tied to the `ath11k` driver, which handles Qualcomm's 802.11ax wireless devices. Crucially, these devices are identified by specific Qualcomm PCI device IDs (`QCA6390_DEVICE_ID`, `WCN6855_DEVICE_ID`, etc.). The key point here is that these devices, or any suitable emulation of them, *do not* exist within QEMU or GCE environments.

Now, let me review the guidelines and see if they apply here:

The Core Triage Philosophy states that fuzzing is for code that *can execute* in standard virtualized environments. Reachability is the primary gate. Refactoring changes must be tested. New or modified assertions in reachable code must be fuzzed.

The Negative Criteria (when to return `WorthFuzzing=false`) is where I'll find my justification. The relevant criteria seem to be: "Structurally unreachable hardware: Vendor-specific PCIe switches, SmartNICs... requiring physical ASIC/PCIe cards not emulated in standard QEMU". That fits perfectly. The ath11k driver explicitly falls under this.

The patch includes a KUnit test file, `test.c`. But that's a self-test run by the KUnit harness, not something reachable by syzkaller fuzzing. Additionally, the test hooks within the core driver code are guarded by a KUnit config, which is specific to that self test. The code is only within the ath11k driver, which itself is unreachable.

Even the bug fixes in `core.c` and `dp.c` related to `ath11k_core_reconfigure_on_crash` and `ath11k_dp_alloc/free` are *strictly* within that unreachable ath11k driver.

Therefore, applying the provided guidelines, I must conclude that `WorthFuzzing` should be `false`. This patch modifies code that is inherently unreachable in standard fuzzing environments.



18/2 2026/11/02 23:52 tool set-results
0m Args:
{
  "EnableConfigs": [],
  "FocusSymbols": [],
  "Reasoning": "The patch introduces KUnit regression tests for ath11k and updates error handling and allocation logic within the ath11k driver (drivers/net/wireless/ath/ath11k/). The ath11k driver is a vendor-specific wireless driver for Qualcomm IEEE 802.11ax PCIe/AHB chipsets. It requires physical ASIC hardware not emulated in standard virtualized fuzzing environments (QEMU/GCE), making the modified code structurally unreachable for syzkaller fuzzing.",
  "WorthFuzzing": false
}

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch introduces KUnit regression tests for ath11k and updates error handling and allocation logic within the ath11k driver (drivers/net/wireless/ath/ath11k/). The ath11k driver is a vendor-specific wireless driver for Qualcomm IEEE 802.11ax PCIe/AHB chipsets. It requires physical ASIC hardware not emulated in standard virtualized fuzzing environments (QEMU/GCE), making the modified code structurally unreachable for syzkaller fuzzing.",
  "WorthFuzzing": false
}

19/1 2026/11/02 23:52 action If
0m Args:
{
  "WorthFuzzing": false
}

Results:
null

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)