]> git.baikalelectronics.ru Git - kernel.git/commit
interconnect: fix icc_provider_del() error handling
authorJohan Hovold <johan+linaro@kernel.org>
Mon, 6 Mar 2023 07:56:30 +0000 (08:56 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Mar 2023 12:33:57 +0000 (13:33 +0100)
commit0f033fb78fc061ab98335f493bb851114b6da63c
tree24ee9c44d50b8508ce2f8afd8484cd993d8306cd
parente371988d3ce2d47c173940af40d3473c57a37e65
interconnect: fix icc_provider_del() error handling

commit e5c88283fdfcd84be22855f53deb315205e4cae9 upstream.

The interconnect framework currently expects that providers are only
removed when there are no users and after all nodes have been removed.

There is currently nothing that guarantees this to be the case and the
framework does not do any reference counting, but refusing to remove the
provider is never correct as that would leave a dangling pointer to a
resource that is about to be released in the global provider list (e.g.
accessible through debugfs).

Replace the current sanity checks with WARN_ON() so that the provider is
always removed.

Fixes: 011f637d6b07 ("interconnect: Add generic on-chip interconnect API")
Cc: stable@vger.kernel.org # 5.1: 2191979bfcf0: interconnect: Make icc_provider_del() return void
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # i.MX8MP MSC SM2-MB-EP1 Board
Link: https://lore.kernel.org/r/20230306075651.2449-3-johan+linaro@kernel.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/interconnect/core.c