linux-stable/fs/xfs
Brian Foster 2a2b5932db xfs: fix attr leaf header freemap.size underflow
The leaf format xattr addition helper xfs_attr3_leaf_add_work()
adjusts the block freemap in a couple places. The first update drops
the size of the freemap that the caller had already selected to
place the xattr name/value data. Before the function returns, it
also checks whether the entries array has encroached on a freemap
range by virtue of the new entry addition. This is necessary because
the entries array grows from the start of the block (but end of the
block header) towards the end of the block while the name/value data
grows from the end of the block in the opposite direction. If the
associated freemap is already empty, however, size is zero and the
subtraction underflows the field and causes corruption.

This is reproduced rarely by generic/070. The observed behavior is
that a smaller sized freemap is aligned to the end of the entries
list, several subsequent xattr additions land in larger freemaps and
the entries list expands into the smaller freemap until it is fully
consumed and then underflows. Note that it is not otherwise a
corruption for the entries array to consume an empty freemap because
the nameval list (i.e. the firstused pointer in the xattr header)
starts beyond the end of the corrupted freemap.

Update the freemap size modification to account for the fact that
the freemap entry can be empty and thus stale.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-11-15 21:15:29 -08:00
..
libxfs xfs: fix attr leaf header freemap.size underflow 2019-11-15 21:15:29 -08:00
scrub xfs: devirtualize ->data_bestfree_p 2019-11-10 16:54:24 -08:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
kmem.c xfs: Correct comment tyops -> typos 2019-11-10 10:21:57 -08:00
kmem.h xfs: add kmem_alloc_io() 2019-08-26 17:43:15 -07:00
Makefile xfs: remove the now unused dir ops infrastructure 2019-11-10 16:54:24 -08:00
mrlock.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs.h xfs: remove b_last_holder & associated macros 2018-08-12 08:37:31 -07:00
xfs_acl.c xfs: fix missing header includes 2019-11-07 13:00:53 -08:00
xfs_acl.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_aops.c xfs: add a xfs_inode_buftarg helper 2019-10-28 08:37:54 -07:00
xfs_aops.h xfs: add a xfs_inode_buftarg helper 2019-10-28 08:37:54 -07:00
xfs_attr_inactive.c xfs: add a btree entries pointer to struct xfs_da3_icnode_hdr 2019-11-10 16:54:19 -08:00
xfs_attr_list.c xfs: convert open coded corruption check to use XFS_IS_CORRUPT 2019-11-13 11:08:01 -08:00
xfs_bio_io.c xfs: chain bios the right way around in xfs_rw_bdev 2019-07-10 10:04:16 -07:00
xfs_bmap_item.c xfs: convert EIO to EFSCORRUPTED when log contents are invalid 2019-11-10 16:54:18 -08:00
xfs_bmap_item.h xfs: merge xfs_bud_init into xfs_trans_get_bud 2019-06-28 19:27:36 -07:00
xfs_bmap_util.c xfs: attach dquots before performing xfs_swap_extents 2019-11-11 12:42:52 -08:00
xfs_bmap_util.h xfs: simplify xfs_iomap_eof_align_last_fsb 2019-11-03 10:22:30 -08:00
xfs_buf.c xfs: Correct comment tyops -> typos 2019-11-10 10:21:57 -08:00
xfs_buf.h xfs: mark xfs_buf_free static 2019-10-28 08:37:54 -07:00
xfs_buf_item.c xfs: "optimize" buffer item log segment bitmap setting 2019-11-07 13:00:54 -08:00
xfs_buf_item.h xfs: remove the xfs_log_item_t typedef 2019-06-28 19:27:33 -07:00
xfs_dir2_readdir.c xfs: convert open coded corruption check to use XFS_IS_CORRUPT 2019-11-13 11:08:01 -08:00
xfs_discard.c xfs: kill the XFS_WANT_CORRUPT_* macros 2019-11-12 17:19:02 -08:00
xfs_discard.h
xfs_dquot.c xfs: remove the xfs_dq_logitem_t typedef 2019-11-13 18:22:26 -08:00
xfs_dquot.h xfs: remove the xfs_dq_logitem_t typedef 2019-11-13 18:22:26 -08:00
xfs_dquot_item.c fs: xfs: Remove KM_NOSLEEP and KM_SLEEP. 2019-08-26 12:06:22 -07:00
xfs_dquot_item.h xfs: remove the xfs_qoff_logitem_t typedef 2019-11-13 18:22:28 -08:00
xfs_error.c xfs: use super s_id instead of struct xfs_mount m_fsname 2019-11-05 08:28:25 -08:00
xfs_error.h xfs: kill the XFS_WANT_CORRUPT_* macros 2019-11-12 17:19:02 -08:00
xfs_export.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_export.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_extent_busy.c xfs: cleanup use of the XFS_ALLOC_ flags 2019-11-03 10:22:31 -08:00
xfs_extent_busy.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_extfree_item.c xfs: convert EIO to EFSCORRUPTED when log contents are invalid 2019-11-10 16:54:18 -08:00
xfs_extfree_item.h xfs: merge xfs_efd_init into xfs_trans_get_efd 2019-06-28 19:27:35 -07:00
xfs_file.c xfs: properly serialise fallocate against AIO+DIO 2019-10-31 09:17:55 -07:00
xfs_filestream.c xfs: fix another missing include 2019-11-13 18:22:41 -08:00
xfs_filestream.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_fsmap.c xfs: add missing assert in xfs_fsmap_owner_from_rmap 2019-11-05 08:28:27 -08:00
xfs_fsmap.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_fsops.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_fsops.h xfs: change some error-less functions to void types 2019-05-01 20:26:30 -07:00
xfs_globals.c xfs: multithreaded iwalk implementation 2019-07-03 07:33:26 -07:00
xfs_health.c xfs: introduce new v5 bulkstat structure 2019-07-03 20:36:26 -07:00
xfs_icache.c xfs: merge the projid fields in struct xfs_icdinode 2019-11-13 11:13:45 -08:00
xfs_icache.h xfs: rename the speculative block allocation reclaim toggle functions 2019-04-26 12:28:55 -07:00
xfs_icreate_item.c fs: xfs: Remove KM_NOSLEEP and KM_SLEEP. 2019-08-26 12:06:22 -07:00
xfs_icreate_item.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_inode.c xfs: Fix deadlock between AGI and AGF when target_ip exists in xfs_rename() 2019-11-13 11:13:45 -08:00
xfs_inode.h xfs: merge the projid fields in struct xfs_icdinode 2019-11-13 11:13:45 -08:00
xfs_inode_item.c xfs: merge the projid fields in struct xfs_icdinode 2019-11-13 11:13:45 -08:00
xfs_inode_item.h xfs: remove the xfs_log_item_t typedef 2019-06-28 19:27:33 -07:00
xfs_ioctl.c xfs: remove XFS_IOC_FSSETDM and XFS_IOC_FSSETDM_BY_HANDLE 2019-11-13 18:22:41 -08:00
xfs_ioctl.h xfs: remove XFS_IOC_FSSETDM and XFS_IOC_FSSETDM_BY_HANDLE 2019-11-13 18:22:41 -08:00
xfs_ioctl32.c xfs: remove XFS_IOC_FSSETDM and XFS_IOC_FSSETDM_BY_HANDLE 2019-11-13 18:22:41 -08:00
xfs_ioctl32.h xfs: remove XFS_IOC_FSSETDM and XFS_IOC_FSSETDM_BY_HANDLE 2019-11-13 18:22:41 -08:00
xfs_iomap.c xfs: convert open coded corruption check to use XFS_IS_CORRUPT 2019-11-13 11:08:01 -08:00
xfs_iomap.h xfs: simplify the xfs_iomap_write_direct calling 2019-11-03 10:22:30 -08:00
xfs_iops.c xfs: merge the projid fields in struct xfs_icdinode 2019-11-13 11:13:45 -08:00
xfs_iops.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_itable.c xfs: merge the projid fields in struct xfs_icdinode 2019-11-13 11:13:45 -08:00
xfs_itable.h xfs: remove all *_ITER_ABORT values 2019-08-29 21:22:41 -07:00
xfs_iwalk.c xfs: kill the XFS_WANT_CORRUPT_* macros 2019-11-12 17:19:02 -08:00
xfs_iwalk.h xfs: remove all *_ITER_CONTINUE values 2019-08-30 22:43:56 -07:00
xfs_linux.h xfs: add a XFS_IS_CORRUPT macro 2019-11-12 17:19:02 -08:00
xfs_log.c xfs: annotate functions that trip static checker locking checks 2019-11-10 10:21:58 -08:00
xfs_log.h fs: xfs: xfs_log: Change return type from int to void 2019-07-03 08:21:58 -07:00
xfs_log_cil.c xfs: Correct comment tyops -> typos 2019-11-10 10:21:57 -08:00
xfs_log_priv.h xfs: remove unused structure members & simple typedefs 2019-11-13 18:22:41 -08:00
xfs_log_recover.c xfs: fix some memory leaks in log recovery 2019-11-15 21:15:29 -08:00
xfs_message.c xfs: make the assertion message functions take a mount parameter 2019-11-05 08:28:27 -08:00
xfs_message.h xfs: make the assertion message functions take a mount parameter 2019-11-05 08:28:27 -08:00
xfs_mount.c xfs: convert open coded corruption check to use XFS_IS_CORRUPT 2019-11-13 11:08:01 -08:00
xfs_mount.h xfs: remove unused structure members & simple typedefs 2019-11-13 18:22:41 -08:00
xfs_mru_cache.c fs: xfs: Remove KM_NOSLEEP and KM_SLEEP. 2019-08-26 12:06:22 -07:00
xfs_mru_cache.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_ondisk.h xfs: wire up the v5 inumbers ioctl 2019-07-03 20:36:28 -07:00
xfs_pnfs.c xfs: use super s_id instead of struct xfs_mount m_fsname 2019-11-05 08:28:25 -08:00
xfs_pnfs.h
xfs_pwork.c xfs: poll waiting for quotacheck 2019-07-03 08:21:58 -07:00
xfs_pwork.h xfs: poll waiting for quotacheck 2019-07-03 08:21:58 -07:00
xfs_qm.c xfs: remove the xfs_quotainfo_t typedef 2019-11-13 18:22:23 -08:00
xfs_qm.h xfs: remove the xfs_quotainfo_t typedef 2019-11-13 18:22:23 -08:00
xfs_qm_bhv.c xfs: remove the xfs_disk_dquot_t and xfs_dquot_t 2019-11-13 11:13:45 -08:00
xfs_qm_syscalls.c xfs: Replace function declaration by actual definition 2019-11-13 18:22:40 -08:00
xfs_quota.h xfs: kill the xfs_dqtrx_t typedef 2019-04-23 08:36:23 -07:00
xfs_quotaops.c xfs: Sanity check flags of Q_XQUOTARM call 2019-10-24 08:05:24 -07:00
xfs_refcount_item.c xfs: convert EIO to EFSCORRUPTED when log contents are invalid 2019-11-10 16:54:18 -08:00
xfs_refcount_item.h xfs: merge xfs_cud_init into xfs_trans_get_cud 2019-06-28 19:27:35 -07:00
xfs_reflink.c xfs: don't set bmapi total block req where minleft is 2019-10-23 17:01:08 -07:00
xfs_reflink.h xfs: pass two imaps to xfs_reflink_allocate_cow 2019-10-21 09:04:58 -07:00
xfs_rmap_item.c xfs: convert EIO to EFSCORRUPTED when log contents are invalid 2019-11-10 16:54:18 -08:00
xfs_rmap_item.h xfs: merge xfs_rud_init into xfs_trans_get_rud 2019-06-28 19:27:36 -07:00
xfs_rtalloc.c xfs: don't set bmapi total block req where minleft is 2019-10-23 17:01:08 -07:00
xfs_rtalloc.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_stats.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_stats.h xfs: use offsetof() in place of offset macros for __xfsstats 2018-10-18 17:21:39 +11:00
xfs_super.c xfs: remove a stray tab in xfs_remount_rw() 2019-11-10 16:54:18 -08:00
xfs_super.h xfs: include QUOTA, FATAL ASSERT build options in XFS_BUILD_OPTIONS 2019-10-21 09:04:57 -07:00
xfs_symlink.c xfs: fix missing header includes 2019-11-07 13:00:53 -08:00
xfs_symlink.h xfs: Correct comment tyops -> typos 2019-11-10 10:21:57 -08:00
xfs_sysctl.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_sysctl.h xfs: multithreaded iwalk implementation 2019-07-03 07:33:26 -07:00
xfs_sysfs.c xfs: avoid unused to_mp() function warning 2019-09-24 09:40:19 -07:00
xfs_sysfs.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_trace.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_trace.h xfs: rename the m_writeio_* fields in struct xfs_mount 2019-10-29 09:50:12 -07:00
xfs_trans.c fs: xfs: Remove KM_NOSLEEP and KM_SLEEP. 2019-08-26 12:06:22 -07:00
xfs_trans.h xfs: merge xfs_trans_bmap.c into xfs_bmap_item.c 2019-06-28 19:29:42 -07:00
xfs_trans_ail.c xfs: Correct comment tyops -> typos 2019-11-10 10:21:57 -08:00
xfs_trans_buf.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_trans_dquot.c xfs: remove the xfs_qoff_logitem_t typedef 2019-11-13 18:22:28 -08:00
xfs_trans_priv.h xfs: don't use xfs_trans_free_items in the commit path 2019-06-28 19:27:31 -07:00
xfs_xattr.c xfs: fix missing header includes 2019-11-07 13:00:53 -08:00