Skip to content

Commit

Permalink
HID: i2c-hid-of: fix NULL-deref on failed power up
Browse files Browse the repository at this point in the history
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: b33752c ("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>
  • Loading branch information
Johan Hovold authored and Jiri Kosina committed Jan 26, 2024
1 parent a3bdcdd commit 00aab7d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/hid/i2c-hid/i2c-hid-of.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 00aab7d

Please sign in to comment.