Skip to content

Commit

Permalink
[XFS] Fix oops in xfs_file_readdir()
Browse files Browse the repository at this point in the history
When xfs_file_readdir() exactly fills a buffer, it can move it's index
past the end of the buffer and dereference it even though the result of
the dereference is never used. On some platforms this causes an oops.

SGI-PV: 976923
SGI-Modid: xfs-linux-melb:xfs-kern:30458a

Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
  • Loading branch information
David Chinner authored and Lachlan McIlroy committed Feb 7, 2008
1 parent cbc89dc commit 450790a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions fs/xfs/linux-2.6/xfs_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ xfs_file_readdir(

size = buf.used;
de = (struct hack_dirent *)buf.dirent;
curr_offset = de->offset /* & 0x7fffffff */;
while (size > 0) {
curr_offset = de->offset /* & 0x7fffffff */;
if (filldir(dirent, de->name, de->namlen,
curr_offset & 0x7fffffff,
de->ino, de->d_type)) {
Expand All @@ -362,7 +362,6 @@ xfs_file_readdir(
sizeof(u64));
size -= reclen;
de = (struct hack_dirent *)((char *)de + reclen);
curr_offset = de->offset /* & 0x7fffffff */;
}
}

Expand Down

0 comments on commit 450790a

Please sign in to comment.