]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bus: fsl-mc: Fix potential double device reference in fsl_mc_get_endpoint()
authorMa Ke <make24@iscas.ac.cn>
Thu, 17 Jul 2025 02:23:07 +0000 (10:23 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 10:04:48 +0000 (12:04 +0200)
commit4cf9235fafc47d773746096a132ca6a6e4ddc025
tree4e95271e5b7b4b8d4a3c936b743246d57eb8c99e
parent034f569d903d5d44b49aa21b8e642767ab7c537b
bus: fsl-mc: Fix potential double device reference in fsl_mc_get_endpoint()

commit bddbe13d36a02d5097b99cf02354d5752ad1ac60 upstream.

The fsl_mc_get_endpoint() function may call fsl_mc_device_lookup()
twice, which would increment the device's reference count twice if
both lookups find a device. This could lead to a reference count leak.

Found by code review.

Cc: stable@vger.kernel.org
Fixes: 1ac210d128ef ("bus: fsl-mc: add the fsl_mc_get_endpoint function")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Fixes: 8567494cebe5 ("bus: fsl-mc: rescan devices if endpoint not found")
Link: https://patch.msgid.link/20250717022309.3339976-1-make24@iscas.ac.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/bus/fsl-mc/fsl-mc-bus.c