Skip to content

Commit e6d7e64

Browse files
Dan CarpenterUlrich Hecht
authored andcommitted
usb: host: max3421-hcd: Fix error pointer dereference in probe cleanup
[ Upstream commit 186e8f2bdba551f3ae23396caccd452d985c23e3 ] The kthread_run() function returns error pointers so the max3421_hcd->spi_thread pointer can be either error pointers or NULL. Check for both before dereferencing it. Fixes: 05dfa5c ("usb: host: max3421-hcd: fix "spi_rd8" uses dynamic stack allocation warning") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/aJTMVAPtRe5H6jug@stanley.mountain Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Ulrich Hecht <uli@kernel.org>
1 parent 2edb921 commit e6d7e64

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/usb/host/max3421-hcd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1942,7 +1942,7 @@ max3421_probe(struct spi_device *spi)
19421942
if (hcd) {
19431943
kfree(max3421_hcd->tx);
19441944
kfree(max3421_hcd->rx);
1945-
if (max3421_hcd->spi_thread)
1945+
if (!IS_ERR_OR_NULL(max3421_hcd->spi_thread))
19461946
kthread_stop(max3421_hcd->spi_thread);
19471947
usb_put_hcd(hcd);
19481948
}

0 commit comments

Comments
 (0)