]> git.proxmox.com Git - mirror_ubuntu-focal-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)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 25 May 2020 08:41:29 +0000 (10:41 +0200)
commit6fb3c66ca97ffbd533a77f0b2fdc449768023607
tree4a8dd45e58ffe881d41066dad90c95d9a4516e1f
parent204c4060143b9e891bbc95dbb525e38e5839067f
mtd: phram: fix a double free issue in error path

BugLink: https://bugs.launchpad.net/bugs/1875660
commit 49c64df880570034308e4a9a49c4bc95cf8cdb33 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: 4f678a58d335 ("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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/mtd/devices/phram.c