diff options
author | Krzysztof Kozlowski <k.kozlowski@samsung.com> | 2015-02-20 14:32:24 +0100 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2015-02-25 22:18:18 +0100 |
commit | a2c1d531854c4319610f1d83351213b47a633969 (patch) | |
tree | 70d4f9b5bd25c39dd11ccb80af24b379baaa5a6c /drivers/power/max14577_charger.c | |
parent | f852ec461e24504690445e7d281cbe806df5ccef (diff) | |
download | lwn-a2c1d531854c4319610f1d83351213b47a633969.tar.gz lwn-a2c1d531854c4319610f1d83351213b47a633969.zip |
power_supply: ipaq_micro_battery: Check return values in probe
The return values of create_singlethread_workqueue() and
power_supply_register() calls were not checked and even on error probe()
function returned 0.
1. If allocation of workqueue failed (returning NULL) then further
accesses could lead to NULL pointer dereference. The
queue_delayed_work() expects workqueue to be non-NULL.
2. If registration of power supply failed then during unbind the driver
tried to unregister power supply which was not actually registered.
This could lead to memory corruption because
power_supply_unregister() unconditionally cleans up given power
supply.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Fixes: 00a588f9d27f ("power: add driver for battery reading on iPaq h3xxx")
Cc: <stable@vger.kernel.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/power/max14577_charger.c')
0 files changed, 0 insertions, 0 deletions