[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD-N9QUD_H9R=gZyZ9YAx7h7bzNncGxZuivp=MKXmTtvDvXyAQ@mail.gmail.com>
Date: Fri, 3 Sep 2021 07:45:56 +0800
From: Dongliang Mu <mudongliangabcd@...il.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Mauro Carvalho Chehab <mchehab@...nel.org>,
linux-media@...r.kernel.org,
linux-kernel <linux-kernel@...r.kernel.org>,
Greg KH <gregkh@...uxfoundation.org>
Subject: Re: [PATCH] media: usb: fix memory leak in stk_camera_probe
On Thu, Sep 2, 2021 at 10:18 PM Dan Carpenter <dan.carpenter@...cle.com> wrote:
>
> On Thu, Sep 02, 2021 at 06:23:36PM +0800, Dongliang Mu wrote:
> > On Fri, Jul 23, 2021 at 6:11 PM Dongliang Mu <mudongliangabcd@...il.com> wrote:
> > >
> > > On Wed, Jul 14, 2021 at 11:23 AM Dongliang Mu <mudongliangabcd@...il.com> wrote:
> > > >
> > > > stk_camera_probe mistakenly execute usb_get_intf and increase the
> > > > refcount of interface->dev.
> > > >
> > > > Fix this by removing the execution of usb_get_intf.
> > >
> > > Any idea about this patch?
> >
> > +cc Dan Carpenter, gregkh
> >
> > There is no reply in this thread in one month. Can someone give some
> > feedback on this patch?
> >
> > >
> > > >
> > > > Reported-by: Dongliang Mu <mudongliangabcd@...il.com>
> > > > Fixes: 0aa77f6c2954 ("[media] move the remaining USB drivers to drivers/media/usb")
> > > > Signed-off-by: Dongliang Mu <mudongliangabcd@...il.com>
> > > > ---
> > > > drivers/media/usb/stkwebcam/stk-webcam.c | 1 -
> > > > 1 file changed, 1 deletion(-)
> > > >
> > > > diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c
> > > > index a45d464427c4..5bd8e85b9452 100644
> > > > --- a/drivers/media/usb/stkwebcam/stk-webcam.c
> > > > +++ b/drivers/media/usb/stkwebcam/stk-webcam.c
> > > > @@ -1311,7 +1311,6 @@ static int stk_camera_probe(struct usb_interface *interface,
> > > >
> > > > dev->udev = udev;
> > > > dev->interface = interface;
> > > > - usb_get_intf(interface);
>
>
> The patch is wrong. We're storing a reference to "interface".
>
> dev->interface = interface;
>
> So we need to boost the refcount of interface. Pavel Skripkin was on
> the right patch but you need to add a:
>
> usb_put_intf(interface);
>
> to the stk_camera_disconnect() function as you sort of mentioned.
> That's the correct fix.
Thanks for your explanation, Dan. It's really helpful.
I sent the inquiry email in this thread because I did not receive the
notification of patchwork to mark my patch as obsolete and did not
notice Pavel had sent one patch before.
Now, this patch is marked as obsolete. Let's ignore it now.
>
> regards,
> dan carpenter
Powered by blists - more mailing lists