]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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 10:14:52 +0000 (12:14 +0200)
commit714229a5790af2ddb55089587b017742ebb3f83e
tree94f09ac7e74daa12de915ac6a8d15260a79539a3
parent4a4b9757789a1551d2df130df23bfb3545bfa7e8
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