Commit 953a66b9 authored by Andries E. Brouwer's avatar Andries E. Brouwer Committed by Linus Torvalds

[PATCH] isofs fixes

This fixes two things.

On the one hand we have the old "cruft" mount option, that sometimes was
enabled automatically, for ridiculously large files or CDROMs.  But what
was ridiculous ten years ago, no longer is.  So, only decide that
something is cruft when the user said so. 

On the other hand, sometimes we get negative sizes.  That is caused by
assignments inode->i_size = isonum_733(), where the latter was declared
integer.  I made it unsigned int, as the standard also does.

(Someone with problems replied:
  >> Could you test the below?
  > Ok I did, the patch seems to work great!  Thanks!
)
parent e3a2c92a
......@@ -1265,31 +1265,14 @@ static void isofs_read_inode(struct inode * inode)
inode->i_size = isonum_733 (de->size);
}
/*
* The ISO-9660 filesystem only stores 32 bits for file size.
* mkisofs handles files up to 2GB-2 = 2147483646 = 0x7FFFFFFE bytes
* in size. This is according to the large file summit paper from 1996.
* WARNING: ISO-9660 filesystems > 1 GB and even > 2 GB are fully
* legal. Do not prevent to use DVD's schilling@fokus.gmd.de
*/
if ((inode->i_size < 0 || inode->i_size > 0x7FFFFFFE) &&
sbi->s_cruft == 'n') {
printk(KERN_WARNING "Warning: defective CD-ROM. "
"Enabling \"cruft\" mount option.\n");
sbi->s_cruft = 'y';
}
/*
* Some dipshit decided to store some other bit of information
* in the high byte of the file length. Catch this and holler.
* WARNING: this will make it impossible for a file to be > 16MB
* on the CDROM.
* in the high byte of the file length. Truncate size in case
* this CDROM was mounted with the cruft option.
*/
if (sbi->s_cruft == 'y' &&
inode->i_size & 0xff000000) {
if (sbi->s_cruft == 'y')
inode->i_size &= 0x00ffffff;
}
if (de->interleave[0]) {
printk("Interleaved files not (yet) supported.\n");
......
......@@ -190,28 +190,28 @@ static inline int isonum_712(char *p)
{
return *(s8 *)p;
}
static inline int isonum_721(char *p)
static inline unsigned int isonum_721(char *p)
{
return le16_to_cpu(get_unaligned((u16 *)p));
}
static inline int isonum_722(char *p)
static inline unsigned int isonum_722(char *p)
{
return be16_to_cpu(get_unaligned((u16 *)p));
}
static inline int isonum_723(char *p)
static inline unsigned int isonum_723(char *p)
{
/* Ignore bigendian datum due to broken mastering programs */
return le16_to_cpu(get_unaligned((u16 *)p));
}
static inline int isonum_731(char *p)
static inline unsigned int isonum_731(char *p)
{
return le32_to_cpu(get_unaligned((u32 *)p));
}
static inline int isonum_732(char *p)
static inline unsigned int isonum_732(char *p)
{
return be32_to_cpu(get_unaligned((u32 *)p));
}
static inline int isonum_733(char *p)
static inline unsigned int isonum_733(char *p)
{
/* Ignore bigendian datum due to broken mastering programs */
return le32_to_cpu(get_unaligned((u32 *)p));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment