Skip to content

Commit 3fa8402

Browse files
jhovoldkuba-moo
authored andcommitted
net: dpaa: fix device leak when querying time stamp info
Make sure to drop the reference to the ptp device taken by of_find_device_by_node() when querying the time stamping capabilities. Note that holding a reference to the ptp device does not prevent its driver data from going away. Fixes: 17ae0b0 ("dpaa_eth: add the get_ts_info interface for ethtool") Cc: [email protected] # 4.19 Cc: Yangbo Lu <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 9063de6 commit 3fa8402

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,10 @@ static int dpaa_get_ts_info(struct net_device *net_dev,
371371
of_node_put(ptp_node);
372372
}
373373

374-
if (ptp_dev)
374+
if (ptp_dev) {
375375
ptp = platform_get_drvdata(ptp_dev);
376+
put_device(&ptp_dev->dev);
377+
}
376378

377379
if (ptp)
378380
info->phc_index = ptp->phc_index;

0 commit comments

Comments
 (0)