From: jeffy <jeffy.chen@rock-chips.com>
To: Oliver Neukum <oneukum@suse.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: Tue, 18 Jul 2017 10:16:10 +0800 [thread overview]
Message-ID: <596D6F6A.1090004@rock-chips.com> (raw)
In-Reply-To: <1500305216.16072.2.camel@suse.com>
Hi Oliver,
Thanks for your reply.
On 07/17/2017 11:26 PM, Oliver Neukum wrote:
> 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.
oh, i see the problem.
>
>>>> 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.
the urbs we submit here are referenced but unanchored, so i think we can:
1/ unreference it here and put it in tx_anchor, and let urb core to do
the unachor(and unreference)
or
2/ we unreference it in the complete callback.
i'll send a new version for 2/
>
>>>> 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
>
>
>
>
prev parent reply other threads:[~2017-07-18 2:16 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
2017-07-18 2:16 ` jeffy [this message]
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=596D6F6A.1090004@rock-chips.com \
--to=jeffy.chen@rock-chips.com \
--cc=briannorris@chromium.org \
--cc=dianders@chromium.org \
--cc=gustavo@padovan.org \
--cc=johan.hedberg@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=oneukum@suse.com \
--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.