diff options
author | Tong Zhang <[email protected]> | 2022-01-29 13:40:55 -0800 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2022-01-30 09:56:58 +0200 |
commit | e7f1e8834b2b2144dfbe0b2235d05e4f6f95882e (patch) | |
tree | 86f8b9728b800bf46ac901916cffaa654fbb1a51 /drivers/usb/cdns3/cdns3-gadget.c | |
parent | 6cb917411e028dcb66ce8f5db1b47361b78d7d3f (diff) |
binfmt_misc: fix crash when load/unload module
We should unregister the table upon module unload otherwise something
horrible will happen when we load binfmt_misc module again. Also note
that we should keep value returned by register_sysctl_mount_point() and
release it later, otherwise it will leak.
Also, per Christian's comment, to fully restore the old behavior that
won't break userspace the check(binfmt_misc_header) should be
eliminated.
To reproduce:
modprobe binfmt_misc
modprobe -r binfmt_misc
modprobe binfmt_misc
modprobe -r binfmt_misc
modprobe binfmt_misc
resulting in
modprobe: can't load module binfmt_misc (kernel/fs/binfmt_misc.ko): Cannot allocate memory
and an unhappy kernel:
binfmt_misc: Failed to create fs/binfmt_misc sysctl mount point
binfmt_misc: Failed to create fs/binfmt_misc sysctl mount point
BUG: unable to handle page fault for address: fffffbfff8004802
Call Trace:
init_misc_binfmt+0x2d/0x1000 [binfmt_misc]
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 3ba442d5331f ("fs: move binfmt_misc sysctl to its own file")
Signed-off-by: Tong Zhang <[email protected]>
Co-developed-by: Christian Brauner<[email protected]>
Acked-by: Luis Chamberlain <[email protected]>
Cc: Eric Biederman <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Iurii Zaikin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'drivers/usb/cdns3/cdns3-gadget.c')
0 files changed, 0 insertions, 0 deletions