[PATCH v2] mtd: Fix possible refcounting issue when going through partition nodes

Miquel Raynal miquel.raynal at bootlin.com
Mon Feb 5 06:39:51 PST 2024


On Thu, 2024-01-04 at 08:14:46 UTC, Miquel Raynal wrote:
> Under normal conditions, the loop goes over all child partitions, and
> 'breaks' when the relevant partition is found. In this case we get a
> reference to the partition node without ever releasing it. Indeed, right
> after the mtd_check_of_node() function returns, we call of_node_get()
> again over this very same node. It is probably safer to keep the
> counters even in this helper and call of_node_put() before break-ing.
> 
> Reported-by: kernel test robot <lkp at intel.com>
> Reported-by: Julia Lawall <julia.lawall at inria.fr>
> Closes: https://lore.kernel.org/r/202312250546.ISzglvM2-lkp@intel.com/
> Cc: Christian Marangi <ansuelsmth at gmail.com>
> Cc: Rafał Miłecki <rafal at milecki.pl>
> Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/fixes.

Miquel



More information about the linux-mtd mailing list