Re: Kasan crash in hid-steam

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Rodrigo,

I ran the test 50 times with your patch, and no crashes.

Tested-by: Siarhei Vishniakou <svv@xxxxxxxxxx>

Side question, is there any plan to support the beta bluetooth mode
for this controller?
Currently, the controller permanently stays in the lizard mode when
connected via bluetooth.

On Sat, Jun 13, 2020 at 7:22 AM Rodrigo Rivas Costa
<rodrigorivascosta@xxxxxxxxx> wrote:
>
> Hi, thank you for the report.
>
> It looks like using uhid you exercised some codepath that are never seen
> using the real HW. And that exposes some race handling the list of
> devices.
>
> Please, see if the following patch fixes the issue.
> Best regards.
>
> ---
>  drivers/hid/hid-steam.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c
> index 6286204d4c56..a3b151b29bd7 100644
> --- a/drivers/hid/hid-steam.c
> +++ b/drivers/hid/hid-steam.c
> @@ -526,7 +526,8 @@ static int steam_register(struct steam_device *steam)
>                         steam_battery_register(steam);
>
>                 mutex_lock(&steam_devices_lock);
> -               list_add(&steam->list, &steam_devices);
> +               if (list_empty(&steam->list))
> +                       list_add(&steam->list, &steam_devices);
>                 mutex_unlock(&steam_devices_lock);
>         }
>
> @@ -552,7 +553,7 @@ static void steam_unregister(struct steam_device *steam)
>                 hid_info(steam->hdev, "Steam Controller '%s' disconnected",
>                                 steam->serial_no);
>                 mutex_lock(&steam_devices_lock);
> -               list_del(&steam->list);
> +               list_del_init(&steam->list);
>                 mutex_unlock(&steam_devices_lock);
>                 steam->serial_no[0] = 0;
>         }
> @@ -738,6 +739,7 @@ static int steam_probe(struct hid_device *hdev,
>         mutex_init(&steam->mutex);
>         steam->quirks = id->driver_data;
>         INIT_WORK(&steam->work_connect, steam_work_connect_cb);
> +       INIT_LIST_HEAD(&steam->list);
>
>         steam->client_hdev = steam_create_client_hid(hdev);
>         if (IS_ERR(steam->client_hdev)) {
> --
> 2.27.0
>



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux