]> 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, 1 Aug 2025 08:48:43 +0000 (09:48 +0100)
commitcf8e62f6e1b25075e08e88aa8a187f1c28ab79c4
treef013197c51cc97921696cd332efcf1625750b5d6
parent5b8d6cb9a03dd8ef6418b29bf95f3779cb5ed4b2
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