From: Zumeng Chen <zumeng.chen@gmail.com>
To: <marcel@holtmann.org>
Cc: <linux-bluetooth@vger.kernel.org>, <johan.hedberg@gmail.com>,
<linux-kernel@vger.kernel.org>,
Zumeng Chen <zumeng.chen@gmail.com>
Subject: [PATCH 1/1 v2] Bluetooth: make the balance of judgement condition to fix a false report
Date: Thu, 15 Nov 2018 09:31:57 +0800 [thread overview]
Message-ID: <1542245517-150977-1-git-send-email-zumeng.chen@gmail.com> (raw)
In-Reply-To: <5A23C871-B30F-44C4-898B-C138EFDB4893@holtmann.org>
This patch is to balance the condition scope between hci_get_cmd_complete and
hci_event_packet about orig_skb as follows:
if (req_complete_skb || event == HCI_EV_CMD_STATUS ||
event == HCI_EV_CMD_COMPLETE)
orig_skb = skb_clone(skb, GFP_KERNEL);
And hci_get_cmd_complete will bt_dev_err out when HCI_EV_CMD_STATUS, so a lot
of asymmetric conditions are triggered. Since both of them are the entry into
hci_get_cmd_complete, we'd better get STATUS into judge the false out there.
Signed-off-by: Zumeng Chen <zumeng.chen@gmail.com>
---
v2: remove redundant braces and adjust the indentation.
Cheers,
Zumeng
net/bluetooth/hci_event.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 235b5aa..1d2a8fe 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -5217,7 +5217,8 @@ static bool hci_get_cmd_complete(struct hci_dev *hdev, u16 opcode,
return true;
}
- if (hdr->evt != HCI_EV_CMD_COMPLETE) {
+ if (!(hdr->evt == HCI_EV_CMD_COMPLETE ||
+ hdr->evt == HCI_EV_CMD_STATUS)) {
bt_dev_err(hdev, "last event is not cmd complete (0x%2.2x)",
hdr->evt);
return false;
--
2.7.4
next prev parent reply other threads:[~2018-11-15 1:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-08 5:47 [PATCH 1/1] Bluetooth: make the balance of judgement condition to fix a false report Zumeng Chen
2018-11-14 7:54 ` Marcel Holtmann
2018-11-15 1:31 ` Zumeng Chen [this message]
2018-11-26 11:23 ` [PATCH 1/1 v2] " Luiz Augusto von Dentz
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=1542245517-150977-1-git-send-email-zumeng.chen@gmail.com \
--to=zumeng.chen@gmail.com \
--cc=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@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).