]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
UBI: fix memory leak in update path
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 18 Jan 2010 14:43:44 +0000 (16:43 +0200)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 18 Jan 2010 16:53:56 +0000 (18:53 +0200)
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
drivers/mtd/ubi/upd.c

index c1d7b880c7953969a282969637b69f052a8454ed..425bf5a3edd4778b0dc2e3bcc6a47f0f5e1cca18 100644 (file)
@@ -155,6 +155,7 @@ int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol,
                if (err)
                        return err;
                vol->updating = 0;
+               return 0;
        }
 
        vol->upd_buf = vmalloc(ubi->leb_size);