Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

uio/uio_pci_generic: don't return zero on failure path in probe()

If uio_register_device() fails in probe(), it breaks off initialization,
deallocates all resources, but returns zero.

The patch adds proper error code propagation.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Alexey Khoroshilov and committed by
Greg Kroah-Hartman
c4277e9e 5de61e7a

+2 -1
+2 -1
drivers/uio/uio_pci_generic.c
··· 91 91 gdev->info.handler = irqhandler; 92 92 gdev->pdev = pdev; 93 93 94 - if (uio_register_device(&pdev->dev, &gdev->info)) 94 + err = uio_register_device(&pdev->dev, &gdev->info); 95 + if (err) 95 96 goto err_register; 96 97 pci_set_drvdata(pdev, gdev); 97 98