]> 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)
committerAndi Kleen <ak@linux.intel.com>
Thu, 28 Apr 2011 15:20:53 +0000 (08:20 -0700)
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>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
fs/ubifs/lpt.c

index ad7f67b827ea3b568d571685c42dfc50fc721920..ead230e0878584fdc684ae44487dc1aedf4394e3 100644 (file)
@@ -1270,10 +1270,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