All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] Bluetooth: hci_uart: Include vendor struct if required
@ 2015-06-17  4:59 Chan-yeol Park
  2015-06-17  4:59 ` [PATCH v2 2/2] Bluetooth: hci_uart: Fix dereferencing of ERR_PTR Chan-yeol Park
  0 siblings, 1 reply; 2+ messages in thread
From: Chan-yeol Park @ 2015-06-17  4:59 UTC (permalink / raw)
  To: linux-bluetooth

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

Signed-off-by: Chan-yeol Park <chanyeol.park@samsung.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH v2 2/2] Bluetooth: hci_uart: Fix dereferencing of ERR_PTR
  2015-06-17  4:59 [PATCH v2 1/2] Bluetooth: hci_uart: Include vendor struct if required Chan-yeol Park
@ 2015-06-17  4:59 ` Chan-yeol Park
  0 siblings, 0 replies; 2+ messages in thread
From: Chan-yeol Park @ 2015-06-17  4:59 UTC (permalink / raw)
  To: linux-bluetooth

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

Signed-off-by: Chan-yeol Park <chanyeol.park@samsung.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-17  4:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-17  4:59 [PATCH v2 1/2] Bluetooth: hci_uart: Include vendor struct if required Chan-yeol Park
2015-06-17  4:59 ` [PATCH v2 2/2] Bluetooth: hci_uart: Fix dereferencing of ERR_PTR Chan-yeol Park

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.