Revision d81916910f7498fe7a768697e0101d488f9fe665 authored by Yang Yingliang on 29 October 2022, 08:29:31 UTC, committed by Huacai Chen on 29 October 2022, 08:29:31 UTC
Currently the return value of 'sub_driver->init' is not checked. If
sparse_keymap_setup() called in the init function fails, 'generic_
inputdev' is freed, then it will lead a UAF when using it in generic_
acpi_laptop_init(). Fix it by checking the return value and setting
generic_inputdev to NULL after free, so as to avoid double free it.

The error code in generic_subdriver_init() is always negative, so the
return of generic_subdriver_init() can be simplified.

Fixes: 6246ed09111f ("LoongArch: Add ACPI-based generic laptop driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent fbe605a
History
File Mode Size
include-prefixes
libfdt
.gitignore -rw-r--r-- 57 bytes
Makefile -rw-r--r-- 1.1 KB
checks.c -rw-r--r-- 53.7 KB
data.c -rw-r--r-- 4.5 KB
dt-extract-compatibles -rwxr-xr-x 1.9 KB
dt_to_config -rwxr-xr-x 40.8 KB
dtc-lexer.l -rw-r--r-- 6.1 KB
dtc-parser.y -rw-r--r-- 10.6 KB
dtc.c -rw-r--r-- 9.2 KB
dtc.h -rw-r--r-- 9.6 KB
dtx_diff -rwxr-xr-x 8.9 KB
fdtget.c -rw-r--r-- 7.9 KB
fdtoverlay.c -rw-r--r-- 4.2 KB
fdtput.c -rw-r--r-- 7.7 KB
flattree.c -rw-r--r-- 21.5 KB
fstree.c -rw-r--r-- 1.5 KB
livetree.c -rw-r--r-- 20.3 KB
of_unittest_expect -rwxr-xr-x 9.4 KB
srcpos.c -rw-r--r-- 8.6 KB
srcpos.h -rw-r--r-- 2.9 KB
treesource.c -rw-r--r-- 6.8 KB
update-dtc-source.sh -rwxr-xr-x 2.5 KB
util.c -rw-r--r-- 8.5 KB
util.h -rw-r--r-- 7.0 KB
version_gen.h -rw-r--r-- 42 bytes
yamltree.c -rw-r--r-- 6.3 KB

back to top