linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: Jaganath Kanakkassery <jaganath.k.os@gmail.com>,
	"open list:BLUETOOTH DRIVERS" <linux-bluetooth@vger.kernel.org>,
	Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
Subject: Re: [PATCH] Bluetooth: Fix potential memory leak
Date: Tue, 24 Oct 2017 10:58:31 +0200	[thread overview]
Message-ID: <20171024085831.GA3889@x1c> (raw)
In-Reply-To: <F0B9BF0A-BC07-4074-923E-518E6A227DF0@holtmann.org>

Hi Marcel,

On Tue, Oct 24, 2017, Marcel Holtmann wrote:
> > index 1fba2a0..58045ee 100644
> > --- a/net/bluetooth/mgmt.c
> > +++ b/net/bluetooth/mgmt.c
> > @@ -6383,6 +6383,7 @@ static int remove_advertising(struct sock *sk, struct hci_dev *hdev,
> > 	if (skb_queue_empty(&req.cmd_q) ||
> > 	    !hdev_is_powered(hdev) ||
> > 	    hci_dev_test_flag(hdev, HCI_ADVERTISING)) {
> > +		skb_queue_purge(&req.cmd_q);
> > 		rp.instance = cp->instance;
> > 		err = mgmt_cmd_complete(sk, hdev->id,
> > 					MGMT_OP_REMOVE_ADVERTISING,
> 
> this does not look right to me. It most likely has side affects. The
> fix must be differently if there is a memory leak.

Actually, it looks like the right fix to me. We don't have a separate
helper to clean up a hci_request that never got used, and
skb_queue_purge is what other places in the code seem to be doing in
this kind of cases.

Johan

  reply	other threads:[~2017-10-24  8:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24  7:29 [PATCH] Bluetooth: Fix potential memory leak Jaganath Kanakkassery
2017-10-24  7:41 ` Marcel Holtmann
2017-10-24  8:58   ` Johan Hedberg [this message]
2017-10-24 12:43     ` Marcel Holtmann
2017-10-25  5:44       ` Jaganath K

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=20171024085831.GA3889@x1c \
    --to=johan.hedberg@gmail.com \
    --cc=jaganath.k.os@gmail.com \
    --cc=jaganathx.kanakkassery@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /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).