Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

UBI: fix memory leak in update path

When truncating an UBI volume, UBI should allocates a PEB-sized
buffer but does not release it, which leads to memory leaks.
This patch fixes the issue.

Reported-by: Marek Skuczynski <mareksk7@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tested-by: Marek Skuczynski <mareksk7@gmail.com>
Cc: stable@kernel.org

+1
+1
drivers/mtd/ubi/upd.c
··· 155 155 if (err) 156 156 return err; 157 157 vol->updating = 0; 158 + return 0; 158 159 } 159 160 160 161 vol->upd_buf = vmalloc(ubi->leb_size);