Commit ee9f3a8
dpaa2-eth: Fix device reference count leak in MAC endpoint handling
The fsl_mc_get_endpoint() function uses device_find_child() for
localization, which implicitly calls get_device() to increment the
device's reference count before returning the pointer. However, the
caller dpaa2_eth_connect_mac() fails to properly release this
reference in multiple scenarios. We should call put_device() to
decrement reference count properly.
As comment of device_find_child() says, 'NOTE: you will need to drop
the reference with put_device() after use'.
Found by code review.
Cc: stable@vger.kernel.org
Fixes: 7194792 ("dpaa2-eth: add MAC/PHY support through phylink")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250717022309.3339976-2-make24@iscas.ac.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent bddbe13 commit ee9f3a8
1 file changed
+12
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4666 | 4666 | | |
4667 | 4667 | | |
4668 | 4668 | | |
4669 | | - | |
| 4669 | + | |
4670 | 4670 | | |
4671 | 4671 | | |
| 4672 | + | |
| 4673 | + | |
| 4674 | + | |
| 4675 | + | |
| 4676 | + | |
4672 | 4677 | | |
4673 | | - | |
4674 | | - | |
| 4678 | + | |
| 4679 | + | |
| 4680 | + | |
| 4681 | + | |
4675 | 4682 | | |
4676 | 4683 | | |
4677 | 4684 | | |
| |||
4705 | 4712 | | |
4706 | 4713 | | |
4707 | 4714 | | |
| 4715 | + | |
| 4716 | + | |
4708 | 4717 | | |
4709 | 4718 | | |
4710 | 4719 | | |
| |||
0 commit comments