[PATCH] input: mtk-pmic-keys: Fix potential NULL pointer dereference in probe()

Dmitry Torokhov dmitry.torokhov at gmail.com
Tue Dec 9 20:48:13 PST 2025


Hi Haotian,

On Wed, Dec 10, 2025 at 11:00:13AM +0800, Haotian Zhang wrote:
> of_match_device() may return NULL when the device node
> does not match any entry in the driver's match table.
> The current code dereferences of_id->data unconditionally,
> which can lead to a NULL pointer dereference.

How are we getting into probe() without matching compatible?

We already had a discussion about this in [1] and patched the MFD
portion to not use generic driver name when instantiating the keypad
sub-device.

[1] http://lore.kernel.org/r/20250630-mtk-pmic-keys-fix-crash-v1-1-e47351fa9d1f@collabora.com

Thanks.

-- 
Dmitry



More information about the linux-arm-kernel mailing list