aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-04-12 11:57:53 -0400
committerDavid S. Miller <davem@davemloft.net>2016-04-12 11:57:53 -0400
commit69fb78121bf86c87490ea1453e310a39c320a70a (patch)
tree490484df49b2f3ad8d8cea6e4a9e27bc772ef99a
parent9a6f2b0113c8fce815db7c9d23754bdea4b428a0 (diff)
parent8805eea2494a2837983bc4aaaf6842c89666ec25 (diff)
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
Johan Hedberg says: ==================== pull request: bluetooth-next 2016-04-12 Here's a set of Bluetooth & 802.15.4 patches intended for the 4.7 kernel: - Fix for race condition in vhci driver - Memory leak fix for ieee802154/adf7242 driver - Improvements to deal with single-mode (LE-only) Bluetooth controllers - Fix for allowing the BT_SECURITY_FIPS security level - New BCM2E71 ACPI ID - NULL pointer dereference fix fox hci_ldisc driver Let me know if there are any issues pulling. Thanks. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/bluetooth/hci_bcm.c1
-rw-r--r--drivers/bluetooth/hci_bcsp.c57
-rw-r--r--drivers/bluetooth/hci_ldisc.c11
-rw-r--r--drivers/bluetooth/hci_uart.h1
-rw-r--r--drivers/bluetooth/hci_vhci.c9
-rw-r--r--drivers/net/ieee802154/adf7242.c2
-rw-r--r--net/6lowpan/iphc.c11
-rw-r--r--net/bluetooth/hci_event.c13
-rw-r--r--net/bluetooth/hci_request.c6
-rw-r--r--net/bluetooth/l2cap_sock.c2
10 files changed, 74 insertions, 39 deletions
diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
index d8881dc0600c..1c97eda8bae3 100644
--- a/drivers/bluetooth/hci_bcm.c
+++ b/drivers/bluetooth/hci_bcm.c
@@ -825,6 +825,7 @@ static const struct acpi_device_id bcm_acpi_match[] = {
825 { "BCM2E64", 0 }, 825 { "BCM2E64", 0 },
826 { "BCM2E65", 0 }, 826 { "BCM2E65", 0 },
827 { "BCM2E67", 0 }, 827 { "BCM2E67", 0 },
828 { "BCM2E71", 0 },
828 { "BCM2E7B", 0 }, 829 { "BCM2E7B", 0 },
829 { "BCM2E7C", 0 }, 830 { "BCM2E7C", 0 },
830 { }, 831 { },
diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
index 064f2fefad62..d7d23ceba4d1 100644
--- a/drivers/bluetooth/hci_bcsp.c
+++ b/drivers/bluetooth/hci_bcsp.c
@@ -102,13 +102,12 @@ static const u16 crc_table[] = {
102/* Initialise the crc calculator */ 102/* Initialise the crc calculator */
103#define BCSP_CRC_INIT(x) x = 0xffff 103#define BCSP_CRC_INIT(x) x = 0xffff
104 104
105/* 105/* Update crc with next data byte
106 Update crc with next data byte 106 *
107 107 * Implementation note
108 Implementation note 108 * The data byte is treated as two nibbles. The crc is generated
109 The data byte is treated as two nibbles. The crc is generated 109 * in reverse, i.e., bits are fed into the register from the top.
110 in reverse, i.e., bits are fed into the register from the top. 110 */
111*/
112static void bcsp_crc_update(u16 *crc, u8 d) 111static void bcsp_crc_update(u16 *crc, u8 d)
113{ 112{
114 u16 reg = *crc; 113 u16 reg = *crc;
@@ -223,9 +222,10 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,
223 } 222 }
224 223
225 /* Max len of packet: (original len +4(bcsp hdr) +2(crc))*2 224 /* Max len of packet: (original len +4(bcsp hdr) +2(crc))*2
226 (because bytes 0xc0 and 0xdb are escaped, worst case is 225 * (because bytes 0xc0 and 0xdb are escaped, worst case is
227 when the packet is all made of 0xc0 and 0xdb :) ) 226 * when the packet is all made of 0xc0 and 0xdb :) )
228 + 2 (0xc0 delimiters at start and end). */ 227 * + 2 (0xc0 delimiters at start and end).
228 */
229 229
230 nskb = alloc_skb((len + 6) * 2 + 2, GFP_ATOMIC); 230 nskb = alloc_skb((len + 6) * 2 + 2, GFP_ATOMIC);
231 if (!nskb) 231 if (!nskb)
@@ -285,7 +285,7 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
285 struct bcsp_struct *bcsp = hu->priv; 285 struct bcsp_struct *bcsp = hu->priv;
286 unsigned long flags; 286 unsigned long flags;
287 struct sk_buff *skb; 287 struct sk_buff *skb;
288 288
289 /* First of all, check for unreliable messages in the queue, 289 /* First of all, check for unreliable messages in the queue,
290 since they have priority */ 290 since they have priority */
291 291
@@ -305,8 +305,9 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
305 } 305 }
306 306
307 /* Now, try to send a reliable pkt. We can only send a 307 /* Now, try to send a reliable pkt. We can only send a
308 reliable packet if the number of packets sent but not yet ack'ed 308 * reliable packet if the number of packets sent but not yet ack'ed
309 is < than the winsize */ 309 * is < than the winsize
310 */
310 311
311 spin_lock_irqsave_nested(&bcsp->unack.lock, flags, SINGLE_DEPTH_NESTING); 312 spin_lock_irqsave_nested(&bcsp->unack.lock, flags, SINGLE_DEPTH_NESTING);
312 313
@@ -332,12 +333,14 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
332 spin_unlock_irqrestore(&bcsp->unack.lock, flags); 333 spin_unlock_irqrestore(&bcsp->unack.lock, flags);
333 334
334 /* We could not send a reliable packet, either because there are 335 /* We could not send a reliable packet, either because there are
335 none or because there are too many unack'ed pkts. Did we receive 336 * none or because there are too many unack'ed pkts. Did we receive
336 any packets we have not acknowledged yet ? */ 337 * any packets we have not acknowledged yet ?
338 */
337 339
338 if (bcsp->txack_req) { 340 if (bcsp->txack_req) {
339 /* if so, craft an empty ACK pkt and send it on BCSP unreliable 341 /* if so, craft an empty ACK pkt and send it on BCSP unreliable
340 channel 0 */ 342 * channel 0
343 */
341 struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, NULL, 0, BCSP_ACK_PKT); 344 struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, NULL, 0, BCSP_ACK_PKT);
342 return nskb; 345 return nskb;
343 } 346 }
@@ -399,8 +402,9 @@ static void bcsp_pkt_cull(struct bcsp_struct *bcsp)
399} 402}
400 403
401/* Handle BCSP link-establishment packets. When we 404/* Handle BCSP link-establishment packets. When we
402 detect a "sync" packet, symptom that the BT module has reset, 405 * detect a "sync" packet, symptom that the BT module has reset,
403 we do nothing :) (yet) */ 406 * we do nothing :) (yet)
407 */
404static void bcsp_handle_le_pkt(struct hci_uart *hu) 408static void bcsp_handle_le_pkt(struct hci_uart *hu)
405{ 409{
406 struct bcsp_struct *bcsp = hu->priv; 410 struct bcsp_struct *bcsp = hu->priv;
@@ -462,7 +466,7 @@ static inline void bcsp_unslip_one_byte(struct bcsp_struct *bcsp, unsigned char
462 case 0xdd: 466 case 0xdd:
463 memcpy(skb_put(bcsp->rx_skb, 1), &db, 1); 467 memcpy(skb_put(bcsp->rx_skb, 1), &db, 1);
464 if ((bcsp->rx_skb->data[0] & 0x40) != 0 && 468 if ((bcsp->rx_skb->data[0] & 0x40) != 0 &&
465 bcsp->rx_state != BCSP_W4_CRC) 469 bcsp->rx_state != BCSP_W4_CRC)
466 bcsp_crc_update(&bcsp->message_crc, 0xdb); 470 bcsp_crc_update(&bcsp->message_crc, 0xdb);
467 bcsp->rx_esc_state = BCSP_ESCSTATE_NOESC; 471 bcsp->rx_esc_state = BCSP_ESCSTATE_NOESC;
468 bcsp->rx_count--; 472 bcsp->rx_count--;
@@ -534,7 +538,7 @@ static void bcsp_complete_rx_pkt(struct hci_uart *hu)
534 } else { 538 } else {
535 BT_ERR("Packet for unknown channel (%u %s)", 539 BT_ERR("Packet for unknown channel (%u %s)",
536 bcsp->rx_skb->data[1] & 0x0f, 540 bcsp->rx_skb->data[1] & 0x0f,
537 bcsp->rx_skb->data[0] & 0x80 ? 541 bcsp->rx_skb->data[0] & 0x80 ?
538 "reliable" : "unreliable"); 542 "reliable" : "unreliable");
539 kfree_skb(bcsp->rx_skb); 543 kfree_skb(bcsp->rx_skb);
540 } 544 }
@@ -562,7 +566,7 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count)
562 struct bcsp_struct *bcsp = hu->priv; 566 struct bcsp_struct *bcsp = hu->priv;
563 const unsigned char *ptr; 567 const unsigned char *ptr;
564 568
565 BT_DBG("hu %p count %d rx_state %d rx_count %ld", 569 BT_DBG("hu %p count %d rx_state %d rx_count %ld",
566 hu, count, bcsp->rx_state, bcsp->rx_count); 570 hu, count, bcsp->rx_state, bcsp->rx_count);
567 571
568 ptr = data; 572 ptr = data;
@@ -591,7 +595,7 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count)
591 continue; 595 continue;
592 } 596 }
593 if (bcsp->rx_skb->data[0] & 0x80 /* reliable pkt */ 597 if (bcsp->rx_skb->data[0] & 0x80 /* reliable pkt */
594 && (bcsp->rx_skb->data[0] & 0x07) != bcsp->rxseq_txack) { 598 && (bcsp->rx_skb->data[0] & 0x07) != bcsp->rxseq_txack) {
595 BT_ERR("Out-of-order packet arrived, got %u expected %u", 599 BT_ERR("Out-of-order packet arrived, got %u expected %u",
596 bcsp->rx_skb->data[0] & 0x07, bcsp->rxseq_txack); 600 bcsp->rx_skb->data[0] & 0x07, bcsp->rxseq_txack);
597 601
@@ -601,7 +605,7 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count)
601 continue; 605 continue;
602 } 606 }
603 bcsp->rx_state = BCSP_W4_DATA; 607 bcsp->rx_state = BCSP_W4_DATA;
604 bcsp->rx_count = (bcsp->rx_skb->data[1] >> 4) + 608 bcsp->rx_count = (bcsp->rx_skb->data[1] >> 4) +
605 (bcsp->rx_skb->data[2] << 4); /* May be 0 */ 609 (bcsp->rx_skb->data[2] << 4); /* May be 0 */
606 continue; 610 continue;
607 611
@@ -615,7 +619,7 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count)
615 619
616 case BCSP_W4_CRC: 620 case BCSP_W4_CRC:
617 if (bitrev16(bcsp->message_crc) != bscp_get_crc(bcsp)) { 621 if (bitrev16(bcsp->message_crc) != bscp_get_crc(bcsp)) {
618 BT_ERR ("Checksum failed: computed %04x received %04x", 622 BT_ERR("Checksum failed: computed %04x received %04x",
619 bitrev16(bcsp->message_crc), 623 bitrev16(bcsp->message_crc),
620 bscp_get_crc(bcsp)); 624 bscp_get_crc(bcsp));
621 625
@@ -653,8 +657,9 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count)
653 BCSP_CRC_INIT(bcsp->message_crc); 657 BCSP_CRC_INIT(bcsp->message_crc);
654 658
655 /* Do not increment ptr or decrement count