Commit 2804eb00 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] UDF: directory reading fix

From: Ben Fennema <bfennema@falcon.csc.calpoly.edu>

The problem occured when files were stored on the disc in 16-bit per
character mode when all the upper bits were 0.  The fs module
converted the file name given by the user to a 8-bit per character
string to compare, so the comparison always failed.

The patch maps the file from disc into the current locale and then
compares it directly to the file name given by the user.
parent 8c04bc34
......@@ -154,8 +154,8 @@ udf_find_entry(struct inode *dir, struct dentry *dentry,
{
struct fileIdentDesc *fi=NULL;
loff_t f_pos;
int block, namelen;
char name[UDF_NAME_LEN], fname[UDF_NAME_LEN];
int block, flen;
char fname[UDF_NAME_LEN];
char *nameptr;
uint8_t lfi;
uint16_t liu;
......@@ -167,9 +167,6 @@ udf_find_entry(struct inode *dir, struct dentry *dentry,
if (!dir)
return NULL;
if ( !(namelen = udf_put_filename(dir->i_sb, dentry->d_name.name, name, dentry->d_name.len)))
return NULL;
f_pos = (udf_ext0_offset(dir) >> 2);
fibh->soffset = fibh->eoffset = (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2;
......@@ -253,12 +250,15 @@ udf_find_entry(struct inode *dir, struct dentry *dentry,
if (!lfi)
continue;
if (udf_match(namelen, name, lfi, nameptr))
if ((flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi)))
{
if (udf_match(flen, fname, dentry->d_name.len, dentry->d_name.name))
{
udf_release_data(bh);
return fi;
}
}
}
if (fibh->sbh != fibh->ebh)
udf_release_data(fibh->ebh);
udf_release_data(fibh->sbh);
......@@ -353,6 +353,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
char name[UDF_NAME_LEN], fname[UDF_NAME_LEN];
int namelen;
loff_t f_pos;
int flen;
char *nameptr;
loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2;
int nfidlen;
......@@ -480,7 +481,8 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
if (!lfi || !dentry)
continue;
if (udf_match(namelen, name, lfi, nameptr))
if ((flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi)) &&
udf_match(flen, fname, dentry->d_name.len, dentry->d_name.name))
{
if (fibh->sbh != fibh->ebh)
udf_release_data(fibh->ebh);
......
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