From 6dcfb80264be6f83240450428ead88cacadef2cd Mon Sep 17 00:00:00 2001 From: hujianyang Date: Wed, 11 Jun 2014 10:38:45 +0800 Subject: [PATCH] UBIFS: fix error path in create_default_filesystem() In the end of 'create_default_filesystem()' we need to check the return value of 'ubifs_write_node()' to ensure that we have successfully written the 'cs_node'. Signed-off-by: hujianyang Signed-off-by: Artem Bityutskiy --- fs/ubifs/sb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c index c2c3d13efa1c..79c6dbbc0e04 100644 --- a/fs/ubifs/sb.c +++ b/fs/ubifs/sb.c @@ -332,6 +332,8 @@ static int create_default_filesystem(struct ubifs_info *c) cs->ch.node_type = UBIFS_CS_NODE; err = ubifs_write_node(c, cs, UBIFS_CS_NODE_SZ, UBIFS_LOG_LNUM, 0); kfree(cs); + if (err) + return err; ubifs_msg("default file-system created"); return 0; -- 2.39.5