[RFT PATCH 0/4] Check return value of power_supply_register

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux