aboutsummaryrefslogtreecommitdiffstats
path: root/fs/isofs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/isofs')
-rw-r--r--fs/isofs/rock.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index 977dd7009c07..9a81830abff8 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -81,9 +81,22 @@ static void init_rock_state(struct rock_state *rs, struct inode *inode)
81static int rock_continue(struct rock_state *rs) 81static int rock_continue(struct rock_state *rs)
82{ 82{
83 int ret = 1; 83 int ret = 1;
84 int blocksize = 1 << rs->inode->i_blkbits;
85 const int min_de_size = offsetof(struct rock_ridge, u);
84 86
85 kfree(rs->buffer); 87 kfree(rs->buffer);
86 rs->buffer = NULL; 88 rs->buffer = NULL;
89
90 if ((unsigned)rs->cont_offset > blocksize - min_de_size ||
91 (unsigned)rs->cont_size > blocksize ||
92 (unsigned)(rs->cont_offset + rs->cont_size) > blocksize) {
93 printk(KERN_NOTICE "rock: corrupted directory entry. "
94 "extent=%d, offset=%d, size=%d\n",
95 rs->cont_extent, rs->cont_offset, rs->cont_size);
96 ret = -EIO;
97 goto out;
98 }
99
87 if (rs->cont_extent) { 100 if (rs->cont_extent) {
88 struct buffer_head *bh; 101 struct buffer_head *bh;
89 102