linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] leds: fix broken devres usage
@ 2020-06-01 13:39 Johan Hovold
  2020-06-01 13:39 ` [PATCH 1/6] leds: 88pm860x: fix use-after-free on unbind Johan Hovold
                   ` (7 more replies)
  0 siblings, 8 replies; 15+ messages in thread
From: Johan Hovold @ 2020-06-01 13:39 UTC (permalink / raw)
  To: Jacek Anaszewski, Pavel Machek
  Cc: Dan Murphy, Amitoj Kaur Chawla, linux-leds, linux-kernel, Johan Hovold

Several MFD child drivers register their class devices directly under
the parent device (about half of the MFD LED drivers do so).

This means you cannot blindly do devres conversions so that
deregistration ends up being tied to the parent device, something which
leads to use-after-free on driver unbind when the class device is
released while still being registered (and, for example, oopses on later
parent MFD driver unbind or LED class callbacks, or resource leaks and
name clashes on child driver reload).

Included is also a clean up removing some pointless casts when
registering class devices.

All but the lm3533 one have only been compile tested.

Johan


Johan Hovold (6):
  leds: 88pm860x: fix use-after-free on unbind
  leds: da903x: fix use-after-free on unbind
  leds: lm3533: fix use-after-free on unbind
  leds: lm36274: fix use-after-free on unbind
  leds: wm831x-status: fix use-after-free on unbind
  leds: drop redundant struct-device pointer casts

 drivers/leds/leds-88pm860x.c      | 14 +++++++++++++-
 drivers/leds/leds-da903x.c        | 14 +++++++++++++-
 drivers/leds/leds-lm3533.c        | 12 +++++++++---
 drivers/leds/leds-lm355x.c        |  9 +++------
 drivers/leds/leds-lm36274.c       | 15 ++++++++++++---
 drivers/leds/leds-lm3642.c        |  9 +++------
 drivers/leds/leds-wm831x-status.c | 14 +++++++++++++-
 7 files changed, 66 insertions(+), 21 deletions(-)

-- 
2.26.2


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

end of thread, other threads:[~2020-06-04 13:31 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-01 13:39 [PATCH 0/6] leds: fix broken devres usage Johan Hovold
2020-06-01 13:39 ` [PATCH 1/6] leds: 88pm860x: fix use-after-free on unbind Johan Hovold
2020-06-01 13:39 ` [PATCH 2/6] leds: da903x: " Johan Hovold
2020-06-01 13:39 ` [PATCH 3/6] leds: lm3533: " Johan Hovold
2020-06-01 13:39 ` [PATCH 4/6] leds: lm36274: " Johan Hovold
2020-06-01 13:39 ` [PATCH 5/6] leds: wm831x-status: " Johan Hovold
2020-06-01 13:39 ` [PATCH 6/6] leds: drop redundant struct-device pointer casts Johan Hovold
2020-06-01 13:51 ` [PATCH 0/6] leds: fix broken devres usage Andy Shevchenko
2020-06-01 14:01   ` Johan Hovold
2020-06-01 14:08     ` Andy Shevchenko
2020-06-01 14:29       ` Johan Hovold
2020-06-01 15:09         ` Andy Shevchenko
2020-06-01 15:31           ` Johan Hovold
2020-06-02  8:32             ` Andy Shevchenko
2020-06-04 13:31 ` Pavel Machek

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).