Re: [PATCH 1/1 v2] Bluetooth: make the balance of judgement condition to fix a false report

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27 Nov 2018, at 11.24, Johan Hedberg <johan.hedberg@xxxxxxxxx> wrote:
>> On 15 Nov 2018, at 3.31, Zumeng Chen <zumeng.chen@xxxxxxxxx> 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.

Johan





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux