Re: [PATCH v4 2/2] hwmon: (powerz) Fix missing usb_kill_urb() on signal interrupt
From: Guenter Roeck
Date: Fri Apr 10 2026 - 12:05:22 EST
On Fri, Apr 10, 2026 at 12:25:41AM +0000, Pradhan, Sanman wrote:
> From: Sanman Pradhan <psanman@xxxxxxxxxxx>
>
> wait_for_completion_interruptible_timeout() returns -ERESTARTSYS when
> interrupted. This needs to abort the URB and return an error. No data
> has been received from the device so any reads from the transfer
> buffer are invalid.
>
> The original code tests !ret, which only catches the timeout case (0).
> On signal delivery (-ERESTARTSYS), !ret is false so the function skips
> usb_kill_urb() and falls through to read from the unfilled transfer
> buffer.
>
> Fix by capturing the return value into a long (matching the function
> return type) and handling signal (negative) and timeout (zero) cases
> with separate checks that both call usb_kill_urb() before returning.
>
> Fixes: 4381a36abdf1c ("hwmon: add POWER-Z driver")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Sanman Pradhan <psanman@xxxxxxxxxxx>
Applied.
Thanks,
Guenter