diff options
Diffstat (limited to 'fs/isofs')
-rw-r--r-- | fs/isofs/dir.c | 8 | ||||
-rw-r--r-- | fs/isofs/isofs.h | 12 | ||||
-rw-r--r-- | fs/isofs/namei.c | 7 |
3 files changed, 21 insertions, 6 deletions
diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c index 1ba407c64df1..2f0dc5a14633 100644 --- a/fs/isofs/dir.c +++ b/fs/isofs/dir.c | |||
@@ -145,6 +145,14 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, | |||
145 | } | 145 | } |
146 | de = tmpde; | 146 | de = tmpde; |
147 | } | 147 | } |
148 | /* Basic sanity check, whether name doesn't exceed dir entry */ | ||
149 | if (de_len < de->name_len[0] + | ||
150 | sizeof(struct iso_directory_record)) { | ||
151 | printk(KERN_NOTICE "iso9660: Corrupted directory entry" | ||
152 | " in block %lu of inode %lu\n", block, | ||
153 | inode->i_ino); | ||
154 | return -EIO; | ||
155 | } | ||
148 | 156 | ||
149 | if (first_de) { | 157 | if (first_de) { |
150 | isofs_normalize_block_and_offset(de, | 158 | isofs_normalize_block_and_offset(de, |
diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h index d1bdf8adb351..ccbf72faf27a 100644 --- a/fs/isofs/isofs.h +++ b/fs/isofs/isofs.h | |||
@@ -78,29 +78,29 @@ static inline int isonum_712(char *p) | |||
78 | } | 78 | } |
79 | static inline unsigned int isonum_721(char *p) | 79 | static inline unsigned int isonum_721(char *p) |
80 | { | 80 | { |
81 | return le16_to_cpu(get_unaligned((__le16 *)p)); | 81 | return get_unaligned_le16(p); |
82 | } | 82 | } |
83 | static inline unsigned int isonum_722(char *p) | 83 | static inline unsigned int isonum_722(char *p) |
84 | { | 84 | { |
85 | return be16_to_cpu(get_unaligned((__le16 *)p)); | 85 | return get_unaligned_be16(p); |
86 | } | 86 | } |
87 | static inline unsigned int isonum_723(char *p) | 87 | static inline unsigned int isonum_723(char *p) |
88 | { | 88 | { |
89 | /* Ignore bigendian datum due to broken mastering programs */ | 89 | /* Ignore bigendian datum due to broken mastering programs */ |
90 | return le16_to_cpu(get_unaligned((__le16 *)p)); | 90 | return get_unaligned_le16(p); |
91 | } | 91 | } |
92 | static inline unsigned int isonum_731(char *p) | 92 | static inline unsigned int isonum_731(char *p) |
93 | { | 93 | { |
94 | return le32_to_cpu(get_unaligned((__le32 *)p)); | 94 | return get_unaligned_le32(p); |
95 | } | 95 | } |
96 | static inline unsigned int isonum_732(char *p) | 96 | static inline unsigned int isonum_732(char *p) |
97 | { | 97 | { |
98 | return be32_to_cpu(get_unaligned((__le32 *)p)); | 98 | return get_unaligned_be32(p); |
99 | } | 99 | } |
100 | static inline unsigned int isonum_733(char *p) | 100 | static inline unsigned int isonum_733(char *p) |
101 | { | 101 | { |
102 | /* Ignore bigendian datum due to broken mastering programs */ | 102 | /* Ignore bigendian datum due to broken mastering programs */ |
103 | return le32_to_cpu(get_unaligned((__le32 *)p)); | 103 | return get_unaligned_le32(p); |
104 | } | 104 | } |
105 | extern int iso_date(char *, int); | 105 | extern int iso_date(char *, int); |
106 | 106 | ||
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c index 344b247bc29a..8299889a835e 100644 --- a/fs/isofs/namei.c +++ b/fs/isofs/namei.c | |||
@@ -111,6 +111,13 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry, | |||
111 | 111 | ||
112 | dlen = de->name_len[0]; | 112 | dlen = de->name_len[0]; |
113 | dpnt = de->name; | 113 | dpnt = de->name; |
114 | /* Basic sanity check, whether name doesn't exceed dir entry */ | ||
115 | if (de_len < dlen + sizeof(struct iso_directory_record)) { | ||
116 | printk(KERN_NOTICE "iso9660: Corrupted directory entry" | ||
117 | " in block %lu of inode %lu\n", block, | ||
118 | dir->i_ino); | ||
119 | return 0; | ||
120 | } | ||
114 | 121 | ||
115 | if (sbi->s_rock && | 122 | if (sbi->s_rock && |
116 | ((i = get_rock_ridge_filename(de, tmpname, dir)))) { | 123 | ((i = get_rock_ridge_filename(de, tmpname, dir)))) { |