]> 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)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 14 Apr 2011 23:52:57 +0000 (16:52 -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>
fs/ubifs/lpt.c

index b2792e84d2452fd37e27991b42c1ab5754044de4..d0dfe7a0dedfdb5c90660f2c7b0c18fd601e5c27 100644 (file)
@@ -1269,10 +1269,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