protonscr

Dualshock 4 using Sony dongle causes kernel panic on reconnect if DS4 support is enabled

steamclosed
ValveSoftware/steam-for-linux#6050 · opened 2019-01-22 by diegov · updated 2020-03-08 · 5 comments · github
Ddiegov 2019-01-22 github

Your system information

  • Steam client version (build number or date): Jan 21 2019, at 03:50:58
  • Distribution (e.g. Ubuntu): Debian GNU/Linux buster/sid (64 bit)
  • Opted into Steam client beta?: Yes
  • Have you checked for system updates?: Yes

Please describe your issue in as much detail as possible:

I'm using the official Sony DualShock 4 dongle (USB 054c:0ba0)
I've enable DualShock 4 support on steam.
I've configured lightbar colour and intensity

After a system reboot, I can connect the controller normally, and everything works. If I turn off the controller (either through steam or by holding the playstation button on the controller for a few seconds), and turn it on again, it causes a kernel panic due to a division error in the dualshock4_parse_report kernel function.

This happens almost every time I do it, very rarely I'm able to reconnect the controller.

This is very likely a kernel bug, but it only happens when I use the controller through steam. If I turn on and off and on again the controller without starting steam, this issue doesn't happen. So it might be related to the way steam handles the controller device.

The problem occurs in this line in hid-sony.c:

        int calib_data = mult_frac(calib->sens_numer,                                                                                 
                       raw_data - calib->bias,                                                                                        
                       calib->sens_denom);  

Here's a backtrace of the issue:

(gdb) bt                                                                                                                              
#0  0xffffffff81c00b70 in divide_error () at arch/x86/entry/entry_64.S:813                                                            
#1  0xffffffff8178f5a9 in dualshock4_parse_report (sc=0xffff88807c772e28, rd=0xffff88807c8ac000 "\001\205{}\177\b",                   
    size=<optimized out>) at drivers/hid/hid-sony.c:1018                                                                              
#2  0x0000000000000000 in ?? ()  

I've tested this on 3 different computers plus qemu under gdb, and the issue always happens. Unfortunately I don't have a second dongle to verify if there isn't a hardware issue with my dongle.

I have lent the dongle to a friend using windows, and he didn't have any issues with it when enabling dualshock support on steam.

Note this is happening with kernel 4.20 but I've had this issue now for more than a year so it's persisted through multiple kernel upgrades.

Steps for reproducing this issue:

  1. Enable dualshock4 support on steam
  2. Pair a dualshock 4 controller using the official sony dongle
  3. Turn on the controller
  4. Turn off the controller
  5. Turn on the controller again
Kkisak-valve maintainer 2019-01-22 github

Hello @diegov, this doesn't read like a Valve issue. You'd be better off getting in touch with the maintainer of hid-sony, reporting this issue to the kernel bug tracker, or your distro's bug tracker.

If someone finds an actionable indicator this is an issue on the userspace side, let me know and I can re-open.

Ddiegov 2019-01-22 github

I think there could be a userspace component. I'm not very familiar with the way calibration works, but steam could be sending invalid calibration data to the device, triggering the issue. I have not been able to reproduce this issue with the controller outside of steam, which is why I thought I'd log it here.

The fact that this causes a panic is clearly a kernel issue, but I think it's worth investigating how steam is handling the ds4 dongle, in case it's sending it invalid data of some sort, which could cause issues even if the kernel problem is fixed.

Ddiegov 2019-02-12 github

I've sent this to the linux-input list (https://www.spinics.net/lists/linux-input/msg60061.html) and I'll be trying to help figure it out, but there are some questions in the thread about how steam handles the controller and it would be very useful for someone from Valve to provide some details there if possible.

Xxcom169 2020-03-08 github

I have the same issue here with Kernel 5.4

Xxcom169 2020-03-08 github

Nothing extracted yet.