aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfs/super.c
diff options
context:
space:
mode:
authorAlexey Khoroshilov <khoroshilov@ispras.ru>2013-04-30 18:27:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 20:04:05 -0400
commit9509f17851da294f8ecf0fc0bfe0fe609671352d (patch)
treef1cbc43a20bf1d4d81fb31d0dedf9ad4463bda60 /fs/hfs/super.c
parenteb53b6db7a53642b80b0ca4885cb91d5c7dbc0f8 (diff)
hfs: add error checking for hfs_find_init()
hfs_find_init() may fail with ENOMEM, but there are places, where the returned value is not checked. The consequences can be very unpleasant, e.g. kfree uninitialized pointer and inappropriate mutex unlocking. The patch adds checks for errors in hfs_find_init(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Reviewed-by: Vyacheslav Dubeyko <slava@dubeyko.com> Cc: Hin-Tak Leung <htl10@users.sourceforge.net> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/hfs/super.c')
-rw-r--r--fs/hfs/super.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/hfs/super.c b/fs/hfs/super.c
index bbaaa8a4ee64..719760b2b0a6 100644
--- a/fs/hfs/super.c
+++ b/fs/hfs/super.c
@@ -418,7 +418,9 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
418 } 418 }
419 419
420 /* try to get the root inode */ 420 /* try to get the root inode */
421 hfs_find_init(HFS_SB(sb)->cat_tree, &fd); 421 res = hfs_find_init(HFS_SB(sb)->cat_tree, &fd);
422 if (res)
423 goto bail_no_root;
422 res = hfs_cat_find_brec(sb, HFS_ROOT_CNID, &fd); 424 res = hfs_cat_find_brec(sb, HFS_ROOT_CNID, &fd);
423 if (!res) { 425 if (!res) {
424 if (fd.entrylength > sizeof(rec) || fd.entrylength < 0) { 426 if (fd.entrylength > sizeof(rec) || fd.entrylength < 0) {