]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
Input: mtk-pmic-keys - fix possible null pointer dereference
authorGary Bisson <bisson.gary@gmail.com>
Tue, 29 Apr 2025 16:16:29 +0000 (09:16 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 18 May 2025 06:21:22 +0000 (08:21 +0200)
commit334d74a798463ceec02a41eb0e2354aaac0d6249
tree88a0b3d2d3f6d2c663837e8821d28c8cd0cd155c
parent03d71e1b2488c1318b51e1db06324c6e4730c4f3
Input: mtk-pmic-keys - fix possible null pointer dereference

commit 11cdb506d0fbf5ac05bf55f5afcb3a215c316490 upstream.

In mtk_pmic_keys_probe, the regs parameter is only set if the button is
parsed in the device tree. However, on hardware where the button is left
floating, that node will most likely be removed not to enable that
input. In that case the code will try to dereference a null pointer.

Let's use the regs struct instead as it is defined for all supported
platforms. Note that it is ok setting the key reg even if that latter is
disabled as the interrupt won't be enabled anyway.

Fixes: b581acb49aec ("Input: mtk-pmic-keys - transfer per-key bit in mtk_pmic_keys_regs")
Signed-off-by: Gary Bisson <bisson.gary@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/input/keyboard/mtk-pmic-keys.c