summaryrefslogtreecommitdiffstats
path: root/fs/isofs
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-06-01 03:16:17 +0000
committerRalf Baechle <ralf@linux-mips.org>1997-06-01 03:16:17 +0000
commitd8d9b8f76f22b7a16a83e261e64f89ee611f49df (patch)
tree3067bc130b80d52808e6390c9fc7fc087ec1e33c /fs/isofs
parent19c9bba94152148523ba0f7ef7cffe3d45656b11 (diff)
Initial revision
Diffstat (limited to 'fs/isofs')
-rw-r--r--fs/isofs/dir.c5
-rw-r--r--fs/isofs/inode.c8
-rw-r--r--fs/isofs/namei.c26
-rw-r--r--fs/isofs/rock.c43
4 files changed, 13 insertions, 69 deletions
diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
index 7a4943ede..30d0bf4c4 100644
--- a/fs/isofs/dir.c
+++ b/fs/isofs/dir.c
@@ -121,6 +121,11 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
char *name;
struct iso_directory_record *de;
+ if( filp->f_pos >= inode->i_size ) {
+ return 0;
+
+ }
+
offset = filp->f_pos & (bufsize - 1);
block = isofs_bmap(inode, filp->f_pos >> bufbits);
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 8d9ce9d96..708198a00 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -138,13 +138,7 @@ static int parse_options(char *options, struct iso9660_options * popt)
!strcmp(this_char,"uid") ||
!strcmp(this_char,"gid"))) {
char * vpnt = value;
- unsigned int ivalue;
- ivalue = 0;
- while(*vpnt){
- if(*vpnt < '0' || *vpnt > '9') break;
- ivalue = ivalue * 10 + (*vpnt - '0');
- vpnt++;
- }
+ unsigned int ivalue = simple_strtoul(vpnt, &vpnt, 0);
if (*vpnt) return 0;
switch(*this_char) {
case 'b':
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c
index 71f816b47..06ccfde5c 100644
--- a/fs/isofs/namei.c
+++ b/fs/isofs/namei.c
@@ -65,7 +65,6 @@ static struct buffer_head * isofs_find_entry(struct inode * dir,
unsigned char bufbits = ISOFS_BUFFER_BITS(dir);
unsigned int block, i, f_pos, offset, inode_number;
struct buffer_head * bh;
- void * cpnt = NULL;
unsigned int old_offset;
unsigned int backlink;
int dlen, rrflag, match;
@@ -117,21 +116,8 @@ static struct buffer_head * isofs_find_entry(struct inode * dir,
/* Handle case where the directory entry spans two blocks.
Usually 1024 byte boundaries */
if (offset >= bufsize) {
- unsigned int frag1;
- frag1 = bufsize - old_offset;
- cpnt = kmalloc(*((unsigned char *) de),GFP_KERNEL);
- if (!cpnt) return 0;
- memcpy(cpnt, bh->b_data + old_offset, frag1);
-
- de = (struct iso_directory_record *) cpnt;
- brelse(bh);
- offset = f_pos & (bufsize - 1);
- block = isofs_bmap(dir,f_pos>>bufbits);
- if (!block || !(bh = bread(dir->i_dev,block,bufsize))) {
- kfree(cpnt);
- return 0;
- };
- memcpy((char *)cpnt+frag1, bh->b_data, offset);
+ printk("Directory entry extends past end of iso9660 block\n");
+ return 0;
}
/* Handle the '.' case */
@@ -190,12 +176,6 @@ static struct buffer_head * isofs_find_entry(struct inode * dir,
match = isofs_match(namelen,name,dpnt,dlen);
}
- if (cpnt)
- {
- kfree(cpnt);
- cpnt = NULL;
- }
-
if(rrflag) kfree(dpnt);
if (match) {
if(inode_number == -1) {
@@ -217,8 +197,6 @@ static struct buffer_head * isofs_find_entry(struct inode * dir,
}
}
out:
- if (cpnt)
- kfree(cpnt);
brelse(bh);
return NULL;
}
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index 6f4539045..a9bb95f52 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -60,21 +60,6 @@
block = cont_extent; \
offset = cont_offset; \
offset1 = 0; \
- if(ISOFS_BUFFER_SIZE(DEV) == 1024) { \
- block <<= 1; \
- if (offset >= 1024) block++; \
- offset &= 1023; \
- if(offset + cont_size >= 1024) { \
- bh = bread(DEV->i_dev, block++, ISOFS_BUFFER_SIZE(DEV)); \
- if(!bh) {printk("Unable to read continuation Rock Ridge record\n"); \
- kfree(buffer); \
- buffer = NULL; } else { \
- memcpy(buffer, bh->b_data + offset, 1024 - offset); \
- brelse(bh); \
- offset1 = 1024 - offset; \
- offset = 0;} \
- } \
- }; \
if(buffer) { \
bh = bread(DEV->i_dev, block, ISOFS_BUFFER_SIZE(DEV)); \
if(bh){ \
@@ -429,7 +414,6 @@ char * get_rock_ridge_symlink(struct inode * inode)
unsigned char bufbits = ISOFS_BUFFER_BITS(inode);
struct buffer_head * bh;
unsigned char * pnt;
- void * cpnt = NULL;
char * rpnt;
struct iso_directory_record * raw_inode;
CONTINUE_DECLS;
@@ -455,24 +439,12 @@ char * get_rock_ridge_symlink(struct inode * inode)
raw_inode = ((struct iso_directory_record *) pnt);
+ /*
+ * If we go past the end of the buffer, there is some sort of error.
+ */
if ((inode->i_ino & (bufsize - 1)) + *pnt > bufsize){
- int frag1, offset;
-
- offset = (inode->i_ino & (bufsize - 1));
- frag1 = bufsize - offset;
- cpnt = kmalloc(*pnt,GFP_KERNEL);
- if(!cpnt) return NULL;
- memcpy(cpnt, bh->b_data + offset, frag1);
- brelse(bh);
- if (!(bh = bread(inode->i_dev,++block, bufsize))) {
- kfree(cpnt);
- printk("unable to read i-node block");
- return NULL;
- };
- offset += *pnt - bufsize;
- memcpy((char *)cpnt+frag1, bh->b_data, offset);
- pnt = ((unsigned char *) cpnt);
- raw_inode = ((struct iso_directory_record *) pnt);
+ printk("symlink spans iso9660 blocks\n");
+ return NULL;
};
/* Now test for possible Rock Ridge extensions which will override some of
@@ -558,11 +530,6 @@ char * get_rock_ridge_symlink(struct inode * inode)
MAYBE_CONTINUE(repeat,inode);
brelse(bh);
- if (cpnt) {
- kfree(cpnt);
- cpnt = NULL;
- };
-
return rpnt;
out:
if(buffer) kfree(buffer);