linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: Sean Young <sean@mess.org>,
	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, 06 May 2021 10:27:21 +0200	[thread overview]
Message-ID: <72f835c84c16b455222fece3bb3527f16ad965be.camel@suse.com> (raw)
In-Reply-To: <497d6ecc0f020b35be1f1e06b33a955574f433ed.1620251141.git.sean@mess.org>

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

	Regards
		Oliver



  reply	other threads:[~2021-05-06  8:27 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 [this message]
2021-05-06  9:07     ` Sean Young
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=72f835c84c16b455222fece3bb3527f16ad965be.camel@suse.com \
    --to=oneukum@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sean@mess.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).