Skip to content

Commit da71754

Browse files
jhovoldkuba-moo
authored andcommitted
net: gianfar: 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: 7349a74 ("net: ethernet: gianfar_ethtool: get phc index through drvdata") Cc: stable@vger.kernel.org # 4.18 Cc: Yangbo Lu <yangbo.lu@nxp.com> Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20250725171213.880-4-johan@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 70458f8 commit da71754

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/ethernet/freescale/gianfar_ethtool.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1475,8 +1475,10 @@ static int gfar_get_ts_info(struct net_device *dev,
14751475
if (ptp_node) {
14761476
ptp_dev = of_find_device_by_node(ptp_node);
14771477
of_node_put(ptp_node);
1478-
if (ptp_dev)
1478+
if (ptp_dev) {
14791479
ptp = platform_get_drvdata(ptp_dev);
1480+
put_device(&ptp_dev->dev);
1481+
}
14801482
}
14811483

14821484
if (ptp)

0 commit comments

Comments
 (0)