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: b33752c300 ("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>
This commit is contained in:
Johan Hovold 2024-01-26 18:09:01 +01:00 коммит произвёл Greg Kroah-Hartman
Родитель 20d8a8fe00
Коммит 62f5d219ed
1 изменённых файлов: 1 добавлений и 0 удалений

Просмотреть файл

@ -80,6 +80,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;