HID: steam: fixes race in handling device list.
authorRodrigo Rivas Costa <rodrigorivascosta@gmail.com>
Tue, 16 Jun 2020 16:44:18 +0000 (18:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Jul 2020 08:18:36 +0000 (10:18 +0200)
commit2c179ece3bfbb5a0d80431281a4c2a1019081f10
treeda375534010203dbc850fb871aa07065433a513d
parent5d273c566f7b5d429aee7669cc9c5d31402bde9c
HID: steam: fixes race in handling device list.

[ Upstream commit 2d3f53a80e4eed078669853a178ed96d88f74143 ]

Using uhid and KASAN this driver crashed because it was getting
several connection events where it only expected one. Then the
device was added several times to the static device list and it got
corrupted.

This patch checks if the device is already in the list before adding
it.

Signed-off-by: Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
Tested-by: Siarhei Vishniakou <svv@google.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/hid-steam.c