]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: detect overflows in bmbt records
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 2 Dec 2020 20:25:43 +0000 (12:25 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 9 Dec 2020 17:49:38 +0000 (09:49 -0800)
commit1705e95a6967c586dcc43fecdbd0295bdacea39c
treebb0f20becf48b4b112356a06579d8d270b033366
parent678805d09d4f375a0531f9dd0d9713d7757a255a
xfs: detect overflows in bmbt records

Detect file block mappings with a blockcount that's either so large that
integer overflows occur or are zero, because neither are valid in the
filesystem.  Worse yet, attempting directory modifications causes the
iext code to trip over the bmbt key handling and takes the filesystem
down.  We can fix most of this by preventing the bad metadata from
entering the incore structures in the first place.

Found by setting blockcount=0 in a directory data fork mapping and
watching the fireworks.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/libxfs/xfs_bmap.c