WSL2-Linux-Kernel/drivers/rpmsg
Xiaolei Wang 2d27a7b19c rpmsg: virtio: Free driver_override when rpmsg_remove()
commit d5362c37e1f8a40096452fc201c30e705750e687 upstream.

Free driver_override when rpmsg_remove(), otherwise
the following memory leak will occur:

unreferenced object 0xffff0000d55d7080 (size 128):
  comm "kworker/u8:2", pid 56, jiffies 4294893188 (age 214.272s)
  hex dump (first 32 bytes):
    72 70 6d 73 67 5f 6e 73 00 00 00 00 00 00 00 00  rpmsg_ns........
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<000000009c94c9c1>] __kmem_cache_alloc_node+0x1f8/0x320
    [<000000002300d89b>] __kmalloc_node_track_caller+0x44/0x70
    [<00000000228a60c3>] kstrndup+0x4c/0x90
    [<0000000077158695>] driver_set_override+0xd0/0x164
    [<000000003e9c4ea5>] rpmsg_register_device_override+0x98/0x170
    [<000000001c0c89a8>] rpmsg_ns_register_device+0x24/0x30
    [<000000008bbf8fa2>] rpmsg_probe+0x2e0/0x3ec
    [<00000000e65a68df>] virtio_dev_probe+0x1c0/0x280
    [<00000000443331cc>] really_probe+0xbc/0x2dc
    [<00000000391064b1>] __driver_probe_device+0x78/0xe0
    [<00000000a41c9a5b>] driver_probe_device+0xd8/0x160
    [<000000009c3bd5df>] __device_attach_driver+0xb8/0x140
    [<0000000043cd7614>] bus_for_each_drv+0x7c/0xd4
    [<000000003b929a36>] __device_attach+0x9c/0x19c
    [<00000000a94e0ba8>] device_initial_probe+0x14/0x20
    [<000000003c999637>] bus_probe_device+0xa0/0xac

Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
Fixes: b0b03b8119 ("rpmsg: Release rpmsg devices in backends")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20231215020049.78750-1-xiaolei.wang@windriver.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-23 08:54:24 +01:00
..
Kconfig rpmsg: Turn name service into a stand alone driver 2020-11-24 10:11:59 -06:00
Makefile rpmsg: Turn name service into a stand alone driver 2020-11-24 10:11:59 -06:00
mtk_rpmsg.c rpmsg: mtk_rpmsg: Fix circular locking dependency 2022-08-17 14:24:03 +02:00
qcom_glink_native.c rpmsg: glink: Release driver_override 2023-11-08 17:26:44 +01:00
qcom_glink_native.h rpmsg: glink: Switch to SPDX license identifier 2018-06-03 17:37:15 -07:00
qcom_glink_rpm.c rpmsg: glink: Switch to SPDX license identifier 2018-06-03 17:37:15 -07:00
qcom_glink_smem.c rpmsg: glink: Set tail pointer to 0 at end of FIFO 2019-10-11 11:34:12 -07:00
qcom_glink_ssr.c rpmsg: glink: add include of header file 2021-01-05 22:22:40 -06:00
qcom_smd.c rpmsg: qcom: glink: replace strncpy() with strscpy_pad() 2022-10-12 09:53:28 +02:00
rpmsg_char.c rpmsg: char: Add mutex protection for rpmsg_eptdev_open() 2022-08-17 14:24:03 +02:00
rpmsg_core.c rpmsg: Fix possible refcount leak in rpmsg_register_device_override() 2023-11-08 17:26:44 +01:00
rpmsg_internal.h rpmsg: Fix calling device_lock() on non-initialized device 2023-11-08 17:26:44 +01:00
rpmsg_ns.c rpmsg: Fix calling device_lock() on non-initialized device 2023-11-08 17:26:44 +01:00
virtio_rpmsg_bus.c rpmsg: virtio: Free driver_override when rpmsg_remove() 2024-02-23 08:54:24 +01:00