]> git.baikalelectronics.ru Git - kernel.git/commit
nvmem: core: fix device node refcounting
authorMichael Walle <michael@walle.cc>
Fri, 27 Jan 2023 10:40:12 +0000 (10:40 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:25 +0000 (11:28 +0100)
commitf31a3829d82cec69686ea9f06b9719f0b0ee15b3
tree5072fb030a6f600736d4627744d292757b2ca422
parent192c5e1453bb067c0c788da39f142d0b62259a38
nvmem: core: fix device node refcounting

commit edcf2fb660526b5ed29f93bd17328a2b4835c8b2 upstream.

In of_nvmem_cell_get(), of_get_next_parent() is used on cell_np. This
will decrement the refcount on cell_np, but cell_np is still used later
in the code. Use of_get_parent() instead and of_node_put() in the
appropriate places.

Fixes: 0f00205455f5 ("nvmem: Add a simple NVMEM framework for consumers")
Fixes: 13ec7127ad5a ("nvmem: core: rework nvmem cell instance creation")
Cc: stable@vger.kernel.org
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230127104015.23839-8-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvmem/core.c