diff options
Diffstat (limited to 'fs/jffs2')
| -rw-r--r-- | fs/jffs2/acl.c | 2 | ||||
| -rw-r--r-- | fs/jffs2/acl.h | 2 | ||||
| -rw-r--r-- | fs/jffs2/dir.c | 2 | ||||
| -rw-r--r-- | fs/jffs2/file.c | 2 | ||||
| -rw-r--r-- | fs/jffs2/ioctl.c | 3 | ||||
| -rw-r--r-- | fs/jffs2/os-linux.h | 2 | ||||
| -rw-r--r-- | fs/jffs2/summary.c | 40 | ||||
| -rw-r--r-- | fs/jffs2/summary.h | 6 | ||||
| -rw-r--r-- | fs/jffs2/super.c | 2 |
9 files changed, 39 insertions, 22 deletions
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c index 4c80404a9aba..d98713777a1b 100644 --- a/fs/jffs2/acl.c +++ b/fs/jffs2/acl.c | |||
| @@ -314,7 +314,7 @@ static int jffs2_check_acl(struct inode *inode, int mask) | |||
| 314 | return -EAGAIN; | 314 | return -EAGAIN; |
| 315 | } | 315 | } |
| 316 | 316 | ||
| 317 | int jffs2_permission(struct inode *inode, int mask, struct nameidata *nd) | 317 | int jffs2_permission(struct inode *inode, int mask) |
| 318 | { | 318 | { |
| 319 | return generic_permission(inode, mask, jffs2_check_acl); | 319 | return generic_permission(inode, mask, jffs2_check_acl); |
| 320 | } | 320 | } |
diff --git a/fs/jffs2/acl.h b/fs/jffs2/acl.h index 0bb7f003fd80..8ca058aed384 100644 --- a/fs/jffs2/acl.h +++ b/fs/jffs2/acl.h | |||
| @@ -28,7 +28,7 @@ struct jffs2_acl_header { | |||
| 28 | 28 | ||
| 29 | #define JFFS2_ACL_NOT_CACHED ((void *)-1) | 29 | #define JFFS2_ACL_NOT_CACHED ((void *)-1) |
| 30 | 30 | ||
| 31 | extern int jffs2_permission(struct inode *, int, struct nameidata *); | 31 | extern int jffs2_permission(struct inode *, int); |
| 32 | extern int jffs2_acl_chmod(struct inode *); | 32 | extern int jffs2_acl_chmod(struct inode *); |
| 33 | extern int jffs2_init_acl_pre(struct inode *, struct inode *, int *); | 33 | extern int jffs2_init_acl_pre(struct inode *, struct inode *, int *); |
| 34 | extern int jffs2_init_acl_post(struct inode *); | 34 | extern int jffs2_init_acl_post(struct inode *); |
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index c0c141f6fde1..cd219ef55254 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c | |||
| @@ -38,7 +38,7 @@ const struct file_operations jffs2_dir_operations = | |||
| 38 | { | 38 | { |
| 39 | .read = generic_read_dir, | 39 | .read = generic_read_dir, |
| 40 | .readdir = jffs2_readdir, | 40 | .readdir = jffs2_readdir, |
| 41 | .ioctl = jffs2_ioctl, | 41 | .unlocked_ioctl=jffs2_ioctl, |
| 42 | .fsync = jffs2_fsync | 42 | .fsync = jffs2_fsync |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index 5e920343b2c5..5a98aa87c853 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c | |||
| @@ -46,7 +46,7 @@ const struct file_operations jffs2_file_operations = | |||
| 46 | .aio_read = generic_file_aio_read, | 46 | .aio_read = generic_file_aio_read, |
| 47 | .write = do_sync_write, | 47 | .write = do_sync_write, |
| 48 | .aio_write = generic_file_aio_write, | 48 | .aio_write = generic_file_aio_write, |
| 49 | .ioctl = jffs2_ioctl, | 49 | .unlocked_ioctl=jffs2_ioctl, |
| 50 | .mmap = generic_file_readonly_mmap, | 50 | .mmap = generic_file_readonly_mmap, |
| 51 | .fsync = jffs2_fsync, | 51 | .fsync = jffs2_fsync, |
| 52 | .splice_read = generic_file_splice_read, | 52 | .splice_read = generic_file_splice_read, |
diff --git a/fs/jffs2/ioctl.c b/fs/jffs2/ioctl.c index e2177210f621..9d41f43e47bb 100644 --- a/fs/jffs2/ioctl.c +++ b/fs/jffs2/ioctl.c | |||
| @@ -12,8 +12,7 @@ | |||
| 12 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
| 13 | #include "nodelist.h" | 13 | #include "nodelist.h" |
| 14 | 14 | ||
| 15 | int jffs2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, | 15 | long jffs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
| 16 | unsigned long arg) | ||
| 17 | { | 16 | { |
| 18 | /* Later, this will provide for lsattr.jffs2 and chattr.jffs2, which | 17 | /* Later, this will provide for lsattr.jffs2 and chattr.jffs2, which |
| 19 | will include compression support etc. */ | 18 | will include compression support etc. */ |
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h index 2cc866cf134f..5e194a5c8e29 100644 --- a/fs/jffs2/os-linux.h +++ b/fs/jffs2/os-linux.h | |||
| @@ -167,7 +167,7 @@ int jffs2_fsync(struct file *, struct dentry *, int); | |||
| 167 | int jffs2_do_readpage_unlock (struct inode *inode, struct page *pg); | 167 | int jffs2_do_readpage_unlock (struct inode *inode, struct page *pg); |
| 168 | 168 | ||
| 169 | /* ioctl.c */ | 169 | /* ioctl.c */ |
| 170 | int jffs2_ioctl(struct inode *, struct file *, unsigned int, unsigned long); | 170 | long jffs2_ioctl(struct file *, unsigned int, unsigned long); |
| 171 | 171 | ||
| 172 | /* symlink.c */ | 172 | /* symlink.c */ |
| 173 | extern const struct inode_operations jffs2_symlink_inode_operations; | 173 | extern const struct inode_operations jffs2_symlink_inode_operations; |
diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c index 629af01e5ade..6caf1e1ee26d 100644 --- a/fs/jffs2/summary.c +++ b/fs/jffs2/summary.c | |||
| @@ -23,6 +23,8 @@ | |||
| 23 | 23 | ||
| 24 | int jffs2_sum_init(struct jffs2_sb_info *c) | 24 | int jffs2_sum_init(struct jffs2_sb_info *c) |
| 25 | { | 25 | { |
| 26 | uint32_t sum_size = max_t(uint32_t, c->sector_size, MAX_SUMMARY_SIZE); | ||
| 27 | |||
| 26 | c->summary = kzalloc(sizeof(struct jffs2_summary), GFP_KERNEL); | 28 | c->summary = kzalloc(sizeof(struct jffs2_summary), GFP_KERNEL); |
| 27 | 29 | ||
| 28 | if (!c->summary) { | 30 | if (!c->summary) { |
| @@ -30,7 +32,7 @@ int jffs2_sum_init(struct jffs2_sb_info *c) | |||
| 30 | return -ENOMEM; | 32 | return -ENOMEM; |
| 31 | } | 33 | } |
| 32 | 34 | ||
| 33 | c->summary->sum_buf = vmalloc(c->sector_size); | 35 | c->summary->sum_buf = kmalloc(sum_size, GFP_KERNEL); |
| 34 | 36 | ||
| 35 | if (!c->summary->sum_buf) { | 37 | if (!c->summary->sum_buf) { |
| 36 | JFFS2_WARNING("Can't allocate buffer for writing out summary information!\n"); | 38 | JFFS2_WARNING("Can't allocate buffer for writing out summary information!\n"); |
| @@ -49,7 +51,7 @@ void jffs2_sum_exit(struct jffs2_sb_info *c) | |||
| 49 | 51 | ||
| 50 | jffs2_sum_disable_collecting(c->summary); | 52 | jffs2_sum_disable_collecting(c->summary); |
| 51 | 53 | ||
| 52 | vfree(c->summary->sum_buf); | 54 | kfree(c->summary->sum_buf); |
| 53 | c->summary->sum_buf = NULL; | 55 | c->summary->sum_buf = NULL; |
| 54 | 56 | ||
| 55 | kfree(c->summary); | 57 | kfree(c->summary); |
| @@ -665,7 +667,7 @@ crc_err: | |||
| 665 | /* Write summary data to flash - helper function for jffs2_sum_write_sumnode() */ | 667 | /* Write summary data to flash - helper function for jffs2_sum_write_sumnode() */ |
| 666 | 668 | ||
| 667 | static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, | 669 | static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, |
| 668 | uint32_t infosize, uint32_t datasize, int padsize) | 670 | uint32_t infosize, uint32_t datasize, int padsize) |
| 669 | { | 671 | { |
| 670 | struct jffs2_raw_summary isum; | 672 | struct jffs2_raw_summary isum; |
| 671 | union jffs2_sum_mem *temp; | 673 | union jffs2_sum_mem *temp; |
| @@ -676,6 +678,26 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock | |||
| 676 | int ret; | 678 | int ret; |
| 677 | size_t retlen; | 679 | size_t retlen; |
| 678 | 680 | ||
| 681 | if (padsize + datasize > MAX_SUMMARY_SIZE) { | ||
| 682 | /* It won't fit in the buffer. Abort summary for this jeb */ | ||
| 683 | jffs2_sum_disable_collecting(c->summary); | ||
| 684 | |||
| 685 | JFFS2_WARNING("Summary too big (%d data, %d pad) in eraseblock at %08x\n", | ||
| 686 | datasize, padsize, jeb->offset); | ||
| 687 | /* Non-fatal */ | ||
| 688 | return 0; | ||
| 689 | } | ||
| 690 | /* Is there enough space for summary? */ | ||
| 691 | if (padsize < 0) { | ||
| 692 | /* don't try to write out summary for this jeb */ | ||
| 693 | jffs2_sum_disable_collecting(c->summary); | ||
| 694 | |||
| 695 | JFFS2_WARNING("Not enough space for summary, padsize = %d\n", | ||
| 696 | padsize); | ||
| 697 | /* Non-fatal */ | ||
| 698 | return 0; | ||
| 699 | } | ||
| 700 | |||
| 679 | memset(c->summary->sum_buf, 0xff, datasize); | 701 | memset(c->summary->sum_buf, 0xff, datasize); |
| 680 | memset(&isum, 0, sizeof(isum)); | 702 | memset(&isum, 0, sizeof(isum)); |
| 681 | 703 | ||
| @@ -821,7 +843,7 @@ int jffs2_sum_write_sumnode(struct jffs2_sb_info *c) | |||
| 821 | { | 843 | { |
| 822 | int datasize, infosize, padsize; | 844 | int datasize, infosize, padsize; |
| 823 | struct jffs2_eraseblock *jeb; | 845 | struct jffs2_eraseblock *jeb; |
| 824 | int ret; | 846 | int ret = 0; |
| 825 | 847 | ||
| 826 | dbg_summary("called\n"); | 848 | dbg_summary("called\n"); |
| 827 | 849 | ||
| @@ -841,16 +863,6 @@ int jffs2_sum_write_sumnode(struct jffs2_sb_info *c) | |||
| 841 | infosize += padsize; | 863 | infosize += padsize; |
| 842 | datasize += padsize; | 864 | datasize += padsize; |
| 843 | 865 | ||
| 844 | /* Is there enough space for summary? */ | ||
| 845 | if (padsize < 0) { | ||
| 846 | /* don't try to write out summary for this jeb */ | ||
| 847 | jffs2_sum_disable_collecting(c->summary); | ||
| 848 | |||
| 849 | JFFS2_WARNING("Not enough space for summary, padsize = %d\n", padsize); | ||
| 850 | spin_lock(&c->erase_completion_lock); | ||
| 851 | return 0; | ||
| 852 | } | ||
| 853 | |||
| 854 | ret = jffs2_sum_write_data(c, jeb, infosize, datasize, padsize); | 866 | ret = jffs2_sum_write_data(c, jeb, infosize, datasize, padsize); |
| 855 | spin_lock(&c->erase_completion_lock); | 867 | spin_lock(&c->erase_completion_lock); |
| 856 | return ret; | 868 | return ret; |
diff --git a/fs/jffs2/summary.h b/fs/jffs2/summary.h index 8bf34f2fa5ce..60207a2ae952 100644 --- a/fs/jffs2/summary.h +++ b/fs/jffs2/summary.h | |||
| @@ -13,6 +13,12 @@ | |||
| 13 | #ifndef JFFS2_SUMMARY_H | 13 | #ifndef JFFS2_SUMMARY_H |
| 14 | #define JFFS2_SUMMARY_H | 14 | #define JFFS2_SUMMARY_H |
| 15 | 15 | ||
| 16 | /* Limit summary size to 64KiB so that we can kmalloc it. If the summary | ||
| 17 | is larger than that, we have to just ditch it and avoid using summary | ||
| 18 | for the eraseblock in question... and it probably doesn't hurt us much | ||
| 19 | anyway. */ | ||
| 20 | #define MAX_SUMMARY_SIZE 65536 | ||
| 21 | |||
| 16 | #include <linux/uio.h> | 22 | #include <linux/uio.h> |
| 17 | #include <linux/jffs2.h> | 23 | #include <linux/jffs2.h> |
| 18 | 24 | ||
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 7da69eae49e4..efd401257ed9 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
| @@ -44,7 +44,7 @@ static void jffs2_destroy_inode(struct inode *inode) | |||
| 44 | kmem_cache_free(jffs2_inode_cachep, JFFS2_INODE_INFO(inode)); | 44 | kmem_cache_free(jffs2_inode_cachep, JFFS2_INODE_INFO(inode)); |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | static void jffs2_i_init_once(struct kmem_cache *cachep, void *foo) | 47 | static void jffs2_i_init_once(void *foo) |
| 48 | { | 48 | { |
| 49 | struct jffs2_inode_info *f = foo; | 49 | struct jffs2_inode_info *f = foo; |
| 50 | 50 | ||
