diff options
author | Adam Greenblatt <adam.greenblatt@gmail.com> | 2008-07-25 04:46:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 13:53:33 -0400 |
commit | c0a1633b6201ef79e31b7da464d44fdf5953054d (patch) | |
tree | f379e3541e56aa805c5e3b15b2e5eadd3ca8cc28 | |
parent | 275c0a8f1253a7542ad9726956c918d8a1f694c4 (diff) |
isofs: fix minor filesystem corruption
Some iso9660 images contain files with rockridge data that is either
incorrect or incompletely parsed. Prior to commit
f2966632a134e865db3c819346a1dc7d96e05309 ("[PATCH] rock: handle directory
overflows") (included with kernel 2.6.13) the kernel ignored the rockridge
data for these files, while still allowing the files to be accessed under
their non-rockridge names. That commit inadvertently changed things so
that files with invalid rockridge data could not be accessed at all. (I
ran across the problem when comparing some old CDs with hard disk copies I
had made long ago under kernel 2.4: a few of the files on the hard disk
copies were no longer visible on the CDs.)
This change reverts to the pre-2.6.13 behavior.
Signed-off-by: Adam Greenblatt <adam.greenblatt@gmail.com>
Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: <stable@kernel.org> [2.6.25.x, 2.6.26.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/isofs/rock.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c index 6bd48f0a7047..c2fb2dd0131f 100644 --- a/fs/isofs/rock.c +++ b/fs/isofs/rock.c | |||
@@ -209,6 +209,11 @@ repeat: | |||
209 | 209 | ||
210 | while (rs.len > 2) { /* There may be one byte for padding somewhere */ | 210 | while (rs.len > 2) { /* There may be one byte for padding somewhere */ |
211 | rr = (struct rock_ridge *)rs.chr; | 211 | rr = (struct rock_ridge *)rs.chr; |
212 | /* | ||
213 | * Ignore rock ridge info if rr->len is out of range, but | ||
214 | * don't return -EIO because that would make the file | ||
215 | * invisible. | ||
216 | */ | ||
212 | if (rr->len < 3) | 217 | if (rr->len < 3) |
213 | goto out; /* Something got screwed up here */ | 218 | goto out; /* Something got screwed up here */ |
214 | sig = isonum_721(rs.chr); | 219 | sig = isonum_721(rs.chr); |
@@ -216,8 +221,12 @@ repeat: | |||
216 | goto eio; | 221 | goto eio; |
217 | rs.chr += rr->len; | 222 | rs.chr += rr->len; |
218 | rs.len -= rr->len; | 223 | rs.len -= rr->len; |
224 | /* | ||
225 | * As above, just ignore the rock ridge info if rr->len | ||
226 | * is bogus. | ||
227 | */ | ||
219 | if (rs.len < 0) | 228 | if (rs.len < 0) |
220 | goto eio; /* corrupted isofs */ | 229 | goto out; /* Something got screwed up here */ |
221 | 230 | ||
222 | switch (sig) { | 231 | switch (sig) { |
223 | case SIG('R', 'R'): | 232 | case SIG('R', 'R'): |
@@ -307,6 +316,11 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de, | |||
307 | repeat: | 316 | repeat: |
308 | while (rs.len > 2) { /* There may be one byte for padding somewhere */ | 317 | while (rs.len > 2) { /* There may be one byte for padding somewhere */ |
309 | rr = (struct rock_ridge *)rs.chr; | 318 | rr = (struct rock_ridge *)rs.chr; |
319 | /* | ||
320 | * Ignore rock ridge info if rr->len is out of range, but | ||
321 | * don't return -EIO because that would make the file | ||
322 | * invisible. | ||
323 | */ | ||
310 | if (rr->len < 3) | 324 | if (rr->len < 3) |
311 | goto out; /* Something got screwed up here */ | 325 | goto out; /* Something got screwed up here */ |
312 | sig = isonum_721(rs.chr); | 326 | sig = isonum_721(rs.chr); |
@@ -314,8 +328,12 @@ repeat: | |||
314 | goto eio; | 328 | goto eio; |
315 | rs.chr += rr->len; | 329 | rs.chr += rr->len; |
316 | rs.len -= rr->len; | 330 | rs.len -= rr->len; |
331 | /* | ||
332 | * As above, just ignore the rock ridge info if rr->len | ||
333 | * is bogus. | ||
334 | */ | ||
317 | if (rs.len < 0) | 335 | if (rs.len < 0) |
318 | goto eio; /* corrupted isofs */ | 336 | goto out; /* Something got screwed up here */ |
319 | 337 | ||
320 | switch (sig) { | 338 | switch (sig) { |
321 | #ifndef CONFIG_ZISOFS /* No flag for SF or ZF */ | 339 | #ifndef CONFIG_ZISOFS /* No flag for SF or ZF */ |