hwmon: (corsair-cpro) Use a separate buffer for sending commands
authorAleksa Savic <savicaleksa83@gmail.com>
Sat, 4 May 2024 09:25:01 +0000 (11:25 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 May 2024 09:50:58 +0000 (11:50 +0200)
commit6e6644c0a4f85b4e320611ba966f43814bb0471c
tree3cd1d6fcd5606dd089f4a808638102ea8af93a48
parentf3c1bf3054f96ddeab0621d920445bada769b40e
hwmon: (corsair-cpro) Use a separate buffer for sending commands

[ Upstream commit e0cd85dc666cb08e1bd313d560cb4eff4d04219e ]

Introduce cmd_buffer, a separate buffer for storing only
the command that is sent to the device. Before this separation,
the existing buffer was shared for both the command and the
report received in ccp_raw_event(), which was copied into it.

However, because of hidraw, the raw event parsing may be triggered
in the middle of sending a command, resulting in outputting gibberish
to the device. Using a separate buffer resolves this.

Fixes: 40c3a4454225 ("hwmon: add Corsair Commander Pro driver")
Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
Acked-by: Marius Zachmann <mail@mariuszachmann.de>
Link: https://lore.kernel.org/r/20240504092504.24158-2-savicaleksa83@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hwmon/corsair-cpro.c