RFC Add private pointer to struct cdev
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest2 patches 4 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | cdev: Add private pointer to struct cdevinclude/ | +1 | 2 replies | |
| 2/2 | pps: Fix use-after-free cdev bug on module unloaddrivers/ include/ | +12 | 2 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC char-misc-next 0/2] Add private pointer to struct cdev
The details are explained more thoroughly in the actual commits, but the basic idea behind this RFC patchset is that:
* Using cdev_init() on an embedded struct cdev can lead to subtle use-after-free issues
* Switching to cdev_alloc() and storing a pointer fixes the lifetime issues but also breaks container_of()
* Deal with container_of() breakage by adding a void *private field
I've "fixed" (I'm aware module unloading is best-effort and may not constitute a "real" bug) the issue in a random driver I found that exhibits the issue. The other drivers I've seen with the issue are hard for me to load/unload, so just one for now.
If this patchset is deemed acceptable, I'd be happy to convert other broken drivers I find, but with the understanding that the best I can do for testing is compiling them.
Daniel Xu (2):
cdev: Add private pointer to struct cdev
pps: Fix use-after-free cdev bug on module unload
drivers/pps/pps.c | 20 +++++++++++--------- include/linux/cdev.h | 1 + include/linux/pps_kernel.h | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-)
Signature · 1 line
2.34.1