]> git.baikalelectronics.ru Git - kernel.git/commit
[media] rc-main: fix kernel oops after unloading keymap module
authorHans Verkuil <hverkuil@xs4all.nl>
Sun, 26 Jun 2016 10:44:56 +0000 (07:44 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 8 Jul 2016 19:16:53 +0000 (16:16 -0300)
commitf8aead19cbb9070ff90d4c07ed579869ba0e5a51
tree1fcbfb42749fd6d33bcc28050ae056a9425672f5
parent58b2ce8c77b9317904dce1763847029477709e97
[media] rc-main: fix kernel oops after unloading keymap module

When the rc_map table is created the char pointer of the name of the keymap
is copied to the rc_map->name field. However, this pointer points to memory
from the keymap module itself.

Since these keymap modules are not refcounted, that means anyone can call
rmmod to unload that module. Which is not a big deal because the contents of
the map is all copied to rc_map, except for the keymap name.

So after a keymap module is unloaded the name pointer has become stale. Unloading
the rc-core module will now cause a kernel oops in rc_dev_uevent().

The solution is to kstrdup the name so there are no more references to the
keymap module remaining.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/rc/rc-main.c