> 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 <[email protected]>
> Link: https://lore.kernel.org/all/[email protected]/
> Cc: [email protected]
> Signed-off-by: Yige Jiang <[email protected]>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review ยท
https://sashiko.dev/#/patchset/[email protected]?part=1