diff options
| author | Ma Ke <[email protected]> | 2025-07-17 02:23:09 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2025-07-19 00:13:50 +0000 |
| commit | 96e056ffba912ef18a72177f71956a5b347b5177 (patch) | |
| tree | e757021254942309783fdc8c004a5b84185de0ab /rust/helpers/helpers.c | |
| parent | dpaa2-eth: Fix device reference count leak in MAC endpoint handling (diff) | |
| download | kernel-96e056ffba912ef18a72177f71956a5b347b5177.tar.gz kernel-96e056ffba912ef18a72177f71956a5b347b5177.zip | |
dpaa2-switch: 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_switch_port_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: [email protected]
Fixes: 84cba72956fd ("dpaa2-switch: integrate the MAC endpoint support")
Signed-off-by: Ma Ke <[email protected]>
Tested-by: Ioana Ciornei <[email protected]>
Reviewed-by: Ioana Ciornei <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'rust/helpers/helpers.c')
0 files changed, 0 insertions, 0 deletions
