linux-kernelorg-stable/fs/xfs
Eric Sandeen dcdf36f1b6 xfs: do not propagate ENODATA disk errors into xattr code
commit ae668cd567 upstream.

ENODATA (aka ENOATTR) has a very specific meaning in the xfs xattr code;
namely, that the requested attribute name could not be found.

However, a medium error from disk may also return ENODATA. At best,
this medium error may escape to userspace as "attribute not found"
when in fact it's an IO (disk) error.

At worst, we may oops in xfs_attr_leaf_get() when we do:

	error = xfs_attr_leaf_hasname(args, &bp);
	if (error == -ENOATTR)  {
		xfs_trans_brelse(args->trans, bp);
		return error;
	}

because an ENODATA/ENOATTR error from disk leaves us with a null bp,
and the xfs_trans_brelse will then null-deref it.

As discussed on the list, we really need to modify the lower level
IO functions to trap all disk errors and ensure that we don't let
unique errors like this leak up into higher xfs functions - many
like this should be remapped to EIO.

However, this patch directly addresses a reported bug in the xattr
code, and should be safe to backport to stable kernels. A larger-scope
patch to handle more unique errors at lower levels can follow later.

(Note, prior to 07120f1abd we did not oops, but we did return the
wrong error code to userspace.)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Fixes: 07120f1abd ("xfs: Add xfs_has_attr and subroutines")
Cc: stable@vger.kernel.org # v5.9+
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-09-04 15:31:54 +02:00
..
libxfs xfs: do not propagate ENODATA disk errors into xattr code 2025-09-04 15:31:54 +02:00
scrub xfs: fix scrub trace with null pointer in quotacheck 2025-08-20 18:30:54 +02:00
Kconfig
Makefile
xfs.h
xfs_acl.c
xfs_acl.h
xfs_aops.c xfs: flush inodegc before swapon 2025-05-02 07:59:29 +02:00
xfs_aops.h
xfs_attr_inactive.c
xfs_attr_item.c
xfs_attr_item.h
xfs_attr_list.c xfs: convert comma to semicolon 2024-07-29 09:32:53 +05:30
xfs_bio_io.c
xfs_bmap_item.c xfs: ensure st_blocks never goes to zero during COW writes 2024-09-03 10:07:47 +05:30
xfs_bmap_item.h
xfs_bmap_util.c xfs: return a 64-bit block count from xfs_btree_count_blocks 2024-12-19 18:13:08 +01:00
xfs_bmap_util.h xfs: support the COW fork in xfs_bmap_punch_delalloc_range 2024-10-15 11:37:42 +02:00
xfs_buf.c xfs: check for dead buffers in xfs_buf_find_insert 2025-02-08 09:58:13 +01:00
xfs_buf.h treewide: Fix wrong singular form of jiffies in comments 2024-09-08 20:47:40 +02:00
xfs_buf_item.c
xfs_buf_item.h
xfs_buf_item_recover.c xfs: fix mount hang during primary superblock recovery failure 2025-02-17 10:05:46 +01:00
xfs_buf_mem.c mm,tmpfs: consider end of file write in shmem_is_huge 2024-09-09 16:39:12 -07:00
xfs_buf_mem.h
xfs_dahash_test.c
xfs_dahash_test.h
xfs_dir2_readdir.c
xfs_discard.c xfs: don't assume perags are initialised when trimming AGs 2025-06-19 15:32:36 +02:00
xfs_discard.h
xfs_dquot.c xfs: lock dquot buffer before detaching dquot from b_li_list 2025-02-17 10:05:46 +01:00
xfs_dquot.h xfs: convert quotacheck to attach dquot buffers 2025-02-17 10:05:45 +01:00
xfs_dquot_item.c xfs: attach dquot buffer to dquot log item buffer 2025-02-17 10:05:45 +01:00
xfs_dquot_item.h xfs: attach dquot buffer to dquot log item buffer 2025-02-17 10:05:45 +01:00
xfs_dquot_item_recover.c
xfs_drain.c
xfs_drain.h
xfs_error.c
xfs_error.h
xfs_exchmaps_item.c
xfs_exchmaps_item.h
xfs_exchrange.c xfs: don't call remap_verify_area with sb write protection held 2025-02-17 10:05:29 +01:00
xfs_exchrange.h xfs: introduce new file range commit ioctls 2024-09-01 08:58:19 -07:00
xfs_export.c
xfs_export.h
xfs_extent_busy.c
xfs_extent_busy.h
xfs_extfree_item.c
xfs_extfree_item.h
xfs_file.c xfs: don't drop errno values when we fail to ficlone the entire range 2024-12-19 18:13:08 +01:00
xfs_file.h
xfs_filestream.c xfs: streamline xfs_filestream_pick_ag 2024-10-30 11:27:18 +01:00
xfs_filestream.h
xfs_fsmap.c xfs: fix off-by-one error in fsmap's end_daddr usage 2024-12-27 14:02:00 +01:00
xfs_fsmap.h xfs: move xfs_ioc_getfsmap out of xfs_ioctl.c 2024-09-01 08:58:19 -07:00
xfs_fsops.c xfs: merge the perag freeing helpers 2024-10-22 13:37:18 +02:00
xfs_fsops.h
xfs_globals.c
xfs_handle.c struct fd: representation change 2024-08-12 22:01:05 -04:00
xfs_handle.h
xfs_health.c
xfs_hooks.c
xfs_hooks.h
xfs_icache.c xfs: don't free cowblocks from under dirty pagecache on unshare 2024-10-09 10:05:10 +02:00
xfs_icache.h
xfs_icreate_item.c
xfs_icreate_item.h
xfs_inode.c xfs: Add error handling for xfs_reflink_cancel_cow_range 2025-02-17 10:05:30 +01:00
xfs_inode.h xfs: Check for delayed allocations before setting extsize 2024-10-30 11:27:18 +01:00
xfs_inode_item.c xfs: skip flushing log items during push 2024-07-04 12:46:47 +05:30
xfs_inode_item.h
xfs_inode_item_recover.c
xfs_ioctl.c xfs: Check for delayed allocations before setting extsize 2024-10-30 11:27:18 +01:00
xfs_ioctl.h
xfs_ioctl32.c
xfs_ioctl32.h
xfs_iomap.c xfs: Propagate errors from xfs_reflink_cancel_cow_range in xfs_dax_write_iomap_end 2025-02-17 10:05:30 +01:00
xfs_iomap.h
xfs_iops.c iomap: fix handling of dirty folios over unwritten extents 2024-09-03 15:01:24 +02:00
xfs_iops.h
xfs_itable.c xfs: fully decouple XFS_IBULK* flags from XFS_IWALK* flags 2025-08-28 16:31:04 +02:00
xfs_itable.h
xfs_iunlink_item.c
xfs_iunlink_item.h
xfs_iwalk.c
xfs_iwalk.h
xfs_linux.h move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
xfs_log.c xfs: Use xfs set and clear mp state helpers 2024-09-03 10:07:39 +05:30
xfs_log.h xfs: Remove empty declartion in header file 2024-10-07 08:00:11 +02:00
xfs_log_cil.c xfs: Use try_cmpxchg() in xlog_cil_insert_pcp_aggregate() 2024-10-07 08:00:11 +02:00
xfs_log_priv.h xfs: grant heads track byte counts, not LSNs 2024-07-04 12:46:47 +05:30
xfs_log_recover.c xfs: update the file system geometry after recoverying superblock buffers 2024-10-22 13:37:18 +02:00
xfs_message.c
xfs_message.h
xfs_mount.c xfs: merge the perag freeing helpers 2024-10-22 13:37:18 +02:00
xfs_mount.h xfs: convert perag lookup to xarray 2024-09-03 10:07:46 +05:30
xfs_mru_cache.c xfs: use LIST_HEAD() to simplify code 2024-09-03 10:07:42 +05:30
xfs_mru_cache.h
xfs_notify_failure.c xfs: don't shut down the filesystem for media failures beyond end of log 2025-02-08 09:58:13 +01:00
xfs_pnfs.c
xfs_pnfs.h
xfs_pwork.c
xfs_pwork.h
xfs_qm.c xfs: convert quotacheck to attach dquot buffers 2025-02-17 10:05:45 +01:00
xfs_qm.h xfs: refactor loading quota inodes in the regular case 2024-09-01 08:58:20 -07:00
xfs_qm_bhv.c xfs: Do not allow norecovery mount with quotacheck 2025-05-02 07:59:29 +02:00
xfs_qm_syscalls.c xfs: refactor loading quota inodes in the regular case 2024-09-01 08:58:20 -07:00
xfs_quota.h xfs: don't lose solo dquot update transactions 2025-02-18 09:34:42 +01:00
xfs_quotaops.c xfs: refactor loading quota inodes in the regular case 2024-09-01 08:58:20 -07:00
xfs_refcount_item.c
xfs_refcount_item.h
xfs_reflink.c xfs: don't free cowblocks from under dirty pagecache on unshare 2024-10-09 10:05:10 +02:00
xfs_reflink.h xfs: don't free cowblocks from under dirty pagecache on unshare 2024-10-09 10:05:10 +02:00
xfs_rmap_item.c
xfs_rmap_item.h
xfs_rtalloc.c xfs: fix null bno_hint handling in xfs_rtallocate_rtg 2024-12-19 18:13:08 +01:00
xfs_rtalloc.h
xfs_stats.c
xfs_stats.h
xfs_super.c xfs: do not check NEEDSREPAIR if ro,norecovery mount. 2025-05-02 07:59:29 +02:00
xfs_super.h
xfs_symlink.c xfs: pass the icreate args object to xfs_dialloc 2024-09-01 08:58:19 -07:00
xfs_symlink.h
xfs_sysctl.c sysctl: treewide: constify the ctl_table argument of proc_handlers 2024-07-24 20:59:29 +02:00
xfs_sysctl.h
xfs_sysfs.c xfs: grant heads track byte counts, not LSNs 2024-07-04 12:46:47 +05:30
xfs_sysfs.h
xfs_trace.c xfs: l_last_sync_lsn is really AIL state 2024-07-04 12:46:46 +05:30
xfs_trace.h xfs: fix finding a last resort AG in xfs_filestream_pick_ag 2024-10-30 11:27:18 +01:00
xfs_trans.c xfs: don't lose solo dquot update transactions 2025-02-18 09:34:42 +01:00
xfs_trans.h xfs: skip flushing log items during push 2024-07-04 12:46:47 +05:30
xfs_trans_ail.c xfs: attach dquot buffer to dquot log item buffer 2025-02-17 10:05:45 +01:00
xfs_trans_buf.c
xfs_trans_dquot.c xfs: don't lose solo dquot update transactions 2025-02-18 09:34:42 +01:00
xfs_trans_priv.h xfs: l_last_sync_lsn is really AIL state 2024-07-04 12:46:46 +05:30
xfs_xattr.c xfs: allow SECURE namespace xattrs to use reserved block pool 2024-07-29 09:26:20 +05:30
xfs_xattr.h