Re: [PATCH 05/16] Bluetooth: Check pending commands in stop_discovery()

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

 



Hi Gustavo,

On Wed, Jul 13, 2011 at 5:20 PM, Gustavo Padovan <padovan@xxxxxxxxxxxxxx> wrote:
>> @@ -1674,6 +1674,17 @@ static int stop_discovery(struct sock *sk, u16 index)
>>
>>       hci_dev_lock_bh(hdev);
>>
>> +     if (!mgmt_pending_find(MGMT_OP_START_DISCOVERY, index)) {
>> +             err = cmd_status(sk, index, MGMT_OP_STOP_DISCOVERY, EINVAL);
>> +             goto failed;
>> +     }
>> +
>> +     if (mgmt_pending_find(MGMT_OP_STOP_DISCOVERY, index)) {
>> +             err = cmd_status(sk, index, MGMT_OP_STOP_DISCOVERY,
>> +                                                             EINPROGRESS);
>> +             goto failed;
>> +     }
>
> So here is what I said. Doesn't it fix that sync issue?

No, it doesn't. This peice of code only prevents you from carrying out
a MGMT_OP_STOP_DISCOVERY when there is no ongoing discovery.
IOW, if there is no ongoing discovery then MGMT_OP_STOP_DISCOVERY
command should failed.

The race condition scenario described in 08/16 you have a ongoing
discovery and a MGMT_OP_STOP_DISCOVERY command is issued.
During stop_discovery() execution, after checking for pending
MGMT_OP_START_DISCOVERY command, an inquiry complete event is
raised.

Andre
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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