Messages in this thread | | | From | Daniel Xu <> | Subject | [RFC char-misc-next 0/2] Add private pointer to struct cdev | Date | Sun, 2 Jan 2022 21:01:38 -0800 |
| |
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(-)
-- 2.34.1
| |