Re: [PATCH 1/2] usbip: vhci_hcd: fix NULL deref in status_show_vhci

From: Shuah Khan

Date: Tue May 05 2026 - 14:15:52 EST


On 4/13/26 19:00, Adrian Wowk wrote:
platform_get_drvdata() can return NULL if a VHCI host controller's
probe failed (e.g. due to USB bus number exhaustion). status_show_vhci()
checked for a NULL pdev but not for a NULL hcd returned by
platform_get_drvdata(). Passing NULL to hcd_to_vhci_hcd() does not
return NULL - it returns a pointer offset of 0x260, causing a NULL
pointer dereference when that value is subsequently dereferenced.

Add a NULL check on hcd before calling hcd_to_vhci_hcd(). Move
status_show_not_ready() above status_show_vhci() to make it callable
from the new error path without a forward declaration.

Signed-off-by: Adrian Wowk <dev@xxxxxxxxxxxxxx>
---
drivers/usb/usbip/vhci_sysfs.c | 52 +++++++++++++++++++---------------
1 file changed, 29 insertions(+), 23 deletions(-)


Looks good to me.

Reviewed-by: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>

Greg, Please pick this up.

thanks,
-- Shuah