]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: fix untrusted inode number lookup
authorDave Chinner <dchinner@redhat.com>
Tue, 24 Aug 2010 01:42:30 +0000 (11:42 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 24 Aug 2010 01:42:30 +0000 (11:42 +1000)
commit230ac10e3d9cf599fa1e764a4cc1bfabc032669c
tree55e4804119f4629279b1848b2a35eaf297b1d5bc
parent83e6a3b653f9c5c53cdbaab894345835ccace3af
xfs: fix untrusted inode number lookup

Commit da45ea9a237059ada7389b6a880e571b8a8252b7 ("xfs: validate untrusted inode
numbers during lookup") changes the inode lookup code to do btree lookups for
untrusted inode numbers. This change made an invalid assumption about the
alignment of inodes and hence incorrectly calculated the first inode in the
cluster. As a result, some inode numbers were being incorrectly considered
invalid when they were actually valid.

The issue was not picked up by the xfstests suite because it always runs fsr
and dump (the two utilities that utilise the bulkstat interface) on cache hot
inodes and hence the lookup code in the cold cache path was not sufficiently
exercised to uncover this intermittent problem.

Fix the issue by relaxing the btree lookup criteria and then checking if the
record returned contains the inode number we are lookup for. If it we get an
incorrect record, then the inode number is invalid.

Cc: <stable@kernel.org>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_ialloc.c