diff options
| author | Yuchao Zhang <ndaugoing@gmail.com> | 2026-09-22 15:21:55 +0800 |
|---|---|---|
| committer | Juergen Gross <jgross@suse.com> | 2026-10-09 09:58:46 +0200 |
| commit | f3e27b7955727a4d7c0e9264a2a209fbba788bdc (patch) | |
| tree | 0f6c5ae8189057312ae65c6c877328876557c83c /tools/perf/scripts/python/stackcollapse.py | |
| parent | 9b4df0baa2aa03d22310e59846ca628f7afd4115 (diff) | |
| download | linux-f3e27b7955727a4d7c0e9264a2a209fbba788bdc.tar.gz linux-f3e27b7955727a4d7c0e9264a2a209fbba788bdc.zip | |
xen-blkfront: unbind irq before tearing down ring and shadow requests
In blkif_free_ring(), the driver tears down the ring's persistent grants,
shadow request arrays, and shared ring structure (xenbus_teardown_ring),
and only calls unbind_from_irqhandler() at the very end.
While blkif_free_ring() is freeing persistent grants and clearing the
shadow array, the event channel interrupt (blkif_interrupt) is still
registered and active. If an interrupt arrives from the backend during
this teardown window, blkif_interrupt() reads rinfo->ring.sring and,
via blkif_completion(), accesses rinfo->shadow[id].grants_used and
rinfo->shadow[id].sg. blkif_free_ring() tears these structures down
without holding rinfo->ring_lock, and the handler only checks
info->connected at entry, so this is a real race resulting in a
use-after-free or NULL pointer dereference.
Fix this by moving unbind_from_irqhandler() to the beginning of
blkif_free_ring(). Calling unbind_from_irqhandler() first frees the
IRQ and synchronizes with any in-flight interrupt handlers on other CPUs
before ring memory and shadow request structures are deallocated,
matching the teardown order in drivers/net/xen-netfront.c.
Fixes: 11659569f720 ("xen/blkfront: split per device io_lock")
Cc: stable@vger.kernel.org
Signed-off-by: Yuchao Zhang <ndaugoing@gmail.com>
Acked-by: Roger Pau Monné <roger@xenproject.org>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20260922072155.34625-1-ndaugoing@gmail.com>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
