[PATCH] mtd: ubi: fix nvmem-layout reference leak

Daniel Golle daniel at makrotopia.org
Fri Nov 27 06:20:26 PST 2026


On Thu, Nov 26, 2026 at 11:00:33AM +0800, Zhiqi Zhang wrote:
> While reviewing the UBI NVMEM provider, I found that ubi_nvmem_add()
> only uses of_get_child_by_name() to check whether the UBI volume has an
> nvmem-layout child node. The helper returns a referenced device_node on
> success, so the current code leaks that reference when the child exists.
> 
> I fixed this by storing the child node pointer and dropping the reference
> once the existence check has completed.
> 
> Fixes: 3ce485803da1 ("mtd: ubi: provide NVMEM layer over UBI volumes")
> Signed-off-by: Zhiqi Zhang <zhiqizhangg at gmail.com>

Reviewed-by: Daniel Golle <daniel at makrotopia.org>
Cc: stable



More information about the linux-mtd mailing list