)]}'
{
  "commit": "00ad9212573ac763f9883f3c44e58ac57dbd7621",
  "tree": "28910f0a16dfe7776f85e96aa21f6d97022dce4a",
  "parents": [
    "6c4ad818429d4dbdde042b696040289c13140d47"
  ],
  "author": {
    "name": "Ammar Faizi",
    "email": "ammarfaizi2@openresty.com",
    "time": "Sun Mar 15 21:18:08 2026 +0700"
  },
  "committer": {
    "name": "Michael S. Tsirkin",
    "email": "mst@redhat.com",
    "time": "Sun Jun 07 18:21:46 2026 -0400"
  },
  "message": "virtio_pci: fix vq info pointer lookup via wrong index\n\nUnbinding a virtio balloon device:\n\n    echo virtio0 \u003e /sys/bus/virtio/drivers/virtio_balloon/unbind\n\ntriggers a NULL pointer dereference. The dmesg says:\n\n    BUG: kernel NULL pointer dereference, address: 0000000000000008\n    [...]\n    RIP: 0010:__list_del_entry_valid_or_report+0x5/0xf0\n    Call Trace:\n    \u003cTASK\u003e\n    vp_del_vqs+0x121/0x230\n    remove_common+0x135/0x150\n    virtballoon_remove+0xee/0x100\n    virtio_dev_remove+0x3b/0x80\n    device_release_driver_internal+0x187/0x2c0\n    unbind_store+0xb9/0xe0\n    kernfs_fop_write_iter.llvm.11660790530567441834+0xf6/0x180\n    vfs_write+0x2a9/0x3b0\n    ksys_write+0x5c/0xd0\n    do_syscall_64+0x54/0x230\n    entry_SYSCALL_64_after_hwframe+0x29/0x31\n    [...]\n    \u003c/TASK\u003e\n\nThe virtio_balloon device registers 5 queues (inflate, deflate, stats,\nfree_page, reporting) but only the first two are unconditional. The\nstats, free_page and reporting queues are each conditional on their\nrespective feature bits. When any of these features are absent, the\ncorresponding vqs_info entry has name \u003d\u003d NULL, creating holes in the\narray.\n\nThe root cause is an indexing mismatch introduced when vq info storage\nwas changed to be passed as an argument. vp_find_vqs_msix() and\nvp_find_vqs_intx() store the info pointer at vp_dev-\u003evqs[i], where \u0027i\u0027\nis the caller\u0027s sparse array index. However, the virtqueue itself gets\nvq-\u003eindex assigned from queue_idx, a dense index that skips NULL\nentries. When holes exist, \u0027i\u0027 and queue_idx diverge. Later,\nvp_del_vqs() looks up info via vp_dev-\u003evqs[vq-\u003eindex] using the dense\nindex into the sparsely-populated array, and hits NULL.\n\nFix this by storing info at vp_dev-\u003evqs[queue_idx] instead of\nvp_dev-\u003evqs[i], so the store index matches the lookup index\n(vq-\u003eindex). Apply the fix to both the MSIX and INTX paths.\n\nCc: Yichun Zhang \u003cyichun@openresty.com\u003e\nCc: Jiri Pirko \u003cjiri@nvidia.com\u003e\nCc: stable@vger.kernel.org # v6.11+\nTested-by: Yuka \u003cyuka@umeyashiki.org\u003e\nFixes: 89a1c435aec2 (\"virtio_pci: pass vq info as an argument to vp_setup_vq()\")\nSigned-off-by: Ammar Faizi \u003cammarfaizi2@openresty.com\u003e\nMessage-Id: \u003c20260315141808.547081-1-ammarfaizi2@openresty.com\u003e\nSigned-off-by: Michael S. Tsirkin \u003cmst@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "da97b6a988debc78db67228740b3998d4928e386",
      "old_mode": 33188,
      "old_path": "drivers/virtio/virtio_pci_common.c",
      "new_id": "164f480b18a6fe12783ab4605eb14e779efe871d",
      "new_mode": 33188,
      "new_path": "drivers/virtio/virtio_pci_common.c"
    }
  ]
}
