usb: cdns3: Fix use after free in probe error handling

We can't use "wrap" after it has been freed.

Fixes: 7733f6c32e ("usb: cdns3: Add Cadence USB3 DRD Driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20190904100102.GB7007@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Dan Carpenter 2019-09-04 13:01:02 +03:00 committed by Greg Kroah-Hartman
parent 177238c3d4
commit 5f318dad72
1 changed files with 2 additions and 1 deletions

View File

@ -159,8 +159,9 @@ static int cdns3_pci_probe(struct pci_dev *pdev,
wrap->plat_dev = platform_device_register_full(&plat_info);
if (IS_ERR(wrap->plat_dev)) {
pci_disable_device(pdev);
err = PTR_ERR(wrap->plat_dev);
kfree(wrap);
return PTR_ERR(wrap->plat_dev);
return err;
}
}