From: Sean Young <sean@mess.org>
To: Oliver Neukum <oneukum@suse.com>
Cc: linux-media@vger.kernel.org, linux-usb@vger.kernel.org,
Johan Hovold <johan@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jon Rhees <support@usbuirt.com>
Subject: Re: [PATCH v2 2/3] media: rc: new driver for USB-UIRT device
Date: Thu, 6 May 2021 10:07:33 +0100 [thread overview]
Message-ID: <20210506090733.GA1483@gofer.mess.org> (raw)
In-Reply-To: <72f835c84c16b455222fece3bb3527f16ad965be.camel@suse.com>
Hi Oliver,
On Thu, May 06, 2021 at 10:27:21AM +0200, Oliver Neukum wrote:
> Am Mittwoch, den 05.05.2021, 22:57 +0100 schrieb Sean Young:
> > +static void uirt_disconnect(struct usb_interface *intf)
> > +{
> > + struct uirt *ir = usb_get_intfdata(intf);
> > +
> > + rc_unregister_device(ir->rc);
> > + usb_set_intfdata(intf, NULL);
> > + usb_kill_urb(ir->urb_out);
> > + usb_free_urb(ir->urb_out);
> > + usb_kill_urb(ir->urb_in);
> > + usb_free_urb(ir->urb_in);
> > + kfree(ir->in);
> > + kfree(ir->out);
> > + kfree(ir);
> > +}
>
> Hi,
>
> almost. Going through this again, it looks like you have a race
> condition here.
>
> CPU A CPU B
>
> usb_kill_urb(ir->urb_out);
> usb_free_urb(ir->urb_out);
>
> uirt_in_callback()
> uirt_response(struct uirt *uirt, u32 len)
> err = usb_submit_urb(uirt->urb_out, GFP_ATOMIC);
>
> BANG, you are using freeed memory
Nice catch, I had missed this. I'll send out a v3 with this fixed.
This needs fixing, for sure. Having said that, once we are in the disconnect
handler aren't all urbs/endpoints disabled in usb_disable_interface()? Does
this mean the usb_kill_urb() are superfluous?
Thanks,
Sean
next prev parent reply other threads:[~2021-05-06 9:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-05 21:57 [PATCH v2 0/3] IR driver for USB-UIRT device Sean Young
2021-05-05 21:57 ` [PATCH v2 1/3] USB: serial: move ftdi_sio.h into include directories Sean Young
2021-05-05 21:57 ` [PATCH v2 2/3] media: rc: new driver for USB-UIRT device Sean Young
2021-05-06 8:27 ` Oliver Neukum
2021-05-06 9:07 ` Sean Young [this message]
2021-05-05 21:57 ` [PATCH v2 3/3] USB: serial: blacklist USB-UIRT when driver is selected Sean Young
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=20210506090733.GA1483@gofer.mess.org \
--to=sean@mess.org \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=oneukum@suse.com \
--cc=support@usbuirt.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.