lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1503241200220.6781@pobox.suse.cz>
Date:	Tue, 24 Mar 2015 12:02:41 +0100 (CET)
From:	Jiri Kosina <jkosina@...e.cz>
To:	Krzysztof Kozlowski <k.kozlowski@...sung.com>
cc:	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-pm@...r.kernel.org, Sebastian Reichel <sre@...nel.org>,
	Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
	David Woodhouse <dwmw2@...radead.org>,
	Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH] HID: input: Fix NULL pointer dereference when
 power_supply_register fails

On Mon, 23 Mar 2015, Krzysztof Kozlowski wrote:

> Do not call power_supply_powers() if power_supply_register() failed
> earlier. This fixes possible NULL pointer dereference by
> power_supply_powers() in such case.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@...sung.com>
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> 
> ---
> 
> The patch was prepared on top of next-20150323. It depends on changes in
> power supply core (battery-2.6.git) so probably it should be applied to
> the battery tree.

Acked-by: Jiri Kosina <jkosina@...e.cz>

for the merge through battery-2.6.git. Thanks.

> ---
>  drivers/hid/hid-input.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
> index a70fa4d7f8f9..008e89bf6f3c 100644
> --- a/drivers/hid/hid-input.c
> +++ b/drivers/hid/hid-input.c
> @@ -452,10 +452,10 @@ static bool hidinput_setup_battery(struct hid_device *dev, unsigned report_type,
>  		kfree(psy_desc->name);
>  		kfree(psy_desc);
>  		dev->battery = NULL;
> +	} else {
> +		power_supply_powers(dev->battery, &dev->dev);
>  	}
>  
> -	power_supply_powers(dev->battery, &dev->dev);
> -
>  out:
>  	return true;
>  }

-- 
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ