Re: [PATCH] usbip: usbip_host: fix stub_dev lock context imbalance regression

From: Shuah Khan
Date: Wed May 29 2019 - 19:22:45 EST

On 5/29/19 2:25 PM, Greg KH wrote:
On Wed, May 29, 2019 at 01:46:15PM -0600, Shuah Khan wrote:
Fix the following sparse context imbalance regression introduced in
a patch that fixed sleeping function called from invalid context bug.

kbuild test robot reported on:

tree/branch: usb-linus

Regressions in current branch:

drivers/usb/usbip/stub_dev.c:399:9: sparse: sparse: context imbalance in 'stub_probe' - different lock contexts for basic block
drivers/usb/usbip/stub_dev.c:418:13: sparse: sparse: context imbalance in 'stub_disconnect' - different lock contexts for basic block
drivers/usb/usbip/stub_dev.c:464:1-10: second lock on line 476

Error ids grouped by kconfigs:

âââ i386-allmodconfig
â âââ drivers-usb-usbip-stub_dev.c:second-lock-on-line
âââ x86_64-allmodconfig
â âââ drivers-usb-usbip-stub_dev.c:sparse:sparse:context-imbalance-in-stub_disconnect-different-lock-contexts-for-basic-block
â âââ drivers-usb-usbip-stub_dev.c:sparse:sparse:context-imbalance-in-stub_probe-different-lock-contexts-for-basic-block
âââ x86_64-allyesconfig
âââ drivers-usb-usbip-stub_dev.c:second-lock-on-line

This is a real problem in an error leg where spin_lock() is called on an
already held lock.

Fix the imbalance in stub_probe() and stub_disconnect().

Signed-off-by: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>

I'll go add:

Fixes: 0c9e8b3cad65 ("usbip: usbip_host: fix BUG: sleeping function called from invalid context")
Cc: stable <stable@xxxxxxxxxxxxxxx>

as the patch this fixes was tagged for stable.

Sounds good. Thanks.

-- Shuah