Skip to contentSkip to conversation

Patch "Bluetooth: hci_intel: Fix null gpio desc pointer dereference" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Aug 18, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

Bluetooth: hci_intel: Fix null gpio desc pointer dereference

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
bluetooth-hci_intel-fix-null-gpio-desc-pointer-dereference.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 32b9ccbc3522811c0e483637b85ae25f5491296f Mon Sep 17 00:00:00 2001

From: Loic Poulain <[email protected]>
Date: Thu, 28 Apr 2016 18:48:25 +0200
Subject: Bluetooth: hci_intel: Fix null gpio desc pointer dereference

From: Loic Poulain <[email protected]>

commit 32b9ccbc3522811c0e483637b85ae25f5491296f upstream.

gpiod_get_optional can return either ERR_PTR or NULL pointer. NULL case is not tested and then dereferenced later in desc_to_gpio. Fix this by using non optional version which returns ERR_PTR in any error case (this is not an optional gpio).
Use the same non optional version for the host-wake gpio.

Fixes 765ea3abd116 ("Bluetooth: hci_intel: Retrieve host-wake IRQ")
---
 drivers/bluetooth/hci_intel.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/bluetooth/hci_intel.c +2 -4
@@ -1234,8 +1234,7 @@ static int intel_probe(struct platform_d
 
 	idev->pdev = pdev;
 
-	idev->reset = devm_gpiod_get_optional(&pdev->dev, "reset",
-					      GPIOD_OUT_LOW);
+	idev->reset = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(idev->reset)) {
 		dev_err(&pdev->dev, "Unable to retrieve gpio\n");
 		return PTR_ERR(idev->reset);
@@ -1247,8 +1246,7 @@ static int intel_probe(struct platform_d
 
 		dev_err(&pdev->dev, "No IRQ, falling back to gpio-irq\n");
 
-		host_wake = devm_gpiod_get_optional(&pdev->dev, "host-wake",
-						    GPIOD_IN);
+		host_wake = devm_gpiod_get(&pdev->dev, "host-wake", GPIOD_IN);
 		if (IS_ERR(host_wake)) {
 			dev_err(&pdev->dev, "Unable to retrieve IRQ\n");
 			goto no_irq;

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/bluetooth-hci_intel-fix-null-gpio-desc-pointer-dereference.patch