On Saturday 25 June 2005 01:23, [email protected] wrote:
> "dir" was dereferenced before null check
> --- 25/fs/udf/namei.c~coverity-fs-udf-namei-null-check
> +++ 25-akpm/fs/udf/namei.c
> @@ -159,7 +159,7 @@ udf_find_entry(struct inode *dir, struct
> char *nameptr;
> uint8_t lfi;
> uint16_t liu;
> - loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2;
> + loff_t size;
> kernel_lb_addr bloc, eloc;
> uint32_t extoffset, elen, offset;
> struct buffer_head *bh = NULL;
> @@ -167,6 +167,8 @@ udf_find_entry(struct inode *dir, struct
> if (!dir)
> return NULL;
>
> + size = (udf_ext0_offset(dir) + dir->i_size) >> 2;
> +
Let's see...
udf_find_entry() is called from:
1. udf_lookup(dir, ...)
udf_find_entry(dir, dentry, &fibh, &cfi);
2. udf_rmdir(dir, ...)
udf_find_entry(dir, dentry, &fibh, &cfi);
3. udf_unlink(dir, ...)
udf_find_entry(dir, dentry, &fibh, &cfi);
4. udf_rename(old_dir, old_dentry, new_dir, new_dentry)
udf_find_entry(old_dir, old_dentry, &ofibh, &ocfi);
udf_find_entry(new_dir, new_dentry, &nfibh, &ncfi);
udf_find_entry(old_dir, old_dentry, &ofibh, &ocfi);
So the question boils down to:
Can one call
1. ->lookup(NULL, ...) or
2. ->rmdir(NULL, ...) or
3. ->unlink(NULL, ...) or
4a. ->rename(NULL, ..., ..., ...) or
4b. ->rename(..., ..., NULL, ...) ?
1.
fs/namei.c:416: result = dir->i_op->lookup(dir, dentry, nd);
fs/namei.c:1084: dentry = inode->i_op->lookup(inode, new, nd);
2.
fs/namei.c:1797: error = dir->i_op->rmdir(dir, dentry);
3.
fs/namei.c:1871: error = dir->i_op->unlink(dir, dentry);
4.
fs/namei.c:2138: error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry);
=> Can one do vfs_rename_dir(..., ..., NULL, ...) ?
fs/namei.c:2172: error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry);
=> Can one do vfs_rename_other(..., ..., NULL, ...) ?
Both are called in vfs_rename(..., ..., new_dir, ...) where new_dir is passed
to may_create(new_dir, ..., ...) or may_delete(new_dir, ..., ...). Both
unconditionally dereference first argument.
Have I missed something?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]