All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: jeffy <jeffy.chen@rock-chips.com>, Marcel Holtmann <marcel@holtmann.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	xiyou.wangcong@gmail.com, Brian Norris <briannorris@chromium.org>,
	Douglas Anderson <dianders@chromium.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	"Gustavo F. Padovan" <gustavo@padovan.org>
Subject: Re: [RFC PATCH] Bluetooth: btusb: Fix memory leak in play_deferred
Date: Mon, 17 Jul 2017 17:26:56 +0200	[thread overview]
Message-ID: <1500305216.16072.2.camel@suse.com> (raw)
In-Reply-To: <596588F8.5070402@rock-chips.com>

Am Mittwoch, den 12.07.2017, 10:27 +0800 schrieb jeffy:
> Hi Oliver,
> 
> Thanx for your comments, and sorry for reply late.
> 
> 
> > If you do that you have to change submit_tx_urb() to be called under a
> > spinlock.
> 
> sorry, why we need that? since submit_tx_urb is basically 
> usb_anchor_urb/usb_submit_urb/usb_free_urb

You need to fix the GFP_KERNEL therein.

> > > or referenced, but the caller would unref it himself
> > > later?
> > 
> > The caller is responsible for its own references.
> hmm, maybe unref it in the complete callback(btusb_tx_complete?), and if 
> we do so, we may need to detect which urb came from here...

I do not get your reasoning there. If an URB has executed, it belongs
onto the anchor for URBs to be used again. 

> > > and for tx_anchor, we put urb in it, and kill them all during suspending
> > > to prevent transfer. so i guess it would be safe to put deferred urb in
> > > to it after resume too?
> > > but i don't know much about usb/btusb, so i could be wrong all about that :)
> > 
> > IIRC the reason for directly submitting them was the spinlock.
> sorry, i'm not clear about this, could you help to explain more? do you 
> mean txlock?

Yes

	Regards
		Oliver

  reply	other threads:[~2017-07-17 15:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22 10:10 [RFC PATCH] Bluetooth: btusb: Fix memory leak in play_deferred Jeffy Chen
2017-06-22 10:21 ` Marcel Holtmann
2017-06-23  3:46   ` jeffy
     [not found]     ` <1499168300.17946.3.camel@neukum.org>
2017-07-12  2:27       ` jeffy
2017-07-17 15:26         ` Oliver Neukum [this message]
2017-07-18  2:16           ` jeffy

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=1500305216.16072.2.camel@suse.com \
    --to=oneukum@suse.com \
    --cc=briannorris@chromium.org \
    --cc=dianders@chromium.org \
    --cc=gustavo@padovan.org \
    --cc=jeffy.chen@rock-chips.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=xiyou.wangcong@gmail.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.