Re: [PATCH 2/2 v1] Bluetooth: Fix missing hci_dev_lock/unlock in hci_event

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

 



Hi Jaganath,

On Thu, Dec 11, 2014, Jaganath Kanakkassery wrote:
>  static void hci_cc_read_local_version(struct hci_dev *hdev, struct sk_buff *skb)
> @@ -1172,11 +1184,14 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
>  		 * re-enable it again if necessary.
>  		 */
>  		if (test_and_clear_bit(HCI_LE_SCAN_INTERRUPTED,
> -				       &hdev->dev_flags))
> +				       &hdev->dev_flags)) {
> +			hci_dev_lock(hdev);
>  			hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
> -		else if (!test_bit(HCI_LE_ADV, &hdev->dev_flags) &&
> -			 hdev->discovery.state == DISCOVERY_FINDING)
> +			hci_dev_unlock(hdev);
> +		} else if (!test_bit(HCI_LE_ADV, &hdev->dev_flags) &&
> +			   hdev->discovery.state == DISCOVERY_FINDING) {
>  			mgmt_reenable_advertising(hdev);
> +		}
>  
>  		break;

Both patches look good to me, except for this part. It seems to me this
function is doing lots of things which should be under the hdev lock.
I'd put the lock() before the switch statement and the unlock after it.

Johan
--
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