From ddee3103eeafd1d9dbe831274c3813d5cac30bc3 Mon Sep 17 00:00:00 2001 From: stephen hemminger Date: Tue, 18 Jul 2017 15:59:25 -0700 Subject: bluetooth: 6lowpan dev_close never returns error The function dev_close in current kernel will never return an error. Later changes will make it void. Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller --- net/bluetooth/6lowpan.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'net/bluetooth') diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c index ab3b654b05cc..2af4f1cc0ab4 100644 --- a/net/bluetooth/6lowpan.c +++ b/net/bluetooth/6lowpan.c @@ -618,12 +618,8 @@ static void ifup(struct net_device *netdev) static void ifdown(struct net_device *netdev) { - int err; - rtnl_lock(); - err = dev_close(netdev); - if (err < 0) - BT_INFO("iface %s cannot be closed (%d)", netdev->name, err); + dev_close(netdev); rtnl_unlock(); } -- cgit v1.2.3 From ce7426ca70de80b4a8c9ada8f14ce6d651cccf5e Mon Sep 17 00:00:00 2001 From: stephen hemminger Date: Mon, 24 Jul 2017 10:25:23 -0700 Subject: 6lowpan: fix set not used warning Signed-off-by: Stephen Hemminger Acked-by: Luiz Augusto von Dentz Signed-off-by: David S. Miller --- net/bluetooth/6lowpan.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'net/bluetooth') diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c index 2af4f1cc0ab4..4e2576fc0c59 100644 --- a/net/bluetooth/6lowpan.c +++ b/net/bluetooth/6lowpan.c @@ -273,9 +273,6 @@ static int iphc_decompress(struct sk_buff *skb, struct net_device *netdev, struct lowpan_peer *peer) { const u8 *saddr; - struct lowpan_btle_dev *dev; - - dev = lowpan_btle_dev(netdev); saddr = peer->lladdr; -- cgit v1.2.3 From 198ec9ae052922d67491ab3cc3fd704580e0daf4 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Tue, 8 Aug 2017 15:48:40 +0200 Subject: Bluetooth: document config options Kernel config options should include useful help text; I had to look up the terms on wikipedia. Signed-off-by: Pavel Machek Signed-off-by: Marcel Holtmann --- net/bluetooth/Kconfig | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'net/bluetooth') diff --git a/net/bluetooth/Kconfig b/net/bluetooth/Kconfig index 68f951b3e85a..db82a40875e8 100644 --- a/net/bluetooth/Kconfig +++ b/net/bluetooth/Kconfig @@ -45,6 +45,11 @@ config BT_BREDR bool "Bluetooth Classic (BR/EDR) features" depends on BT default y + help + Bluetooth Classic includes support for Basic Rate (BR) + available with Bluetooth version 1.0b or later and support + for Enhanced Data Rate (EDR) available with Bluetooth + version 2.0 or later. source "net/bluetooth/rfcomm/Kconfig" @@ -58,11 +63,18 @@ config BT_HS bool "Bluetooth High Speed (HS) features" depends on BT_BREDR default y + help + Bluetooth High Speed includes support for off-loading + Bluetooth connections via 802.11 (wifi) physical layer + available with Bluetooth version 3.0 or later. config BT_LE bool "Bluetooth Low Energy (LE) features" depends on BT default y + help + Bluetooth Low Energy includes support low-energy physical + layer available with Bluetooth version 4.0 or later. config BT_6LOWPAN tristate "Bluetooth 6LoWPAN support" -- cgit v1.2.3 From 3dfe55d9cae7413c1bd12cbc0f9145384f753014 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Fri, 11 Aug 2017 19:33:04 +0100 Subject: Bluetooth: kfree tmp rather than an alias to it While the kfree of dhkey_a is of the same address of tmp, it probably is clearer and more human readable if tmp is kfree'd rather than dhkey_a. Detected by CoverityScan, CID#1448650 ("Free of address-of expression") Signed-off-by: Colin Ian King Signed-off-by: Marcel Holtmann --- net/bluetooth/selftest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net/bluetooth') diff --git a/net/bluetooth/selftest.c b/net/bluetooth/selftest.c index ee92c925ecc5..34a1227f4391 100644 --- a/net/bluetooth/selftest.c +++ b/net/bluetooth/selftest.c @@ -164,7 +164,7 @@ static int __init test_ecdh_sample(const u8 priv_a[32], const u8 priv_b[32], ret = -EINVAL; out: - kfree(dhkey_a); + kfree(tmp); return ret; } -- cgit v1.2.3 From 9374bf18dbb533912898b07b3751fbce40fae5c4 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sat, 19 Aug 2017 14:54:47 +0530 Subject: Bluetooth: make device_type const Make these const as they are only stored in the type field of a device structure, which is const. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Marcel Holtmann --- net/bluetooth/hci_sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'net/bluetooth') diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index ca7a35ebaefb..aa300f3a0d51 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -13,7 +13,7 @@ static void bt_link_release(struct device *dev) kfree(conn); } -static struct device_type bt_link = { +static const struct device_type bt_link = { .name = "link", .release = bt_link_release, }; @@ -86,7 +86,7 @@ static void bt_host_release(struct device *dev) module_put(THIS_MODULE); } -static struct device_type bt_host = { +static const struct device_type bt_host = { .name = "host", .release = bt_host_release, }; -- cgit v1.2.3 From dbbccdc4ced015cdd4051299bd87fbe0254ad351 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 21 Aug 2017 01:29:08 -0700 Subject: Bluetooth: Add option for disabling legacy ioctl interfaces The legacy ioctl interfaces are only useful for BR/EDR operation and since Linux 3.4 no longer needed anyway. This options allows disabling them alltogether and use only management interfaces for setup and control. Signed-off-by: Marcel Holtmann Signed-off-by: Johan Hedberg --- net/bluetooth/Kconfig | 10 ++++++++++ net/bluetooth/hci_sock.c | 6 ++++++ 2 files changed, 16 insertions(+) (limited to 'net/bluetooth') diff --git a/net/bluetooth/Kconfig b/net/bluetooth/Kconfig index db82a40875e8..c18115d22f00 100644 --- a/net/bluetooth/Kconfig +++ b/net/bluetooth/Kconfig @@ -126,4 +126,14 @@ config BT_DEBUGFS Provide extensive information about internal Bluetooth states in debugfs. +config BT_LEGACY_IOCTL + bool "Enable legacy ioctl interfaces" + depends on BT && BT_BREDR + default y + help + Enable support for legacy ioctl interfaces. This is only needed + for old and deprecated applications using direct ioctl calls for + controller management. Since Linux 3.4 all configuration and + setup is done via mgmt interface and this is no longer needed. + source "drivers/bluetooth/Kconfig" diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 65d734c165bd..0bad296fe0af 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -878,6 +878,7 @@ static int hci_sock_release(struct socket *sock) return 0; } +#ifdef CONFIG_BT_LEGACY_IOCTL static int hci_sock_blacklist_add(struct hci_dev *hdev, void __user *arg) { bdaddr_t bdaddr; @@ -1049,6 +1050,7 @@ done: release_sock(sk); return err; } +#endif static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) @@ -1969,7 +1971,11 @@ static const struct proto_ops hci_sock_ops = { .getname = hci_sock_getname, .sendmsg = hci_sock_sendmsg, .recvmsg = hci_sock_recvmsg, +#ifdef CONFIG_BT_LEGACY_IOCTL .ioctl = hci_sock_ioctl, +#else + .ioctl = sock_no_ioctl, +#endif .poll = datagram_poll, .listen = sock_no_listen, .shutdown = sock_no_shutdown, -- cgit v1.2.3 From 65bce46298d064dff9db1282e17bb26602715819 Mon Sep 17 00:00:00 2001 From: Loic Poulain Date: Fri, 1 Sep 2017 13:41:17 -0700 Subject: Bluetooth: make baswap src const Signed-off-by: Loic Poulain Signed-off-by: Bjorn Andersson Signed-off-by: Marcel Holtmann --- net/bluetooth/lib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'net/bluetooth') diff --git a/net/bluetooth/lib.c b/net/bluetooth/lib.c index aa4cf64e32a6..63e65d9b4b24 100644 --- a/net/bluetooth/lib.c +++ b/net/bluetooth/lib.c @@ -30,10 +30,10 @@ #include -void baswap(bdaddr_t *dst, bdaddr_t *src) +void baswap(bdaddr_t *dst, const bdaddr_t *src) { - unsigned char *d = (unsigned char *) dst; - unsigned char *s = (unsigned char *) src; + const unsigned char *s = (const unsigned char *)src; + unsigned char *d = (unsigned char *)dst; unsigned int i; for (i = 0; i < 6; i++) -- cgit v1.2.3