Skip to content

Commit

Permalink
logfs: handle errors from get_mtd_device()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
error27 authored and Joern Engel committed May 7, 2010
1 parent 58e323c commit ccf31c1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/logfs/dev_mtd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit ccf31c1

Please sign in to comment.