aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2015-03-28 18:18:58 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2015-03-29 00:57:00 -0400
commitefcd8c98e0d195c09fd9141a7af32dd83e62a5cb (patch)
tree0c0f3dee6fab6c0c21b0caa4acac39d95159f79d /net
parent880897d4c9eedd69b33b9905a6919e3e4f58eae8 (diff)
Bluetooth: Move memory location outside of hci_dev lock
Taking the hci_dev lock for just a memory allocation seems a bit too much and not really needed. So instead try to allocate the memory first and then take the lock. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/mgmt.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 29cbd98f4649..a9a0036ff0a7 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -6446,14 +6446,12 @@ static int read_local_oob_ext_data(struct sock *sk, struct hci_dev *hdev,
6446 &cp->type, sizeof(cp->type)); 6446 &cp->type, sizeof(cp->type));
6447 } 6447 }
6448 6448
6449 hci_dev_lock(hdev);
6450
6451 rp_len = sizeof(*rp) + eir_len; 6449 rp_len = sizeof(*rp) + eir_len;
6452 rp = kmalloc(rp_len, GFP_ATOMIC); 6450 rp = kmalloc(rp_len, GFP_ATOMIC);
6453 if (!rp) { 6451 if (!rp)
6454 hci_dev_unlock(hdev);
6455 return -ENOMEM; 6452 return -ENOMEM;
6456 } 6453
6454 hci_dev_lock(hdev);
6457 6455
6458 eir_len = 0; 6456 eir_len = 0;
6459 switch (cp->type) { 6457 switch (cp->type) {
@@ -6517,13 +6515,13 @@ static int read_local_oob_ext_data(struct sock *sk, struct hci_dev *hdev,
6517 break; 6515 break;
6518 } 6516 }
6519 6517
6520 rp->type = cp->type;
6521 rp->eir_len = cpu_to_le16(eir_len);
6522
6523 hci_dev_unlock(hdev); 6518 hci_dev_unlock(hdev);
6524 6519
6525 hci_sock_set_flag(sk, HCI_MGMT_OOB_DATA_EVENTS); 6520 hci_sock_set_flag(sk, HCI_MGMT_OOB_DATA_EVENTS);
6526 6521
6522 rp->type = cp->type;
6523 rp->eir_len = cpu_to_le16(eir_len);
6524
6527 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_EXT_DATA, 6525 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_EXT_DATA,
6528 MGMT_STATUS_SUCCESS, rp, sizeof(*rp) + eir_len); 6526 MGMT_STATUS_SUCCESS, rp, sizeof(*rp) + eir_len);
6529 if (err < 0) 6527 if (err < 0)