summaryrefslogtreecommitdiff
path: root/fs/f2fs/inode.c
diff options
context:
space:
mode:
authorNamjae Jeon <namjae.jeon@samsung.com>2013-03-17 17:27:20 +0900
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-03-20 18:30:16 +0900
commit064e0823285a41f5ccb92f26a661df5f44cac3eb (patch)
tree23c98e917ce8aaf3b5b0ee8a58da5701d7667a70 /fs/f2fs/inode.c
parentc0d39e65ba324390eb0ffb60661ab12104e5fcc7 (diff)
f2fs: avoid BUG_ON from check_nid_range and update return path in do_read_inode
In function check_nid_range, there is no need to trigger BUG_ON and make kernel stop. Instead it could just check and indicate the inode number to be EINVAL. Update the return path in do_read_inode to use the return from check_nid_range. Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com> [Jaegeuk: replace BUG_ON with WARN_ON] Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/inode.c')
-rw-r--r--fs/f2fs/inode.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index ddae412d30c8..e0e8308594a5 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -44,7 +44,11 @@ static int do_read_inode(struct inode *inode)
struct f2fs_inode *ri;
/* Check if ino is within scope */
- check_nid_range(sbi, inode->i_ino);
+ if (check_nid_range(sbi, inode->i_ino)) {
+ f2fs_msg(inode->i_sb, KERN_ERR, "bad inode number: %lu",
+ (unsigned long) inode->i_ino);
+ return -EINVAL;
+ }
node_page = get_node_page(sbi, inode->i_ino);
if (IS_ERR(node_page))