OSDN Git Service
(root)
/
uclinux-h8
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
596690e
)
ptp: ocp: Fix the error handling path for the class device.
author
Jonathan Lemon
<jonathan.lemon@gmail.com>
Thu, 5 Aug 2021 19:52:43 +0000
(12:52 -0700)
committer
David S. Miller
<davem@davemloft.net>
Fri, 6 Aug 2021 09:41:27 +0000
(10:41 +0100)
Move the put_device() call to the error handling path, so the
device is released after the .release callback, avoiding a
use-after-free.
Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/ptp/ptp_ocp.c
patch
|
blob
|
history
diff --git
a/drivers/ptp/ptp_ocp.c
b/drivers/ptp/ptp_ocp.c
index
039d3a5
..
261713c
100644
(file)
--- a/
drivers/ptp/ptp_ocp.c
+++ b/
drivers/ptp/ptp_ocp.c
@@
-1381,7
+1381,6
@@
ptp_ocp_device_init(struct ptp_ocp *bp, struct pci_dev *pdev)
err = device_add(&bp->dev);
if (err) {
dev_err(&bp->dev, "device add failed: %d\n", err);
- put_device(&bp->dev);
goto out;
}
@@
-1391,6
+1390,7
@@
ptp_ocp_device_init(struct ptp_ocp *bp, struct pci_dev *pdev)
out:
ptp_ocp_dev_release(&bp->dev);
+ put_device(&bp->dev);
return err;
}