Re: [PATCH v3] usbip: vudc: Prevent transfer timer rearm during teardown

From: Shuah Khan

Date: Sat Sep 26 2026 - 15:43:36 EST


On 9/24/26 15:51, mhun512@xxxxxxxxx wrote:
Commit d96209626a29 ("usbip: vudc: Fix use after free bug in
vudc_remove due to race condition") deletes the timer before
usb_del_gadget_udc() stops the receive thread. v_kick_timer() can rearm
it even in VUDC_TR_STOPPED, leaving v_timer() to use freed vudc.

Use timer_shutdown_sync() to reject later rearms. Replace the
inaccurate blanket lock comment with __must_hold(&udc->lock) on
v_start_timer() and v_kick_timer(); v_init_timer() and v_stop_timer() run
unlocked.

A KASAN/DEBUG_OBJECTS_TIMERS x86_64 QEMU harness binds g_zero to
usbip-vudc.0, sends CMD_SUBMIT to usbip_sockfd via a socketpair, and
repeatedly unbinds/rebinds vudc. The unpatched kernel reported a
free-active timer and a use-after-free in v_timer(); the patched kernel
ran 4000 iterations without either report. No physical device or
remote client was tested.
> Fixes: d96209626a29 ("usbip: vudc: Fix use after free bug in
vudc_remove due to race condition")

If you haven't tested this physical devices and a remote client, how
do you know this change fixes the problem. Sorry I can't accept this
patch.

thanks,
-- Shuah