diff options
author | Wolfram Sang <[email protected]> | 2023-06-29 14:05:26 +0200 |
---|---|---|
committer | Michael S. Tsirkin <[email protected]> | 2023-08-10 15:24:27 -0400 |
commit | 55c91fedd03d7b9cf0c5199b2eb12b9b8e95281a (patch) | |
tree | af909563d6daa21555ff4bf4f8834b97c0e4e4e6 /tools/perf/scripts/python/event_analyzing_sample.py | |
parent | 52a93d39b17dc7eb98b6aa3edb93943248e03b2f (diff) |
virtio-mmio: don't break lifecycle of vm_dev
vm_dev has a separate lifecycle because it has a 'struct device'
embedded. Thus, having a release callback for it is correct.
Allocating the vm_dev struct with devres totally breaks this protection,
though. Instead of waiting for the vm_dev release callback, the memory
is freed when the platform_device is removed. Resulting in a
use-after-free when finally the callback is to be called.
To easily see the problem, compile the kernel with
CONFIG_DEBUG_KOBJECT_RELEASE and unbind with sysfs.
The fix is easy, don't use devres in this case.
Found during my research about object lifetime problems.
Fixes: 7eb781b1bbb7 ("virtio_mmio: add cleanup for virtio_mmio_probe")
Signed-off-by: Wolfram Sang <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/event_analyzing_sample.py')
0 files changed, 0 insertions, 0 deletions