xfs: prevent bogus assert when trying to remove non-existent attribute
Dave Chinner authored

If the attribute fork on an inode is in btree format and has
multiple levels (i.e node format rather than leaf format), then a
lookup failure will trigger an assert failure in xfs_da_path_shift
if the flag XFS_DA_OP_OKNOENT is not set. This flag is used to
indicate to the directory btree code that not finding an entry is
not a fatal error. In the case of doing a lookup for a directory
name removal, this is valid as a user cannot insert an arbitrary
name to remove from the directory btree.

However, in the case of the attribute tree, a user has direct
control over the attribute name and can ask for any random name to
be removed without any validation. In this case, fsstress is asking
for a non-existent user.selinux attribute to be removed, and that is
causing xfs_da_path_shift() to fall off the bottom of the tree where
it asserts that a lookup failure is allowed. Because the flag is not
set, we die a horrible death on a debug enable kernel.

Prevent this assert from firing on attribute removes by adding the
op_flag XFS_DA_OP_OKNOENT to atribute removal operations.

Discovered when testing on a SELinux enabled system by fsstress in
test 070 by trying to remove a non-existent user.selinux attribute.
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
4a338212
Name Last commit Last update
..
linux-2.6 xfs: make log devices with write back caches work
quota vmscan: change shrinker API by passing shrink_control struct
support xfs: kill support/debug.[ch]
Kconfig quota: Make QUOTACTL config be selected by its users
Makefile Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
xfs.h xfs: event tracing support
xfs_acl.h fs: provide rcu-walk aware permission i_ops
xfs_ag.h xfs: do not discard alloc btree blocks
xfs_alloc.c xfs: do not discard alloc btree blocks
xfs_alloc.h xfs: do not discard alloc btree blocks
xfs_alloc_btree.c xfs: do not discard alloc btree blocks
xfs_alloc_btree.h [XFS] Always use struct xfs_btree_block instead of short / longform
xfs_arch.h xfs: use generic Posix ACL code
xfs_attr.c xfs: prevent bogus assert when trying to remove non-existent attribute
xfs_attr.h xfs: convert attr to use unsigned names
xfs_attr_leaf.c xfs: use KM_NOFS for allocations during attribute list operations
xfs_attr_leaf.h [XFS] Remove macro-to-function indirections in attr code
xfs_attr_sf.h xfs: convert attr to use unsigned names
xfs_bit.c [XFS] Use the generic bitops rather than implementing them ourselves.
xfs_bit.h [XFS] Remove macro-to-function indirections in the mask code
xfs_bmap.c xfs: correctly decrement the extent buffer index in xfs_bmap_del_extent
xfs_bmap.h xfs: remove the unused XFS_BMAPI_RSVBLOCKS flag
xfs_bmap_btree.c xfs: remove unneeded #include statements
xfs_bmap_btree.h xfs: make several more functions static
xfs_btree.c xfs: connect up buffer reclaim priority hooks
xfs_btree.h
xfs_btree_trace.c
xfs_btree_trace.h
xfs_buf_item.c
xfs_buf_item.h
xfs_da_btree.c
xfs_da_btree.h
xfs_dfrag.c
xfs_dfrag.h
xfs_dinode.h
xfs_dir2.c
xfs_dir2.h
xfs_dir2_block.c
xfs_dir2_block.h
xfs_dir2_data.c
xfs_dir2_data.h
xfs_dir2_leaf.c
xfs_dir2_leaf.h
xfs_dir2_node.c
xfs_dir2_node.h
xfs_dir2_sf.c
xfs_dir2_sf.h
xfs_error.c
xfs_error.h
xfs_extfree_item.c
xfs_extfree_item.h
xfs_filestream.c
xfs_filestream.h
xfs_fs.h
xfs_fsops.c
xfs_fsops.h
xfs_ialloc.c
xfs_ialloc.h
xfs_ialloc_btree.c
xfs_ialloc_btree.h
xfs_iget.c
xfs_inode.c
xfs_inode.h
xfs_inode_item.c
xfs_inode_item.h
xfs_inum.h
xfs_iomap.c
xfs_iomap.h
xfs_itable.c
xfs_itable.h
xfs_log.c
xfs_log.h
xfs_log_cil.c
xfs_log_priv.h
xfs_log_recover.c
xfs_log_recover.h
xfs_mount.c
xfs_mount.h
xfs_mru_cache.c
xfs_mru_cache.h
xfs_quota.h
xfs_rename.c
xfs_rtalloc.c
xfs_rtalloc.h
xfs_rw.c
xfs_rw.h
xfs_sb.h
xfs_trans.c
xfs_trans.h
xfs_trans_ail.c
xfs_trans_buf.c
xfs_trans_extfree.c
xfs_trans_inode.c
xfs_trans_priv.h
xfs_trans_space.h
xfs_types.h
xfs_utils.c
xfs_utils.h
xfs_vnodeops.c
xfs_vnodeops.h