]> git.hungrycats.org Git - linux/commitdiff
XFS: Fix oops in xfs_file_readdir()
authorDavid Chinner <dgc@sgi.com>
Tue, 5 Feb 2008 23:52:15 +0000 (10:52 +1100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 26 Feb 2008 00:18:33 +0000 (16:18 -0800)
patch 450790a2c51e6d9d47ed30dbdcf486656b8e186f in mainline.

Several occurrences of oops in xfs_file_readdir() on ia32 have been
reported since 2.6.24 was released. This is a regression introduced
in 2.6.24 and is relatively easy to hit. The patch below fixes the
problem.

Signed-off-by: Dave Chinner <dgc@sgi.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/xfs/linux-2.6/xfs_file.c

index 21a1c2b1c5fcf716b779fb973ef31fa5acb6114c..edab1ffbb163ef8bc53335645aee1faa334e364d 100644 (file)
@@ -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)) {
@@ -362,7 +362,6 @@ xfs_file_readdir(
                                       sizeof(u64));
                        size -= reclen;
                        de = (struct hack_dirent *)((char *)de + reclen);
-                       curr_offset = de->offset /* & 0x7fffffff */;
                }
        }