diff options
Diffstat (limited to 'fs/hfs')
-rw-r--r-- | fs/hfs/bnode.c | 1 | ||||
-rw-r--r-- | fs/hfs/btree.c | 1 | ||||
-rw-r--r-- | fs/hfs/catalog.c | 4 | ||||
-rw-r--r-- | fs/hfs/dir.c | 11 | ||||
-rw-r--r-- | fs/hfs/hfs_fs.h | 2 | ||||
-rw-r--r-- | fs/hfs/inode.c | 2 | ||||
-rw-r--r-- | fs/hfs/mdb.c | 1 | ||||
-rw-r--r-- | fs/hfs/super.c | 8 |
8 files changed, 27 insertions, 3 deletions
diff --git a/fs/hfs/bnode.c b/fs/hfs/bnode.c index 0d200068d0af..cdb41a1f6a64 100644 --- a/fs/hfs/bnode.c +++ b/fs/hfs/bnode.c | |||
@@ -9,6 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/pagemap.h> | 11 | #include <linux/pagemap.h> |
12 | #include <linux/slab.h> | ||
12 | #include <linux/swap.h> | 13 | #include <linux/swap.h> |
13 | 14 | ||
14 | #include "btree.h" | 15 | #include "btree.h" |
diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c index 052f214ea6f0..38a0a9917d7f 100644 --- a/fs/hfs/btree.c +++ b/fs/hfs/btree.c | |||
@@ -9,6 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/pagemap.h> | 11 | #include <linux/pagemap.h> |
12 | #include <linux/slab.h> | ||
12 | #include <linux/log2.h> | 13 | #include <linux/log2.h> |
13 | 14 | ||
14 | #include "btree.h" | 15 | #include "btree.h" |
diff --git a/fs/hfs/catalog.c b/fs/hfs/catalog.c index 6d98f116ca03..424b0337f524 100644 --- a/fs/hfs/catalog.c +++ b/fs/hfs/catalog.c | |||
@@ -289,6 +289,10 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, struct qstr *src_name, | |||
289 | err = hfs_brec_find(&src_fd); | 289 | err = hfs_brec_find(&src_fd); |
290 | if (err) | 290 | if (err) |
291 | goto out; | 291 | goto out; |
292 | if (src_fd.entrylength > sizeof(entry) || src_fd.entrylength < 0) { | ||
293 | err = -EIO; | ||
294 | goto out; | ||
295 | } | ||
292 | 296 | ||
293 | hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset, | 297 | hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset, |
294 | src_fd.entrylength); | 298 | src_fd.entrylength); |
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c index 7c69b98a2e45..2b3b8611b41b 100644 --- a/fs/hfs/dir.c +++ b/fs/hfs/dir.c | |||
@@ -79,6 +79,11 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
79 | filp->f_pos++; | 79 | filp->f_pos++; |
80 | /* fall through */ | 80 | /* fall through */ |
81 | case 1: | 81 | case 1: |
82 | if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) { | ||
83 | err = -EIO; | ||
84 | goto out; | ||
85 | } | ||
86 | |||
82 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength); | 87 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength); |
83 | if (entry.type != HFS_CDR_THD) { | 88 | if (entry.type != HFS_CDR_THD) { |
84 | printk(KERN_ERR "hfs: bad catalog folder thread\n"); | 89 | printk(KERN_ERR "hfs: bad catalog folder thread\n"); |
@@ -109,6 +114,12 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
109 | err = -EIO; | 114 | err = -EIO; |
110 | goto out; | 115 | goto out; |
111 | } | 116 | } |
117 | |||
118 | if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) { | ||
119 | err = -EIO; | ||
120 | goto out; | ||
121 | } | ||
122 | |||
112 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength); | 123 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength); |
113 | type = entry.type; | 124 | type = entry.type; |
114 | len = hfs_mac2asc(sb, strbuf, &fd.key->cat.CName); | 125 | len = hfs_mac2asc(sb, strbuf, &fd.key->cat.CName); |
diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h index 052387e11671..fe35e3b626c4 100644 --- a/fs/hfs/hfs_fs.h +++ b/fs/hfs/hfs_fs.h | |||
@@ -188,7 +188,7 @@ extern const struct address_space_operations hfs_btree_aops; | |||
188 | 188 | ||
189 | extern struct inode *hfs_new_inode(struct inode *, struct qstr *, int); | 189 | extern struct inode *hfs_new_inode(struct inode *, struct qstr *, int); |
190 | extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *); | 190 | extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *); |
191 | extern int hfs_write_inode(struct inode *, int); | 191 | extern int hfs_write_inode(struct inode *, struct writeback_control *); |
192 | extern int hfs_inode_setattr(struct dentry *, struct iattr *); | 192 | extern int hfs_inode_setattr(struct dentry *, struct iattr *); |
193 | extern void hfs_inode_read_fork(struct inode *inode, struct hfs_extent *ext, | 193 | extern void hfs_inode_read_fork(struct inode *inode, struct hfs_extent *ext, |
194 | __be32 log_size, __be32 phys_size, u32 clump_size); | 194 | __be32 log_size, __be32 phys_size, u32 clump_size); |
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index a1cbff2b4d99..14f5cb1b9fdc 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c | |||
@@ -381,7 +381,7 @@ void hfs_inode_write_fork(struct inode *inode, struct hfs_extent *ext, | |||
381 | HFS_SB(inode->i_sb)->alloc_blksz); | 381 | HFS_SB(inode->i_sb)->alloc_blksz); |
382 | } | 382 | } |
383 | 383 | ||
384 | int hfs_write_inode(struct inode *inode, int unused) | 384 | int hfs_write_inode(struct inode *inode, struct writeback_control *wbc) |
385 | { | 385 | { |
386 | struct inode *main_inode = inode; | 386 | struct inode *main_inode = inode; |
387 | struct hfs_find_data fd; | 387 | struct hfs_find_data fd; |
diff --git a/fs/hfs/mdb.c b/fs/hfs/mdb.c index 8bbe03c3f6d5..86428f5ac991 100644 --- a/fs/hfs/mdb.c +++ b/fs/hfs/mdb.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/cdrom.h> | 11 | #include <linux/cdrom.h> |
12 | #include <linux/genhd.h> | 12 | #include <linux/genhd.h> |
13 | #include <linux/nls.h> | 13 | #include <linux/nls.h> |
14 | #include <linux/slab.h> | ||
14 | 15 | ||
15 | #include "hfs_fs.h" | 16 | #include "hfs_fs.h" |
16 | #include "btree.h" | 17 | #include "btree.h" |
diff --git a/fs/hfs/super.c b/fs/hfs/super.c index f7fcbe49da72..0a81eb7111f3 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/nls.h> | 19 | #include <linux/nls.h> |
20 | #include <linux/parser.h> | 20 | #include <linux/parser.h> |
21 | #include <linux/seq_file.h> | 21 | #include <linux/seq_file.h> |
22 | #include <linux/slab.h> | ||
22 | #include <linux/smp_lock.h> | 23 | #include <linux/smp_lock.h> |
23 | #include <linux/vfs.h> | 24 | #include <linux/vfs.h> |
24 | 25 | ||
@@ -409,8 +410,13 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) | |||
409 | /* try to get the root inode */ | 410 | /* try to get the root inode */ |
410 | hfs_find_init(HFS_SB(sb)->cat_tree, &fd); | 411 | hfs_find_init(HFS_SB(sb)->cat_tree, &fd); |
411 | res = hfs_cat_find_brec(sb, HFS_ROOT_CNID, &fd); | 412 | res = hfs_cat_find_brec(sb, HFS_ROOT_CNID, &fd); |
412 | if (!res) | 413 | if (!res) { |
414 | if (fd.entrylength > sizeof(rec) || fd.entrylength < 0) { | ||
415 | res = -EIO; | ||
416 | goto bail; | ||
417 | } | ||
413 | hfs_bnode_read(fd.bnode, &rec, fd.entryoffset, fd.entrylength); | 418 | hfs_bnode_read(fd.bnode, &rec, fd.entryoffset, fd.entrylength); |
419 | } | ||
414 | if (res) { | 420 | if (res) { |
415 | hfs_find_exit(&fd); | 421 | hfs_find_exit(&fd); |
416 | goto bail_no_root; | 422 | goto bail_no_root; |