Patchwork [12/14] ubifs: check return code of pnode_lookup

login
register
mail settings
Submitter Kulikov Vasiliy
Date Sept. 5, 2010, 6:33 p.m.
Message ID <1283711584-7587-1-git-send-email-segooon@gmail.com>
Download mbox | patch
Permalink /patch/63853/
State New
Headers show

Comments

Kulikov Vasiliy - Sept. 5, 2010, 6:33 p.m.
From: Vasiliy Kulikov <segooon@gmail.com>

Function pnode_lookup may return ERR_PTR(...). Check for it.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
---
 Compile tested.

 fs/ubifs/lpt_commit.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Patch

diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c
index d12535b..5c90dec 100644
--- a/fs/ubifs/lpt_commit.c
+++ b/fs/ubifs/lpt_commit.c
@@ -705,6 +705,9 @@  static int make_tree_dirty(struct ubifs_info *c)
 	struct ubifs_pnode *pnode;
 
 	pnode = pnode_lookup(c, 0);
+	if (IS_ERR(pnode))
+		return PTR_ERR(pnode);
+
 	while (pnode) {
 		do_make_pnode_dirty(c, pnode);
 		pnode = next_pnode_to_dirty(c, pnode);