2015-06-17 04:59:08

by Chan-yeol Park

[permalink] [raw]
Subject: [PATCH v2 1/2] Bluetooth: hci_uart: Include vendor struct if required

Vendor specific structs should be included only when enabled because
hci_uart does not need it always.

Signed-off-by: Chan-yeol Park <[email protected]>
---
drivers/bluetooth/btbcm.h | 4 ++--
drivers/bluetooth/btintel.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/btbcm.h b/drivers/bluetooth/btbcm.h
index 02f5f96..ce6e15c 100644
--- a/drivers/bluetooth/btbcm.h
+++ b/drivers/bluetooth/btbcm.h
@@ -21,6 +21,8 @@
*
*/

+#if IS_ENABLED(CONFIG_BT_BCM)
+
#define BCM_UART_CLOCK_48MHZ 0x01
#define BCM_UART_CLOCK_24MHZ 0x02

@@ -33,8 +35,6 @@ struct bcm_write_uart_clock_setting {
__u8 type;
} __packed;

-#if IS_ENABLED(CONFIG_BT_BCM)
-
int btbcm_check_bdaddr(struct hci_dev *hdev);
int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw);
diff --git a/drivers/bluetooth/btintel.h b/drivers/bluetooth/btintel.h
index 4bda6ab..f92a9cf 100644
--- a/drivers/bluetooth/btintel.h
+++ b/drivers/bluetooth/btintel.h
@@ -21,6 +21,8 @@
*
*/

+#if IS_ENABLED(CONFIG_BT_INTEL)
+
struct intel_version {
u8 status;
u8 hw_platform;
@@ -69,8 +71,6 @@ struct intel_secure_send_result {
__u8 status;
} __packed;

-#if IS_ENABLED(CONFIG_BT_INTEL)
-
int btintel_check_bdaddr(struct hci_dev *hdev);
int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);

--
2.1.4



2015-06-17 04:59:09

by Chan-yeol Park

[permalink] [raw]
Subject: [PATCH v2 2/2] Bluetooth: hci_uart: Fix dereferencing of ERR_PTR

If h4_recv_buff() return ERR_PTR, h4->rx_skb should not be dereferenced.

Signed-off-by: Chan-yeol Park <[email protected]>
---
drivers/bluetooth/hci_h4.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c
index f7190f0..54116464 100644
--- a/drivers/bluetooth/hci_h4.c
+++ b/drivers/bluetooth/hci_h4.c
@@ -92,7 +92,8 @@ static int h4_close(struct hci_uart *hu)

skb_queue_purge(&h4->txq);

- kfree_skb(h4->rx_skb);
+ if (!IS_ERR(h4->rx_skb))
+ kfree_skb(h4->rx_skb);

hu->priv = NULL;
kfree(h4);
@@ -173,7 +174,7 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
while (count) {
int i, len;

- if (!skb) {
+ if (IS_ERR_OR_NULL(skb)) {
for (i = 0; i < pkts_count; i++) {
if (buffer[0] != (&pkts[i])->type)
continue;
--
2.1.4