Skip to contentSkip to conversation

xfs-underflow-bug-in-xfs_attrlist_by_handle.patch removed from -mm tree

merged [email protected] 1 participant 1 message Dec 9, 2013 XFS filesystem

lore
Share & tools
lore
#0 lore raw

Subject: [merged] xfs-underflow-bug-in-xfs_attrlist_by_handle.patch removed from -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Mon, 09 Dec 2013 13:53:53 -0800

The patch titled
Subject: xfs: underflow bug in xfs_attrlist_by_handle()
has been removed from the -mm tree. Its filename was
xfs-underflow-bug-in-xfs_attrlist_by_handle.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Dan Carpenter <[email protected]>
Subject: xfs: underflow bug in xfs_attrlist_by_handle()

If we allocate less than sizeof(struct attrlist) then we end up corrupting memory or doing a ZERO_PTR_SIZE dereference.

This can only be triggered with CAP_SYS_ADMIN.

---

 fs/xfs/xfs_ioctl.c   |    3 ++-
 fs/xfs/xfs_ioctl32.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
fs/xfs/xfs_ioctl.c renamed from fs/xfs/xfs_ioctl.c~xfs-underflow-bug-in-xfs_attrlist_by_handle +2 -1
diff -puN fs/xfs/xfs_ioctl.c~xfs-underflow-bug-in-xfs_attrlist_by_handle fs/xfs/xfs_ioctl.c
@@ -442,7 +442,8 @@ xfs_attrlist_by_handle(
 		return -XFS_ERROR(EPERM);
 	if (copy_from_user(&al_hreq, arg, sizeof(xfs_fsop_attrlist_handlereq_t)))
 		return -XFS_ERROR(EFAULT);
-	if (al_hreq.buflen > XATTR_LIST_MAX)
+	if (al_hreq.buflen < sizeof(struct attrlist) ||
+	    al_hreq.buflen > XATTR_LIST_MAX)
 		return -XFS_ERROR(EINVAL);
 
 	/*
fs/xfs/xfs_ioctl32.c renamed from fs/xfs/xfs_ioctl32.c~xfs-underflow-bug-in-xfs_attrlist_by_handle +2 -1
diff -puN fs/xfs/xfs_ioctl32.c~xfs-underflow-bug-in-xfs_attrlist_by_handle fs/xfs/xfs_ioctl32.c
@@ -356,7 +356,8 @@ xfs_compat_attrlist_by_handle(
 	if (copy_from_user(&al_hreq, arg,
 			   sizeof(compat_xfs_fsop_attrlist_handlereq_t)))
 		return -XFS_ERROR(EFAULT);
-	if (al_hreq.buflen > XATTR_LIST_MAX)
+	if (al_hreq.buflen < sizeof(struct attrlist) ||
+	    al_hreq.buflen > XATTR_LIST_MAX)
 		return -XFS_ERROR(EINVAL);
 
 	/*

_

Patches currently in -mm which might be from [email protected] are

origin.patch dma-debug-enhance-dma_debug_device_change-to-check-for-mapping-errors-fix.patch drivers-scsi-megaraid-megaraid_mmc-missing-bounds-check-in-mimd_to_kioc.patch drivers-block-paride-pgc-underflow-bug-in-pg_write.patch drivers-mailbox-omap-make-mbox-irq-signed-for-error-handling.patch checkpatch-warn-only-on-space-before-semicolon-at-end-of-line.patch linux-next.patch