]> git.hungrycats.org Git - linux/commit
Input: adp5589-keys - fix NULL pointer dereference
authorNuno Sa <nuno.sa@analog.com>
Tue, 1 Oct 2024 14:46:44 +0000 (07:46 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Oct 2024 10:01:03 +0000 (12:01 +0200)
commit9a38791ee79bd17d225c15a6d1479448be127a59
treeea2c9241aa8537f24a426f50eca549c8f8c78df8
parent0e774fb34d7bca98b1fd355e6878d909c2b928e8
Input: adp5589-keys - fix NULL pointer dereference

commit fb5cc65f973661241e4a2b7390b429aa7b330c69 upstream.

We register a devm action to call adp5589_clear_config() and then pass
the i2c client as argument so that we can call i2c_get_clientdata() in
order to get our device object. However, i2c_set_clientdata() is only
being set at the end of the probe function which means that we'll get a
NULL pointer dereference in case the probe function fails early.

Fixes: 30df385e35a4 ("Input: adp5589-keys - use devm_add_action_or_reset() for register clear")
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20241001-b4-dev-adp5589-fw-conversion-v1-1-fca0149dfc47@analog.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/adp5589-keys.c