aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-05-07 10:59:06 +0200
committerJoern Engel <joern@logfs.org>2010-05-07 14:16:09 +0200
commitccf31c10f125ab5233c8517f91d4b3bd0bd60936 (patch)
tree88bc1107c31a8a325703ed40ffdba4e3af9754b8
parent58e323cf5e4ed621a6e88263aca40c3d9c3d9bfd (diff)
logfs: handle errors from get_mtd_device()
The get_mtd_device() function returns error pointers on failure and if we don't handle it, it leads to a crash. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Joern Engel <joern@logfs.org>
-rw-r--r--fs/logfs/dev_mtd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/logfs/dev_mtd.c b/fs/logfs/dev_mtd.c
index cafb6ef2e05..b02a4020241 100644
--- a/fs/logfs/dev_mtd.c
+++ b/fs/logfs/dev_mtd.c
@@ -250,5 +250,7 @@ int logfs_get_sb_mtd(struct file_system_type *type, int flags,
const struct logfs_device_ops *devops = &mtd_devops;
mtd = get_mtd_device(NULL, mtdnr);
+ if (IS_ERR(mtd))
+ return PTR_ERR(mtd);
return logfs_get_sb_device(type, flags, mtd, NULL, devops, mnt);
}