summaryrefslogtreecommitdiff
path: root/drivers/hid
diff options
context:
space:
mode:
authorJohan Hovold <johan+linaro@kernel.org>2024-01-26 18:09:01 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-02-23 09:24:55 +0100
commit4cad91344a62536a2949873bad6365fbb6232776 (patch)
treee9d4b7e7ba2a4b9f519a02b0ead457269f1b8717 /drivers/hid
parent467fce636a3a9b188e6d593ce422dd688f16b022 (diff)
downloadlinux-rpi-4cad91344a62536a2949873bad6365fbb6232776.tar.gz
linux-rpi-4cad91344a62536a2949873bad6365fbb6232776.tar.bz2
linux-rpi-4cad91344a62536a2949873bad6365fbb6232776.zip
HID: i2c-hid-of: fix NULL-deref on failed power up
commit 00aab7dcb2267f2aef59447602f34501efe1a07f upstream. A while back the I2C HID implementation was split in an ACPI and OF part, but the new OF driver never initialises the client pointer which is dereferenced on power-up failures. Fixes: b33752c30023 ("HID: i2c-hid: Reorganize so ACPI and OF are separate modules") Cc: stable@vger.kernel.org # 5.12 Cc: Douglas Anderson <dianders@chromium.org> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/i2c-hid/i2c-hid-of.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/hid/i2c-hid/i2c-hid-of.c b/drivers/hid/i2c-hid/i2c-hid-of.c
index c4e1fa0273c8..8be4d576da77 100644
--- a/drivers/hid/i2c-hid/i2c-hid-of.c
+++ b/drivers/hid/i2c-hid/i2c-hid-of.c
@@ -87,6 +87,7 @@ static int i2c_hid_of_probe(struct i2c_client *client)
if (!ihid_of)
return -ENOMEM;
+ ihid_of->client = client;
ihid_of->ops.power_up = i2c_hid_of_power_up;
ihid_of->ops.power_down = i2c_hid_of_power_down;