diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-03-25 19:09:54 +0200 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-03-14 10:57:00 -0400 |
commit | 7d2c745caed47eb6c77238338bc01621f25a820c (patch) | |
tree | 001c860bf4c24a54b0f842fdaec5ba60cd003215 | |
parent | bcdf4fed726fd61b9d6b009a933269dca5b75d5d (diff) |
UBIFS: fix oops on error path in read_pnode
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: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r-- | fs/ubifs/lpt.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c index ad7f67b827e..ead230e0878 100644 --- a/fs/ubifs/lpt.c +++ b/fs/ubifs/lpt.c @@ -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 |