All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Xiaolei Wang <xiaolei.wang@windriver.com>
Cc: andersson@kernel.org, linux-remoteproc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rpmsg: virtio: free driver_override when rpmsg_remove()
Date: Mon, 18 Dec 2023 11:26:22 -0700	[thread overview]
Message-ID: <ZYCOzlJILOWOtfsS@p14s> (raw)
In-Reply-To: <20231215020049.78750-1-xiaolei.wang@windriver.com>

On Fri, Dec 15, 2023 at 10:00:49AM +0800, Xiaolei Wang wrote:
> 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>
> ---
>  drivers/rpmsg/virtio_rpmsg_bus.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
> index dc87965f8164..1062939c3264 100644
> --- a/drivers/rpmsg/virtio_rpmsg_bus.c
> +++ b/drivers/rpmsg/virtio_rpmsg_bus.c
> @@ -378,6 +378,7 @@ static void virtio_rpmsg_release_device(struct device *dev)
>  	struct rpmsg_device *rpdev = to_rpmsg_device(dev);
>  	struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(rpdev);
>  
> +	kfree(rpdev->driver_override);
>  	kfree(vch);
>  }

I have applied this patch.

Thanks,
Mathieu

>  
> -- 
> 2.25.1
> 

      reply	other threads:[~2023-12-18 18:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15  2:00 [PATCH] rpmsg: virtio: free driver_override when rpmsg_remove() Xiaolei Wang
2023-12-18 18:26 ` Mathieu Poirier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZYCOzlJILOWOtfsS@p14s \
    --to=mathieu.poirier@linaro.org \
    --cc=andersson@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=xiaolei.wang@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.