Skip to content

Commit 0ba3deb

Browse files
committed
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-07-13 Here's our main bluetooth-next pull request for the 4.8 kernel: - Fixes and cleanups in 802.15.4 and 6LoWPAN code - Fix out of bounds issue in btmrvl driver - Fixes to Bluetooth socket recvmsg return values - Use crypto_cipher_encrypt_one() instead of crypto_skcipher - Cleanup of Bluetooth connection sysfs interface - New Authentication failure reson code for Disconnected mgmt event - New USB IDs for Atheros, Qualcomm and Intel Bluetooth controllers Please let me know if there are any issues pulling. Thanks. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 6e07653 + 8751097 commit 0ba3deb

33 files changed

+423
-230
lines changed

drivers/bluetooth/ath3k.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ static const struct usb_device_id ath3k_table[] = {
123123
{ USB_DEVICE(0x13d3, 0x3472) },
124124
{ USB_DEVICE(0x13d3, 0x3474) },
125125
{ USB_DEVICE(0x13d3, 0x3487) },
126+
{ USB_DEVICE(0x13d3, 0x3490) },
126127

127128
/* Atheros AR5BBU12 with sflash firmware */
128129
{ USB_DEVICE(0x0489, 0xE02C) },
@@ -190,6 +191,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = {
190191
{ USB_DEVICE(0x13d3, 0x3472), .driver_info = BTUSB_ATH3012 },
191192
{ USB_DEVICE(0x13d3, 0x3474), .driver_info = BTUSB_ATH3012 },
192193
{ USB_DEVICE(0x13d3, 0x3487), .driver_info = BTUSB_ATH3012 },
194+
{ USB_DEVICE(0x13d3, 0x3490), .driver_info = BTUSB_ATH3012 },
193195

194196
/* Atheros AR5BBU22 with sflash firmware */
195197
{ USB_DEVICE(0x0489, 0xE036), .driver_info = BTUSB_ATH3012 },

drivers/bluetooth/btmrvl_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
138138
if (event->length > 3 && event->data[3])
139139
priv->btmrvl_dev.dev_type = HCI_AMP;
140140
else
141-
priv->btmrvl_dev.dev_type = HCI_BREDR;
141+
priv->btmrvl_dev.dev_type = HCI_PRIMARY;
142142

143143
BT_DBG("dev_type: %d", priv->btmrvl_dev.dev_type);
144144
} else if (priv->btmrvl_dev.sendcmdflag &&

drivers/bluetooth/btmrvl_sdio.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,6 @@ static int btmrvl_sdio_host_to_card(struct btmrvl_private *priv,
10711071
{
10721072
struct btmrvl_sdio_card *card = priv->btmrvl_dev.card;
10731073
int ret = 0;
1074-
int buf_block_len;
10751074
int blksz;
10761075
int i = 0;
10771076
u8 *buf = NULL;
@@ -1083,25 +1082,26 @@ static int btmrvl_sdio_host_to_card(struct btmrvl_private *priv,
10831082
return -EINVAL;
10841083
}
10851084

1085+
blksz = DIV_ROUND_UP(nb, SDIO_BLOCK_SIZE) * SDIO_BLOCK_SIZE;
1086+
10861087
buf = payload;
1087-
if ((unsigned long) payload & (BTSDIO_DMA_ALIGN - 1)) {
1088-
tmpbufsz = ALIGN_SZ(nb, BTSDIO_DMA_ALIGN);
1088+
if ((unsigned long) payload & (BTSDIO_DMA_ALIGN - 1) ||
1089+
nb < blksz) {
1090+
tmpbufsz = ALIGN_SZ(blksz, BTSDIO_DMA_ALIGN) +
1091+
BTSDIO_DMA_ALIGN;
10891092
tmpbuf = kzalloc(tmpbufsz, GFP_KERNEL);
10901093
if (!tmpbuf)
10911094
return -ENOMEM;
10921095
buf = (u8 *) ALIGN_ADDR(tmpbuf, BTSDIO_DMA_ALIGN);
10931096
memcpy(buf, payload, nb);
10941097
}
10951098

1096-
blksz = SDIO_BLOCK_SIZE;
1097-
buf_block_len = DIV_ROUND_UP(nb, blksz);
1098-
10991099
sdio_claim_host(card->func);
11001100

11011101
do {
11021102
/* Transfer data to card */
11031103
ret = sdio_writesb(card->func, card->ioport, buf,
1104-
buf_block_len * blksz);
1104+
blksz);
11051105
if (ret < 0) {
11061106
i++;
11071107
BT_ERR("i=%d writesb failed: %d", i, ret);

drivers/bluetooth/btsdio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static int btsdio_probe(struct sdio_func *func,
311311
if (id->class == SDIO_CLASS_BT_AMP)
312312
hdev->dev_type = HCI_AMP;
313313
else
314-
hdev->dev_type = HCI_BREDR;
314+
hdev->dev_type = HCI_PRIMARY;
315315

316316
data->hdev = hdev;
317317

drivers/bluetooth/btusb.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ static const struct usb_device_id blacklist_table[] = {
237237
{ USB_DEVICE(0x13d3, 0x3472), .driver_info = BTUSB_ATH3012 },
238238
{ USB_DEVICE(0x13d3, 0x3474), .driver_info = BTUSB_ATH3012 },
239239
{ USB_DEVICE(0x13d3, 0x3487), .driver_info = BTUSB_ATH3012 },
240+
{ USB_DEVICE(0x13d3, 0x3490), .driver_info = BTUSB_ATH3012 },
240241

241242
/* Atheros AR5BBU12 with sflash firmware */
242243
{ USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },
@@ -249,6 +250,7 @@ static const struct usb_device_id blacklist_table[] = {
249250
{ USB_DEVICE(0x0cf3, 0xe007), .driver_info = BTUSB_QCA_ROME },
250251
{ USB_DEVICE(0x0cf3, 0xe300), .driver_info = BTUSB_QCA_ROME },
251252
{ USB_DEVICE(0x0cf3, 0xe360), .driver_info = BTUSB_QCA_ROME },
253+
{ USB_DEVICE(0x0489, 0xe092), .driver_info = BTUSB_QCA_ROME },
252254

253255
/* Broadcom BCM2035 */
254256
{ USB_DEVICE(0x0a5c, 0x2009), .driver_info = BTUSB_BCM92035 },
@@ -314,6 +316,7 @@ static const struct usb_device_id blacklist_table[] = {
314316
{ USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL },
315317
{ USB_DEVICE(0x8087, 0x0a2a), .driver_info = BTUSB_INTEL },
316318
{ USB_DEVICE(0x8087, 0x0a2b), .driver_info = BTUSB_INTEL_NEW },
319+
{ USB_DEVICE(0x8087, 0x0aa7), .driver_info = BTUSB_INTEL },
317320

318321
/* Other Intel Bluetooth devices */
319322
{ USB_VENDOR_AND_INTERFACE_INFO(0x8087, 0xe0, 0x01, 0x01),
@@ -2103,10 +2106,14 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
21032106
/* With this Intel bootloader only the hardware variant and device
21042107
* revision information are used to select the right firmware.
21052108
*
2106-
* Currently this bootloader support is limited to hardware variant
2107-
* iBT 3.0 (LnP/SfP) which is identified by the value 11 (0x0b).
2109+
* The firmware filename is ibt-<hw_variant>-<dev_revid>.sfi.
2110+
*
2111+
* Currently the supported hardware variants are:
2112+
* 11 (0x0b) for iBT3.0 (LnP/SfP)
2113+
* 12 (0x0c) for iBT3.5 (WsP)
21082114
*/
2109-
snprintf(fwname, sizeof(fwname), "intel/ibt-11-%u.sfi",
2115+
snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u.sfi",
2116+
le16_to_cpu(ver.hw_variant),
21102117
le16_to_cpu(params->dev_revid));
21112118

21122119
err = request_firmware(&fw, fwname, &hdev->dev);
@@ -2122,7 +2129,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
21222129
/* Save the DDC file name for later use to apply once the firmware
21232130
* downloading is done.
21242131
*/
2125-
snprintf(fwname, sizeof(fwname), "intel/ibt-11-%u.ddc",
2132+
snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u.ddc",
2133+
le16_to_cpu(ver.hw_variant),
21262134
le16_to_cpu(params->dev_revid));
21272135

21282136
kfree_skb(skb);
@@ -2825,7 +2833,7 @@ static int btusb_probe(struct usb_interface *intf,
28252833
if (id->driver_info & BTUSB_AMP)
28262834
hdev->dev_type = HCI_AMP;
28272835
else
2828-
hdev->dev_type = HCI_BREDR;
2836+
hdev->dev_type = HCI_PRIMARY;
28292837

28302838
data->hdev = hdev;
28312839

drivers/bluetooth/hci_intel.c

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,7 @@ static int intel_setup(struct hci_uart *hu)
537537
{
538538
static const u8 reset_param[] = { 0x00, 0x01, 0x00, 0x01,
539539
0x00, 0x08, 0x04, 0x00 };
540-
static const u8 lpm_param[] = { 0x03, 0x07, 0x01, 0x0b };
541540
struct intel_data *intel = hu->priv;
542-
struct intel_device *idev = NULL;
543541
struct hci_dev *hdev = hu->hdev;
544542
struct sk_buff *skb;
545543
struct intel_version ver;
@@ -884,35 +882,23 @@ static int intel_setup(struct hci_uart *hu)
884882

885883
bt_dev_info(hdev, "Device booted in %llu usecs", duration);
886884

887-
/* Enable LPM if matching pdev with wakeup enabled */
885+
/* Enable LPM if matching pdev with wakeup enabled, set TX active
886+
* until further LPM TX notification.
887+
*/
888888
mutex_lock(&intel_device_list_lock);
889889
list_for_each(p, &intel_device_list) {
890890
struct intel_device *dev = list_entry(p, struct intel_device,
891891
list);
892892
if (hu->tty->dev->parent == dev->pdev->dev.parent) {
893-
if (device_may_wakeup(&dev->pdev->dev))
894-
idev = dev;
893+
if (device_may_wakeup(&dev->pdev->dev)) {
894+
set_bit(STATE_LPM_ENABLED, &intel->flags);
895+
set_bit(STATE_TX_ACTIVE, &intel->flags);
896+
}
895897
break;
896898
}
897899
}
898900
mutex_unlock(&intel_device_list_lock);
899901

900-
if (!idev)
901-
goto no_lpm;
902-
903-
bt_dev_info(hdev, "Enabling LPM");
904-
905-
skb = __hci_cmd_sync(hdev, 0xfc8b, sizeof(lpm_param), lpm_param,
906-
HCI_CMD_TIMEOUT);
907-
if (IS_ERR(skb)) {
908-
bt_dev_err(hdev, "Failed to enable LPM");
909-
goto no_lpm;
910-
}
911-
kfree_skb(skb);
912-
913-
set_bit(STATE_LPM_ENABLED, &intel->flags);
914-
915-
no_lpm:
916902
/* Ignore errors, device can work without DDC parameters */
917903
btintel_load_ddc_config(hdev, fwname);
918904

drivers/bluetooth/hci_ldisc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ static int hci_uart_register_dev(struct hci_uart *hu)
609609
if (test_bit(HCI_UART_CREATE_AMP, &hu->hdev_flags))
610610
hdev->dev_type = HCI_AMP;
611611
else
612-
hdev->dev_type = HCI_BREDR;
612+
hdev->dev_type = HCI_PRIMARY;
613613

614614
if (test_bit(HCI_UART_INIT_PENDING, &hu->hdev_flags))
615615
return 0;

drivers/bluetooth/hci_vhci.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ static int __vhci_create_device(struct vhci_data *data, __u8 opcode)
9797
if (data->hdev)
9898
return -EBADFD;
9999

100-
/* bits 0-1 are dev_type (BR/EDR or AMP) */
100+
/* bits 0-1 are dev_type (Primary or AMP) */
101101
dev_type = opcode & 0x03;
102102

103-
if (dev_type != HCI_BREDR && dev_type != HCI_AMP)
103+
if (dev_type != HCI_PRIMARY && dev_type != HCI_AMP)
104104
return -EINVAL;
105105

106106
/* bits 2-5 are reserved (must be zero) */
@@ -316,7 +316,7 @@ static void vhci_open_timeout(struct work_struct *work)
316316
struct vhci_data *data = container_of(work, struct vhci_data,
317317
open_timeout.work);
318318

319-
vhci_create_device(data, amp ? HCI_AMP : HCI_BREDR);
319+
vhci_create_device(data, amp ? HCI_AMP : HCI_PRIMARY);
320320
}
321321

322322
static int vhci_open(struct inode *inode, struct file *file)

drivers/net/ieee802154/atusb.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,7 @@ static int atusb_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
366366
struct atusb *atusb = hw->priv;
367367
int ret;
368368

369-
/* This implicitly sets the CCA (Clear Channel Assessment) mode to 0,
370-
* "Mode 3a, Carrier sense OR energy above threshold".
371-
* We should probably make this configurable. @@@
372-
*/
373-
ret = atusb_write_reg(atusb, RG_PHY_CC_CCA, channel);
369+
ret = atusb_write_subreg(atusb, SR_CHANNEL, channel);
374370
if (ret < 0)
375371
return ret;
376372
msleep(1); /* @@@ ugly synchronization */

drivers/net/ieee802154/fakelb.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,20 @@ static void fakelb_hw_stop(struct ieee802154_hw *hw)
112112
write_unlock_bh(&fakelb_ifup_phys_lock);
113113
}
114114

115+
static int
116+
fakelb_set_promiscuous_mode(struct ieee802154_hw *hw, const bool on)
117+
{
118+
return 0;
119+
}
120+
115121
static const struct ieee802154_ops fakelb_ops = {
116122
.owner = THIS_MODULE,
117123
.xmit_async = fakelb_hw_xmit,
118124
.ed = fakelb_hw_ed,
119125
.set_channel = fakelb_hw_channel,
120126
.start = fakelb_hw_start,
121127
.stop = fakelb_hw_stop,
128+
.set_promiscuous_mode = fakelb_set_promiscuous_mode,
122129
};
123130

124131
/* Number of dummy devices to be set up by this module. */
@@ -174,6 +181,7 @@ static int fakelb_add_one(struct device *dev)
174181
hw->phy->current_channel = 13;
175182
phy->channel = hw->phy->current_channel;
176183

184+
hw->flags = IEEE802154_HW_PROMISCUOUS;
177185
hw->parent = dev;
178186

179187
err = ieee802154_register_hw(hw);

drivers/net/ieee802154/mrf24j40.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,8 @@ static irqreturn_t mrf24j40_isr(int irq, void *data)
10541054
disable_irq_nosync(irq);
10551055

10561056
devrec->irq_buf[0] = MRF24J40_READSHORT(REG_INTSTAT);
1057+
devrec->irq_buf[1] = 0;
1058+
10571059
/* Read the interrupt status */
10581060
ret = spi_async(devrec->spi, &devrec->irq_msg);
10591061
if (ret) {

include/linux/ieee802154.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#define IEEE802154_MIN_PSDU_LEN 9
3232
#define IEEE802154_FCS_LEN 2
3333
#define IEEE802154_MAX_AUTH_TAG_LEN 16
34+
#define IEEE802154_FC_LEN 2
35+
#define IEEE802154_SEQ_LEN 1
3436

3537
/* General MAC frame format:
3638
* 2 bytes: Frame Control
@@ -48,6 +50,7 @@
4850

4951
#define IEEE802154_EXTENDED_ADDR_LEN 8
5052
#define IEEE802154_SHORT_ADDR_LEN 2
53+
#define IEEE802154_PAN_ID_LEN 2
5154

5255
#define IEEE802154_LIFS_PERIOD 40
5356
#define IEEE802154_SIFS_PERIOD 12
@@ -221,9 +224,17 @@ enum {
221224
#define IEEE802154_FCTL_ACKREQ 0x0020
222225
#define IEEE802154_FCTL_SECEN 0x0004
223226
#define IEEE802154_FCTL_INTRA_PAN 0x0040
227+
#define IEEE802154_FCTL_DADDR 0x0c00
228+
#define IEEE802154_FCTL_SADDR 0xc000
224229

225230
#define IEEE802154_FTYPE_DATA 0x0001
226231

232+
#define IEEE802154_FCTL_ADDR_NONE 0x0000
233+
#define IEEE802154_FCTL_DADDR_SHORT 0x0800
234+
#define IEEE802154_FCTL_DADDR_EXTENDED 0x0c00
235+
#define IEEE802154_FCTL_SADDR_SHORT 0x8000
236+
#define IEEE802154_FCTL_SADDR_EXTENDED 0xc000
237+
227238
/*
228239
* ieee802154_is_data - check if type is IEEE802154_FTYPE_DATA
229240
* @fc: frame control bytes in little-endian byteorder
@@ -261,6 +272,24 @@ static inline bool ieee802154_is_intra_pan(__le16 fc)
261272
return fc & cpu_to_le16(IEEE802154_FCTL_INTRA_PAN);
262273
}
263274

275+
/*
276+
* ieee802154_daddr_mode - get daddr mode from fc
277+
* @fc: frame control bytes in little-endian byteorder
278+
*/
279+
static inline __le16 ieee802154_daddr_mode(__le16 fc)
280+
{
281+
return fc & cpu_to_le16(IEEE802154_FCTL_DADDR);
282+
}
283+
284+
/*
285+
* ieee802154_saddr_mode - get saddr mode from fc
286+
* @fc: frame control bytes in little-endian byteorder
287+
*/
288+
static inline __le16 ieee802154_saddr_mode(__le16 fc)
289+
{
290+
return fc & cpu_to_le16(IEEE802154_FCTL_SADDR);
291+
}
292+
264293
/**
265294
* ieee802154_is_valid_psdu_len - check if psdu len is valid
266295
* available lengths:

include/net/bluetooth/hci.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
#define HCI_I2C 8
6666

6767
/* HCI controller types */
68-
#define HCI_BREDR 0x00
68+
#define HCI_PRIMARY 0x00
6969
#define HCI_AMP 0x01
7070

7171
/* First BR/EDR Controller shall have ID = 0 */
@@ -445,6 +445,7 @@ enum {
445445
/* ---- HCI Error Codes ---- */
446446
#define HCI_ERROR_UNKNOWN_CONN_ID 0x02
447447
#define HCI_ERROR_AUTH_FAILURE 0x05
448+
#define HCI_ERROR_PIN_OR_KEY_MISSING 0x06
448449
#define HCI_ERROR_MEMORY_EXCEEDED 0x07
449450
#define HCI_ERROR_CONNECTION_TIMEOUT 0x08
450451
#define HCI_ERROR_REJ_LIMITED_RESOURCES 0x0d

include/net/bluetooth/hci_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ enum {
654654
HCI_CONN_PARAM_REMOVAL_PEND,
655655
HCI_CONN_NEW_LINK_KEY,
656656
HCI_CONN_SCANNING,
657+
HCI_CONN_AUTH_FAILURE,
657658
};
658659

659660
static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)

include/net/bluetooth/mgmt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ struct mgmt_ev_device_connected {
645645
#define MGMT_DEV_DISCONN_TIMEOUT 0x01
646646
#define MGMT_DEV_DISCONN_LOCAL_HOST 0x02
647647
#define MGMT_DEV_DISCONN_REMOTE 0x03
648+
#define MGMT_DEV_DISCONN_AUTH_FAILURE 0x04
648649

649650
#define MGMT_EV_DEVICE_DISCONNECTED 0x000C
650651
struct mgmt_ev_device_disconnected {

include/net/cfg802154.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,22 @@ struct wpan_phy {
219219

220220
struct device dev;
221221

222+
/* the network namespace this phy lives in currently */
223+
possible_net_t _net;
224+
222225
char priv[0] __aligned(NETDEV_ALIGN);
223226
};
224227

228+
static inline struct net *wpan_phy_net(struct wpan_phy *wpan_phy)
229+
{
230+
return read_pnet(&wpan_phy->_net);
231+
}
232+
233+
static inline void wpan_phy_net_set(struct wpan_phy *wpan_phy, struct net *net)
234+
{
235+
write_pnet(&wpan_phy->_net, net);
236+
}
237+
225238
struct ieee802154_addr {
226239
u8 mode;
227240
__le16 pan_id;

0 commit comments

Comments
 (0)