From: Johan Hedberg <johan.hedberg@gmail.com>
To: Nicholas Krause <xerofoify@gmail.com>
Cc: marcel@holtmann.org, gustavo@padovan.org, davem@davemloft.net,
linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bluetooth:Fix error checking in the function hci_disconn_complete_evt
Date: Mon, 24 Aug 2015 12:47:49 +0300 [thread overview]
Message-ID: <20150824094749.GA6958@t440s.lan> (raw)
In-Reply-To: <1439993129-27049-1-git-send-email-xerofoify@gmail.com>
Hi Nicholas,
On Wed, Aug 19, 2015, Nicholas Krause wrote:
> This fixes error checking in the function hci_disconn_complete_evt
> to properly check if it's call to the function hci_remove_link_key
> returns NULL to signal it has not correctly removed the link key
> on the passed hci_dev structure pointer and if so jump to the goto
> label unlock to unlock the caller's passed hci_dev structure pointer
> as this function cannot continue its intended work after this failed
>
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
> net/bluetooth/hci_event.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 32363c2..5174649 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -2448,8 +2448,10 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
> reason, mgmt_connected);
>
> if (conn->type == ACL_LINK) {
> - if (test_bit(HCI_CONN_FLUSH_KEY, &conn->flags))
> - hci_remove_link_key(hdev, &conn->dst);
> + if (test_bit(HCI_CONN_FLUSH_KEY, &conn->flags)) {
> + if (!hci_remove_link_key(hdev, &conn->dst))
> + goto unlock;
> + }
>
> hci_update_page_scan(hdev);
> }
This doesn't look correct to me. The only scenario where
hci_remove_link_key() may fail is if there was no existing key (it'll
return -ENOENT then). This is a perfectly normal thing that will occur
for a disconnection of a non-paired device, so any other cleanups like
hci_update_page_scan() should still go ahead.
Johan
parent reply other threads:[~2015-08-24 9:48 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <1439993129-27049-1-git-send-email-xerofoify@gmail.com>]
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=20150824094749.GA6958@t440s.lan \
--to=johan.hedberg@gmail.com \
--cc=davem@davemloft.net \
--cc=gustavo@padovan.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=netdev@vger.kernel.org \
--cc=xerofoify@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome