]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
UBIFS: fix oops on error path in read_pnode
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 25 Mar 2011 17:09:54 +0000 (19:09 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 30 Apr 2011 14:53:28 +0000 (16:53 +0200)
commit 54acbaaa523ca0bd284a18f67ad213c379679e86 upstream.

Thanks to coverity which spotted that UBIFS will oops if 'kmalloc()'
in 'read_pnode()' fails and we dereference a NULL 'pnode' pointer
when we 'goto out'.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/ubifs/lpt.c

index 9ff2463177e503f563f6f5cd543c339444d9638e..700a9258192a96aa2be68a3f6550917d6e679e38 100644 (file)
@@ -1240,10 +1240,9 @@ static int read_pnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip)
        lnum = branch->lnum;
        offs = branch->offs;
        pnode = kzalloc(sizeof(struct ubifs_pnode), GFP_NOFS);
-       if (!pnode) {
-               err = -ENOMEM;
-               goto out;
-       }
+       if (!pnode)
+               return -ENOMEM;
+
        if (lnum == 0) {
                /*
                 * This pnode was not written which just means that the LEB