linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zumeng Chen <zumeng.chen@gmail.com>
To: Johan Hedberg <johan.hedberg@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/1 v2] Bluetooth: make the balance of judgement condition to fix a false report
Date: Tue, 27 Nov 2018 20:22:37 +0800	[thread overview]
Message-ID: <1704c39f-c005-d0cc-9bab-c21e537a07be@gmail.com> (raw)
In-Reply-To: <3D63F92F-1BA5-415D-AED4-A38FB2E29C00@gmail.com>

On 2018年11月27日 17:34, Johan Hedberg wrote:
> On 27 Nov 2018, at 11.24, Johan Hedberg <johan.hedberg@gmail.com> wrote:
>>> On 15 Nov 2018, at 3.31, Zumeng Chen <zumeng.chen@gmail.com> wrote:
>>> --- 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;
>> This is not correct. The purpose of this function is to retrieve the command complete parameters, or the parameters of a specific event if the sending code indicated it (it didn’t in this case). Since the event was not command complete the right behaviour for this function is to fail, i.e. return false. The only issue here is the bt_dev_err, which should probably be downgraded to a BT_DBG. In fact, that’s what it used to be in the past - I’m not sure why it was changed to bt_dev_err.
> The one improvement I’d make however, is to silently return from the function in case of a Command Status event, since that just means that the request is complete, however there are no extra parameters to be retrieved. I’ll be sending a patch for that in a moment.

There is a related kernel as shown in the below list

https://bugzilla.kernel.org/show_bug.cgi?id=198699

I didn't think my patch is to fix this one because I think we need to 
sort out
the whole logic of CMD_COMPLETE. But my patch is good to fix the issue
described by subject.

Cheers,
Zumeng
>
> Johan
>


  reply	other threads:[~2018-11-27 12:22 UTC|newest]

Thread overview: 9+ 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   ` [PATCH 1/1 v2] " Zumeng Chen
2018-11-26 11:23     ` Luiz Augusto von Dentz
2018-11-27  9:24     ` Johan Hedberg
2018-11-27  9:34       ` Johan Hedberg
2018-11-27 12:22         ` Zumeng Chen [this message]
2018-11-27 21:19           ` Johan Hedberg
2018-11-27 12:13       ` Zumeng Chen

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=1704c39f-c005-d0cc-9bab-c21e537a07be@gmail.com \
    --to=zumeng.chen@gmail.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.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).