* [PATCH 1/1] rpmsg: virtio_rpmsg_bus: Fix rpmsg_create_channel memory leak
@ 2018-07-25 21:08 Loic Pallardy
2018-07-25 22:36 ` Suman Anna
0 siblings, 1 reply; 3+ messages in thread
From: Loic Pallardy @ 2018-07-25 21:08 UTC (permalink / raw)
To: bjorn.andersson, ohad
Cc: linux-remoteproc, linux-kernel, arnaud.pouliquen,
benjamin.gaignard, Loic Pallardy
In case of rpmsg_register_device() failure, vch previously
allocated must be free.
fixes: 6eed598a0491 ("rpmsg: Split off generic tail of create_channel()")
Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
---
drivers/rpmsg/virtio_rpmsg_bus.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
index 664f957..10f927e 100644
--- a/drivers/rpmsg/virtio_rpmsg_bus.c
+++ b/drivers/rpmsg/virtio_rpmsg_bus.c
@@ -431,8 +431,10 @@ static struct rpmsg_device *rpmsg_create_channel(struct virtproc_info *vrp,
rpdev->dev.parent = &vrp->vdev->dev;
rpdev->dev.release = virtio_rpmsg_release_device;
ret = rpmsg_register_device(rpdev);
- if (ret)
+ if (ret) {
+ kfree(vch);
return NULL;
+ }
return rpdev;
}
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] rpmsg: virtio_rpmsg_bus: Fix rpmsg_create_channel memory leak
2018-07-25 21:08 [PATCH 1/1] rpmsg: virtio_rpmsg_bus: Fix rpmsg_create_channel memory leak Loic Pallardy
@ 2018-07-25 22:36 ` Suman Anna
2018-07-26 7:04 ` Loic PALLARDY
0 siblings, 1 reply; 3+ messages in thread
From: Suman Anna @ 2018-07-25 22:36 UTC (permalink / raw)
To: Loic Pallardy, bjorn.andersson, ohad
Cc: linux-remoteproc, linux-kernel, arnaud.pouliquen, benjamin.gaignard
Hi Loic,
On 07/25/2018 04:08 PM, Loic Pallardy wrote:
> In case of rpmsg_register_device() failure, vch previously
> allocated must be free.
>
Isn't this already handled through the virtio_rpmsg_release_device()
callback as part of the put_device() in rpmsg_register_device() failure.
regards
Suman
> fixes: 6eed598a0491 ("rpmsg: Split off generic tail of create_channel()")
>
> Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
> ---
> drivers/rpmsg/virtio_rpmsg_bus.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
> index 664f957..10f927e 100644
> --- a/drivers/rpmsg/virtio_rpmsg_bus.c
> +++ b/drivers/rpmsg/virtio_rpmsg_bus.c
> @@ -431,8 +431,10 @@ static struct rpmsg_device *rpmsg_create_channel(struct virtproc_info *vrp,
> rpdev->dev.parent = &vrp->vdev->dev;
> rpdev->dev.release = virtio_rpmsg_release_device;
> ret = rpmsg_register_device(rpdev);
> - if (ret)
> + if (ret) {
> + kfree(vch);
> return NULL;
> + }
>
> return rpdev;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH 1/1] rpmsg: virtio_rpmsg_bus: Fix rpmsg_create_channel memory leak
2018-07-25 22:36 ` Suman Anna
@ 2018-07-26 7:04 ` Loic PALLARDY
0 siblings, 0 replies; 3+ messages in thread
From: Loic PALLARDY @ 2018-07-26 7:04 UTC (permalink / raw)
To: Suman Anna, bjorn.andersson, ohad
Cc: linux-remoteproc, linux-kernel, Arnaud POULIQUEN, benjamin.gaignard
Hi Suman,
> -----Original Message-----
> From: Suman Anna <s-anna@ti.com>
> Sent: Thursday, July 26, 2018 12:37 AM
> To: Loic PALLARDY <loic.pallardy@st.com>; bjorn.andersson@linaro.org;
> ohad@wizery.com
> Cc: linux-remoteproc@vger.kernel.org; linux-kernel@vger.kernel.org;
> Arnaud POULIQUEN <arnaud.pouliquen@st.com>;
> benjamin.gaignard@linaro.org
> Subject: Re: [PATCH 1/1] rpmsg: virtio_rpmsg_bus: Fix
> rpmsg_create_channel memory leak
>
> Hi Loic,
>
> On 07/25/2018 04:08 PM, Loic Pallardy wrote:
> > In case of rpmsg_register_device() failure, vch previously
> > allocated must be free.
> >
>
> Isn't this already handled through the virtio_rpmsg_release_device()
> callback as part of the put_device() in rpmsg_register_device() failure.
Yes you're right, put_device() is doing the job.
Please forget this patch.
Regards,
Loic
>
> regards
> Suman
>
> > fixes: 6eed598a0491 ("rpmsg: Split off generic tail of create_channel()")
> >
> > Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
> > ---
> > drivers/rpmsg/virtio_rpmsg_bus.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c
> b/drivers/rpmsg/virtio_rpmsg_bus.c
> > index 664f957..10f927e 100644
> > --- a/drivers/rpmsg/virtio_rpmsg_bus.c
> > +++ b/drivers/rpmsg/virtio_rpmsg_bus.c
> > @@ -431,8 +431,10 @@ static struct rpmsg_device
> *rpmsg_create_channel(struct virtproc_info *vrp,
> > rpdev->dev.parent = &vrp->vdev->dev;
> > rpdev->dev.release = virtio_rpmsg_release_device;
> > ret = rpmsg_register_device(rpdev);
> > - if (ret)
> > + if (ret) {
> > + kfree(vch);
> > return NULL;
> > + }
> >
> > return rpdev;
> > }
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-26 7:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-25 21:08 [PATCH 1/1] rpmsg: virtio_rpmsg_bus: Fix rpmsg_create_channel memory leak Loic Pallardy
2018-07-25 22:36 ` Suman Anna
2018-07-26 7:04 ` Loic PALLARDY
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®