diff options
| author | Yige Jiang <yigejiang86@gmail.com> | 2026-11-19 18:06:06 +0800 |
|---|---|---|
| committer | Michael S. Tsirkin <mst@redhat.com> | 2026-11-30 10:39:43 -0500 |
| commit | b31ad78b6fc87209556621f615020fc02390f005 (patch) | |
| tree | 287f71873d333c1cef8cf568b0f4a0b390141e84 /tools/lib/python | |
| parent | 803b45f83129f5140c84b4fa5d8614f4a36ce6b3 (diff) | |
virtio: Release the OF node when unregistering the device
virtio_device_of_init() acquires the OF node reference once during device
registration. virtio_dev_remove() currently puts it on each driver unbind,
although rebinding the driver does not acquire a new reference. Repeated
unbinds can therefore consume references not owned by the virtio device.
Conversely, unregistering a device that never bound to a driver leaves
the reference held.
Move the put to unregister_virtio_device() so it is paired with device
registration. Save the node pointer before device_unregister(), which
can free the virtio device, and put it after unregister has completed the
driver removal.
Fixes: 694a1116b405 ("virtio: Bind virtio device to device-tree node")
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Link: https://lore.kernel.org/all/sashiko-outbox-203883@kernel.org/
Cc: stable@vger.kernel.org
Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261119085343.virtio-of-node-a02bd3cf522b@gmail.com>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
