usbip: vudc: fix null pointer dereference on udc->lock
authorColin Ian King <colin.king@canonical.com>
Thu, 22 Feb 2018 17:39:17 +0000 (17:39 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Mar 2018 07:42:46 +0000 (08:42 +0100)
commitd4f0bf4525fd55e90886714fb24a1ca7e7653fb2
treed2a5e2147b3ccc421edf3bcb912d7765d8e5d6dc
parentf8187fd2aedaf573163a7ac1308c8014580aa4a0
usbip: vudc: fix null pointer dereference on udc->lock

commit df3334c223a033f562645712e832ca4cbb326bbf upstream.

Currently the driver attempts to spin lock on udc->lock before a NULL
pointer check is performed on udc, hence there is a potential null
pointer dereference on udc->lock.  Fix this by moving the null check
on udc before the lock occurs.

Fixes: ea6873a45a22 ("usbip: vudc: Add SysFS infrastructure for VUDC")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Shuah Khan <shuahkh@osg.samsung.com>
Reviewed-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/usbip/vudc_sysfs.c