All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFT PATCH 0/4] Check return value of power_supply_register
@ 2015-01-27 11:30 Krzysztof Kozlowski
  2015-01-27 11:30 ` [RFT PATCH 1/4] power_supply: twl4030_madc: " Krzysztof Kozlowski
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2015-01-27 11:30 UTC (permalink / raw)
  To: Dmitry Artamonow, Marek Belisko, Cezary Jackiewicz, Darren Hart,
	Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	platform-driver-x86, linux-kernel, linux-pm
  Cc: Krzysztof Kozlowski

Hi,


During global rework of power supply register API I found possible
issues related to not checked return value.

The power_supply_register() return value was ignored and during driver
removal the power supply was always unregistered. This theoretically
could lead to invalid memory accesses. However I did not reproduce
the issue (only code analysis).

Affected drivers:
1. twl4030_madc
2. compal-laptop
3. ipaq_micro_battery

I prepared patches but DID NOT test them. Only compilation + sparse
 + smatch + coccicheck.

I am kindly asking for review and testing.


P.S. The acpi/sbs.c driver has the same issue. Before unregistering
power supply it checks if sbs->charger.dev is non-NULL... which will
be non-NULL in most error-paths. However the driver is little more
complicated so fixing this without doing tests would be very
error-prone.


Best regards,
Krzysztof


Krzysztof Kozlowski (4):
  power_supply: twl4030_madc: Check return value of
    power_supply_register
  compal-laptop: Check return value of power_supply_register
  power_supply: ipaq_micro_battery: Fix leaking workqueue
  power_supply: ipaq_micro_battery: Check return values in probe

 drivers/platform/x86/compal-laptop.c |  7 ++++++-
 drivers/power/ipaq_micro_battery.c   | 22 ++++++++++++++++++++--
 drivers/power/twl4030_madc_battery.c |  7 +++++--
 3 files changed, 31 insertions(+), 5 deletions(-)

-- 
1.9.1


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

end of thread, other threads:[~2015-02-09  7:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-27 11:30 [RFT PATCH 0/4] Check return value of power_supply_register Krzysztof Kozlowski
2015-01-27 11:30 ` [RFT PATCH 1/4] power_supply: twl4030_madc: " Krzysztof Kozlowski
2015-01-27 21:06   ` Belisko Marek
2015-01-28  7:58     ` Krzysztof Kozlowski
2015-01-27 11:30 ` [RFT PATCH 2/4] compal-laptop: " Krzysztof Kozlowski
2015-02-07  2:42   ` Darren Hart
2015-02-09  7:56     ` Krzysztof Kozlowski
2015-01-27 11:30 ` [RFT PATCH 3/4] power_supply: ipaq_micro_battery: Fix leaking workqueue Krzysztof Kozlowski
2015-01-27 11:30 ` [RFT PATCH 4/4] power_supply: ipaq_micro_battery: Check return values in probe Krzysztof Kozlowski

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.