linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] power_supply: 88pm860x_charger: do not pass NULL to power_supply_put
@ 2016-02-28 19:57 Colin King
  2016-03-03 14:21 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2016-02-28 19:57 UTC (permalink / raw)
  To: Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	linux-pm
  Cc: linux-kernel

From: Colin Ian King <colin.king@canonical.com>

In the case where power_supply_get_by_name returns NULL the current
error return path calls power_supply_put with a NULL psy which will
cause a null pointer dereference.  Avoid this with an immediate
return.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/power/88pm860x_charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/88pm860x_charger.c b/drivers/power/88pm860x_charger.c
index 297e72d..2b82e44 100644
--- a/drivers/power/88pm860x_charger.c
+++ b/drivers/power/88pm860x_charger.c
@@ -435,7 +435,7 @@ static irqreturn_t pm860x_temp_handler(int irq, void *data)
 
 	psy = power_supply_get_by_name(pm860x_supplied_to[0]);
 	if (!psy)
-		goto out;
+		return IRQ_HANDLED;
 	ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_TEMP, &temp);
 	if (ret)
 		goto out;
-- 
2.7.0


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

* Re: [PATCH] power_supply: 88pm860x_charger: do not pass NULL to power_supply_put
  2016-02-28 19:57 [PATCH] power_supply: 88pm860x_charger: do not pass NULL to power_supply_put Colin King
@ 2016-03-03 14:21 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2016-03-03 14:21 UTC (permalink / raw)
  To: Colin King
  Cc: Dmitry Eremin-Solenikov, David Woodhouse, linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 312 bytes --]

Hi,

On Sun, Feb 28, 2016 at 07:57:58PM +0000, Colin King wrote:
> In the case where power_supply_get_by_name returns NULL the current
> error return path calls power_supply_put with a NULL psy which will
> cause a null pointer dereference.  Avoid this with an immediate
> return.

Thanks, queued.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2016-03-03 14:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-28 19:57 [PATCH] power_supply: 88pm860x_charger: do not pass NULL to power_supply_put Colin King
2016-03-03 14:21 ` Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).