Skip to content

Commit

Permalink
Squashfs: fix corruption check in get_dir_index_using_name()
Browse files Browse the repository at this point in the history
Patch "Squashfs: sanity check information from disk" from
Dan Carpenter adds a missing check for corruption in the
"size" field while reading the directory index from disk.

It, however, sets err to -EINVAL, this value is not used later, and
so setting it is completely redundant.  So remove it.

Errors in reading the index are deliberately non-fatal.  If we
get an error in reading the index we just return the part of the
index we have managed to read - the index isn't essential,
just quicker.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
  • Loading branch information
Phillip Lougher committed Sep 6, 2013
1 parent e012526 commit 9dbc41d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions fs/squashfs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,8 @@ static int get_dir_index_using_name(struct super_block *sb,


size = le32_to_cpu(index->size) + 1;
if (size > SQUASHFS_NAME_LEN) {
err = -EINVAL;
if (size > SQUASHFS_NAME_LEN)
break;
}

err = squashfs_read_metadata(sb, index->name, &index_start,
&index_offset, size);
Expand Down

0 comments on commit 9dbc41d

Please sign in to comment.