]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: phram: fix a double free issue in error path
authorWen Yang <wenyang@linux.alibaba.com>
Wed, 18 Mar 2020 15:31:56 +0000 (23:31 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Apr 2020 08:36:45 +0000 (10:36 +0200)
commit2131aab194432744245091bb15fde7588703f0c5
tree54b4608f8a5403f6db2435529de4043edfa75a2a
parentff2d3f1e5dc1428dbec0b77e44d46758b19ca311
mtd: phram: fix a double free issue in error path

commit e327219c121a7e294f7938de0c429329779725b2 upstream.

The variable 'name' is released multiple times in the error path,
which may cause double free issues.
This problem is avoided by adding a goto label to release the memory
uniformly. And this change also makes the code a bit more cleaner.

Fixes: 28c4be4c7d90 ("mtd: fix memory leaks in phram_setup")
Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
Cc: Joern Engel <joern@lazybastard.org>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Vignesh Raghavendra <vigneshr@ti.com>
Cc: linux-mtd@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200318153156.25612-1-wenyang@linux.alibaba.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/devices/phram.c