]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.12-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Dec 2024 11:26:18 +0000 (12:26 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Dec 2024 11:26:18 +0000 (12:26 +0100)
added patches:
alsa-usb-audio-fix-out-of-bounds-reads-when-finding-clock-sources.patch
alsa-usb-audio-fix-potential-out-of-bound-accesses-for-extigy-and-mbox-devices.patch
usb-ehci-spear-fix-call-balance-of-sehci-clk-handling-routines.patch
usb-typec-ucsi-glink-fix-off-by-one-in-connector_status.patch
xen-fix-the-issue-of-resource-not-being-properly-released-in-xenbus_dev_probe.patch
xfs-fix-simplify-extent-lookup-in-xfs_can_free_eofblocks.patch

queue-6.12/alsa-usb-audio-fix-out-of-bounds-reads-when-finding-clock-sources.patch [new file with mode: 0644]
queue-6.12/alsa-usb-audio-fix-potential-out-of-bound-accesses-for-extigy-and-mbox-devices.patch [new file with mode: 0644]
queue-6.12/series
queue-6.12/usb-ehci-spear-fix-call-balance-of-sehci-clk-handling-routines.patch [new file with mode: 0644]
queue-6.12/usb-typec-ucsi-glink-fix-off-by-one-in-connector_status.patch [new file with mode: 0644]
queue-6.12/xen-fix-the-issue-of-resource-not-being-properly-released-in-xenbus_dev_probe.patch [new file with mode: 0644]
queue-6.12/xfs-fix-simplify-extent-lookup-in-xfs_can_free_eofblocks.patch [new file with mode: 0644]

diff --git a/queue-6.12/alsa-usb-audio-fix-out-of-bounds-reads-when-finding-clock-sources.patch b/queue-6.12/alsa-usb-audio-fix-out-of-bounds-reads-when-finding-clock-sources.patch
new file mode 100644 (file)
index 0000000..e4af7f4
--- /dev/null
@@ -0,0 +1,90 @@
+From a3dd4d63eeb452cfb064a13862fb376ab108f6a6 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Mon, 25 Nov 2024 15:46:16 +0100
+Subject: ALSA: usb-audio: Fix out of bounds reads when finding clock sources
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit a3dd4d63eeb452cfb064a13862fb376ab108f6a6 upstream.
+
+The current USB-audio driver code doesn't check bLength of each
+descriptor at traversing for clock descriptors.  That is, when a
+device provides a bogus descriptor with a shorter bLength, the driver
+might hit out-of-bounds reads.
+
+For addressing it, this patch adds sanity checks to the validator
+functions for the clock descriptor traversal.  When the descriptor
+length is shorter than expected, it's skipped in the loop.
+
+For the clock source and clock multiplier descriptors, we can just
+check bLength against the sizeof() of each descriptor type.
+OTOH, the clock selector descriptor of UAC2 and UAC3 has an array
+of bNrInPins elements and two more fields at its tail, hence those
+have to be checked in addition to the sizeof() check.
+
+Reported-by: Benoît Sevens <bsevens@google.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/20241121140613.3651-1-bsevens@google.com
+Link: https://patch.msgid.link/20241125144629.20757-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/usb/clock.c |   24 +++++++++++++++++++++++-
+ 1 file changed, 23 insertions(+), 1 deletion(-)
+
+--- a/sound/usb/clock.c
++++ b/sound/usb/clock.c
+@@ -36,6 +36,12 @@ union uac23_clock_multiplier_desc {
+       struct uac_clock_multiplier_descriptor v3;
+ };
++/* check whether the descriptor bLength has the minimal length */
++#define DESC_LENGTH_CHECK(p, proto) \
++      ((proto) == UAC_VERSION_3 ? \
++       ((p)->v3.bLength >= sizeof((p)->v3)) : \
++       ((p)->v2.bLength >= sizeof((p)->v2)))
++
+ #define GET_VAL(p, proto, field) \
+       ((proto) == UAC_VERSION_3 ? (p)->v3.field : (p)->v2.field)
+@@ -58,6 +64,8 @@ static bool validate_clock_source(void *
+ {
+       union uac23_clock_source_desc *cs = p;
++      if (!DESC_LENGTH_CHECK(cs, proto))
++              return false;
+       return GET_VAL(cs, proto, bClockID) == id;
+ }
+@@ -65,13 +73,27 @@ static bool validate_clock_selector(void
+ {
+       union uac23_clock_selector_desc *cs = p;
+-      return GET_VAL(cs, proto, bClockID) == id;
++      if (!DESC_LENGTH_CHECK(cs, proto))
++              return false;
++      if (GET_VAL(cs, proto, bClockID) != id)
++              return false;
++      /* additional length check for baCSourceID array (in bNrInPins size)
++       * and two more fields (which sizes depend on the protocol)
++       */
++      if (proto == UAC_VERSION_3)
++              return cs->v3.bLength >= sizeof(cs->v3) + cs->v3.bNrInPins +
++                      4 /* bmControls */ + 2 /* wCSelectorDescrStr */;
++      else
++              return cs->v2.bLength >= sizeof(cs->v2) + cs->v2.bNrInPins +
++                      1 /* bmControls */ + 1 /* iClockSelector */;
+ }
+ static bool validate_clock_multiplier(void *p, int id, int proto)
+ {
+       union uac23_clock_multiplier_desc *cs = p;
++      if (!DESC_LENGTH_CHECK(cs, proto))
++              return false;
+       return GET_VAL(cs, proto, bClockID) == id;
+ }
diff --git a/queue-6.12/alsa-usb-audio-fix-potential-out-of-bound-accesses-for-extigy-and-mbox-devices.patch b/queue-6.12/alsa-usb-audio-fix-potential-out-of-bound-accesses-for-extigy-and-mbox-devices.patch
new file mode 100644 (file)
index 0000000..6d2cb9b
--- /dev/null
@@ -0,0 +1,105 @@
+From b909df18ce2a998afef81d58bbd1a05dc0788c40 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Beno=C3=AEt=20Sevens?= <bsevens@google.com>
+Date: Wed, 20 Nov 2024 12:41:44 +0000
+Subject: ALSA: usb-audio: Fix potential out-of-bound accesses for Extigy and Mbox devices
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Benoît Sevens <bsevens@google.com>
+
+commit b909df18ce2a998afef81d58bbd1a05dc0788c40 upstream.
+
+A bogus device can provide a bNumConfigurations value that exceeds the
+initial value used in usb_get_configuration for allocating dev->config.
+
+This can lead to out-of-bounds accesses later, e.g. in
+usb_destroy_configuration.
+
+Signed-off-by: Benoît Sevens <bsevens@google.com>
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Cc: stable@kernel.org
+Link: https://patch.msgid.link/20241120124144.3814457-1-bsevens@google.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/usb/quirks.c |   27 +++++++++++++++++++++------
+ 1 file changed, 21 insertions(+), 6 deletions(-)
+
+--- a/sound/usb/quirks.c
++++ b/sound/usb/quirks.c
+@@ -555,6 +555,7 @@ int snd_usb_create_quirk(struct snd_usb_
+ static int snd_usb_extigy_boot_quirk(struct usb_device *dev, struct usb_interface *intf)
+ {
+       struct usb_host_config *config = dev->actconfig;
++      struct usb_device_descriptor new_device_descriptor;
+       int err;
+       if (le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_OLD ||
+@@ -566,10 +567,14 @@ static int snd_usb_extigy_boot_quirk(str
+               if (err < 0)
+                       dev_dbg(&dev->dev, "error sending boot message: %d\n", err);
+               err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
+-                              &dev->descriptor, sizeof(dev->descriptor));
+-              config = dev->actconfig;
++                              &new_device_descriptor, sizeof(new_device_descriptor));
+               if (err < 0)
+                       dev_dbg(&dev->dev, "error usb_get_descriptor: %d\n", err);
++              if (new_device_descriptor.bNumConfigurations > dev->descriptor.bNumConfigurations)
++                      dev_dbg(&dev->dev, "error too large bNumConfigurations: %d\n",
++                              new_device_descriptor.bNumConfigurations);
++              else
++                      memcpy(&dev->descriptor, &new_device_descriptor, sizeof(dev->descriptor));
+               err = usb_reset_configuration(dev);
+               if (err < 0)
+                       dev_dbg(&dev->dev, "error usb_reset_configuration: %d\n", err);
+@@ -901,6 +906,7 @@ static void mbox2_setup_48_24_magic(stru
+ static int snd_usb_mbox2_boot_quirk(struct usb_device *dev)
+ {
+       struct usb_host_config *config = dev->actconfig;
++      struct usb_device_descriptor new_device_descriptor;
+       int err;
+       u8 bootresponse[0x12];
+       int fwsize;
+@@ -936,10 +942,14 @@ static int snd_usb_mbox2_boot_quirk(stru
+       dev_dbg(&dev->dev, "device initialised!\n");
+       err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
+-              &dev->descriptor, sizeof(dev->descriptor));
+-      config = dev->actconfig;
++              &new_device_descriptor, sizeof(new_device_descriptor));
+       if (err < 0)
+               dev_dbg(&dev->dev, "error usb_get_descriptor: %d\n", err);
++      if (new_device_descriptor.bNumConfigurations > dev->descriptor.bNumConfigurations)
++              dev_dbg(&dev->dev, "error too large bNumConfigurations: %d\n",
++                      new_device_descriptor.bNumConfigurations);
++      else
++              memcpy(&dev->descriptor, &new_device_descriptor, sizeof(dev->descriptor));
+       err = usb_reset_configuration(dev);
+       if (err < 0)
+@@ -1249,6 +1259,7 @@ static void mbox3_setup_defaults(struct
+ static int snd_usb_mbox3_boot_quirk(struct usb_device *dev)
+ {
+       struct usb_host_config *config = dev->actconfig;
++      struct usb_device_descriptor new_device_descriptor;
+       int err;
+       int descriptor_size;
+@@ -1262,10 +1273,14 @@ static int snd_usb_mbox3_boot_quirk(stru
+       dev_dbg(&dev->dev, "MBOX3: device initialised!\n");
+       err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
+-              &dev->descriptor, sizeof(dev->descriptor));
+-      config = dev->actconfig;
++              &new_device_descriptor, sizeof(new_device_descriptor));
+       if (err < 0)
+               dev_dbg(&dev->dev, "MBOX3: error usb_get_descriptor: %d\n", err);
++      if (new_device_descriptor.bNumConfigurations > dev->descriptor.bNumConfigurations)
++              dev_dbg(&dev->dev, "MBOX3: error too large bNumConfigurations: %d\n",
++                      new_device_descriptor.bNumConfigurations);
++      else
++              memcpy(&dev->descriptor, &new_device_descriptor, sizeof(dev->descriptor));
+       err = usb_reset_configuration(dev);
+       if (err < 0)
index a77ab62b9b357eabc23da90e391d0c7dd9d0a457..8d158e92a6ccec8a95ada759007a02fb8035aa22 100644 (file)
@@ -622,3 +622,9 @@ asoc-mediatek-check-num_codecs-is-not-zero-to-avoid-.patch
 s390-pci-fix-potential-double-remove-of-hotplug-slot.patch
 f2fs-fix-fiemap-failure-issue-when-page-size-is-16kb.patch
 net_sched-sch_fq-don-t-follow-the-fast-path-if-tx-is-behind-now.patch
+xen-fix-the-issue-of-resource-not-being-properly-released-in-xenbus_dev_probe.patch
+alsa-usb-audio-fix-potential-out-of-bound-accesses-for-extigy-and-mbox-devices.patch
+alsa-usb-audio-fix-out-of-bounds-reads-when-finding-clock-sources.patch
+usb-ehci-spear-fix-call-balance-of-sehci-clk-handling-routines.patch
+usb-typec-ucsi-glink-fix-off-by-one-in-connector_status.patch
+xfs-fix-simplify-extent-lookup-in-xfs_can_free_eofblocks.patch
diff --git a/queue-6.12/usb-ehci-spear-fix-call-balance-of-sehci-clk-handling-routines.patch b/queue-6.12/usb-ehci-spear-fix-call-balance-of-sehci-clk-handling-routines.patch
new file mode 100644 (file)
index 0000000..b448edc
--- /dev/null
@@ -0,0 +1,50 @@
+From 40c974826734836402abfd44efbf04f63a2cc1c1 Mon Sep 17 00:00:00 2001
+From: Vitalii Mordan <mordan@ispras.ru>
+Date: Fri, 15 Nov 2024 02:03:10 +0300
+Subject: usb: ehci-spear: fix call balance of sehci clk handling routines
+
+From: Vitalii Mordan <mordan@ispras.ru>
+
+commit 40c974826734836402abfd44efbf04f63a2cc1c1 upstream.
+
+If the clock sehci->clk was not enabled in spear_ehci_hcd_drv_probe,
+it should not be disabled in any path.
+
+Conversely, if it was enabled in spear_ehci_hcd_drv_probe, it must be disabled
+in all error paths to ensure proper cleanup.
+
+Found by Linux Verification Center (linuxtesting.org) with Klever.
+
+Fixes: 7675d6ba436f ("USB: EHCI: make ehci-spear a separate driver")
+Cc: stable@vger.kernel.org
+Signed-off-by: Vitalii Mordan <mordan@ispras.ru>
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+Link: https://lore.kernel.org/r/20241114230310.432213-1-mordan@ispras.ru
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/host/ehci-spear.c |    7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/drivers/usb/host/ehci-spear.c
++++ b/drivers/usb/host/ehci-spear.c
+@@ -105,7 +105,9 @@ static int spear_ehci_hcd_drv_probe(stru
+       /* registers start at offset 0x0 */
+       hcd_to_ehci(hcd)->caps = hcd->regs;
+-      clk_prepare_enable(sehci->clk);
++      retval = clk_prepare_enable(sehci->clk);
++      if (retval)
++              goto err_put_hcd;
+       retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
+       if (retval)
+               goto err_stop_ehci;
+@@ -130,8 +132,7 @@ static void spear_ehci_hcd_drv_remove(st
+       usb_remove_hcd(hcd);
+-      if (sehci->clk)
+-              clk_disable_unprepare(sehci->clk);
++      clk_disable_unprepare(sehci->clk);
+       usb_put_hcd(hcd);
+ }
diff --git a/queue-6.12/usb-typec-ucsi-glink-fix-off-by-one-in-connector_status.patch b/queue-6.12/usb-typec-ucsi-glink-fix-off-by-one-in-connector_status.patch
new file mode 100644 (file)
index 0000000..da0a062
--- /dev/null
@@ -0,0 +1,38 @@
+From 4a22918810980897393fa1776ea3877e4baf8cca Mon Sep 17 00:00:00 2001
+From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Date: Sat, 9 Nov 2024 02:04:14 +0200
+Subject: usb: typec: ucsi: glink: fix off-by-one in connector_status
+
+From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+
+commit 4a22918810980897393fa1776ea3877e4baf8cca upstream.
+
+UCSI connector's indices start from 1 up to 3, PMIC_GLINK_MAX_PORTS.
+Correct the condition in the pmic_glink_ucsi_connector_status()
+callback, fixing Type-C orientation reporting for the third USB-C
+connector.
+
+Fixes: 76716fd5bf09 ("usb: typec: ucsi: glink: move GPIO reading into connector_status callback")
+Cc: stable@vger.kernel.org
+Reported-by: Abel Vesa <abel.vesa@linaro.org>
+Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
+Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
+Tested-by: Johan Hovold <johan+linaro@kernel.org>
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Link: https://lore.kernel.org/r/20241109-ucsi-glue-fixes-v2-1-8b21ff4f9fbe@linaro.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/typec/ucsi/ucsi_glink.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/typec/ucsi/ucsi_glink.c
++++ b/drivers/usb/typec/ucsi/ucsi_glink.c
+@@ -185,7 +185,7 @@ static void pmic_glink_ucsi_connector_st
+       struct pmic_glink_ucsi *ucsi = ucsi_get_drvdata(con->ucsi);
+       int orientation;
+-      if (con->num >= PMIC_GLINK_MAX_PORTS ||
++      if (con->num > PMIC_GLINK_MAX_PORTS ||
+           !ucsi->port_orientation[con->num - 1])
+               return;
diff --git a/queue-6.12/xen-fix-the-issue-of-resource-not-being-properly-released-in-xenbus_dev_probe.patch b/queue-6.12/xen-fix-the-issue-of-resource-not-being-properly-released-in-xenbus_dev_probe.patch
new file mode 100644 (file)
index 0000000..afb3331
--- /dev/null
@@ -0,0 +1,66 @@
+From afc545da381ba0c651b2658966ac737032676f01 Mon Sep 17 00:00:00 2001
+From: Qiu-ji Chen <chenqiuji666@gmail.com>
+Date: Tue, 5 Nov 2024 21:09:19 +0800
+Subject: xen: Fix the issue of resource not being properly released in xenbus_dev_probe()
+
+From: Qiu-ji Chen <chenqiuji666@gmail.com>
+
+commit afc545da381ba0c651b2658966ac737032676f01 upstream.
+
+This patch fixes an issue in the function xenbus_dev_probe(). In the
+xenbus_dev_probe() function, within the if (err) branch at line 313, the
+program incorrectly returns err directly without releasing the resources
+allocated by err = drv->probe(dev, id). As the return value is non-zero,
+the upper layers assume the processing logic has failed. However, the probe
+operation was performed earlier without a corresponding remove operation.
+Since the probe actually allocates resources, failing to perform the remove
+operation could lead to problems.
+
+To fix this issue, we followed the resource release logic of the
+xenbus_dev_remove() function by adding a new block fail_remove before the
+fail_put block. After entering the branch if (err) at line 313, the
+function will use a goto statement to jump to the fail_remove block,
+ensuring that the previously acquired resources are correctly released,
+thus preventing the reference count leak.
+
+This bug was identified by an experimental static analysis tool developed
+by our team. The tool specializes in analyzing reference count operations
+and detecting potential issues where resources are not properly managed.
+In this case, the tool flagged the missing release operation as a
+potential problem, which led to the development of this patch.
+
+Fixes: 4bac07c993d0 ("xen: add the Xenbus sysfs and virtual device hotplug driver")
+Cc: stable@vger.kernel.org
+Signed-off-by: Qiu-ji Chen <chenqiuji666@gmail.com>
+Reviewed-by: Juergen Gross <jgross@suse.com>
+Message-ID: <20241105130919.4621-1-chenqiuji666@gmail.com>
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/xen/xenbus/xenbus_probe.c |    8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+--- a/drivers/xen/xenbus/xenbus_probe.c
++++ b/drivers/xen/xenbus/xenbus_probe.c
+@@ -313,7 +313,7 @@ int xenbus_dev_probe(struct device *_dev
+       if (err) {
+               dev_warn(&dev->dev, "watch_otherend on %s failed.\n",
+                      dev->nodename);
+-              return err;
++              goto fail_remove;
+       }
+       dev->spurious_threshold = 1;
+@@ -322,6 +322,12 @@ int xenbus_dev_probe(struct device *_dev
+                        dev->nodename);
+       return 0;
++fail_remove:
++      if (drv->remove) {
++              down(&dev->reclaim_sem);
++              drv->remove(dev);
++              up(&dev->reclaim_sem);
++      }
+ fail_put:
+       module_put(drv->driver.owner);
+ fail:
diff --git a/queue-6.12/xfs-fix-simplify-extent-lookup-in-xfs_can_free_eofblocks.patch b/queue-6.12/xfs-fix-simplify-extent-lookup-in-xfs_can_free_eofblocks.patch
new file mode 100644 (file)
index 0000000..25b09ad
--- /dev/null
@@ -0,0 +1,62 @@
+From 62027820eb4486f075b89ec31c1548c6cb1bb13f Mon Sep 17 00:00:00 2001
+From: "Darrick J. Wong" <djwong@kernel.org>
+Date: Sun, 3 Nov 2024 20:18:24 -0800
+Subject: xfs: fix simplify extent lookup in xfs_can_free_eofblocks
+
+From: Darrick J. Wong <djwong@kernel.org>
+
+commit 62027820eb4486f075b89ec31c1548c6cb1bb13f upstream.
+
+In commit 11f4c3a53adde, we tried to simplify the extent lookup in
+xfs_can_free_eofblocks so that it doesn't incur the overhead of all the
+extra stuff that xfs_bmapi_read does around the iext lookup.
+
+Unfortunately, this causes regressions on generic/603, xfs/108,
+generic/219, xfs/173, generic/694, xfs/052, generic/230, and xfs/441
+when always_cow is turned on.  In all cases, the regressions take the
+form of alwayscow files consuming rather more space than the golden
+output is expecting.  I observed that in all these cases, the cause of
+the excess space usage was due to CoW fork delalloc reservations that go
+beyond EOF.
+
+For alwayscow files we allow posteof delalloc CoW reservations because
+all writes go through the CoW fork.  Recall that all extents in the CoW
+fork are accounted for via i_delayed_blks, which means that prior to
+this patch, we'd invoke xfs_free_eofblocks on first close if anything
+was in the CoW fork.  Now we don't do that.
+
+Fix the problem by reverting the removal of the i_delayed_blks check.
+
+Cc: <stable@vger.kernel.org> # v6.12-rc1
+Fixes: 11f4c3a53adde ("xfs: simplify extent lookup in xfs_can_free_eofblocks")
+Signed-off-by: Darrick J. Wong <djwong@kernel.org>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/xfs/xfs_bmap_util.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
+index 4719ec90029c..edaf193dbd5c 100644
+--- a/fs/xfs/xfs_bmap_util.c
++++ b/fs/xfs/xfs_bmap_util.c
+@@ -546,10 +546,14 @@ xfs_can_free_eofblocks(
+               return false;
+       /*
+-       * Check if there is an post-EOF extent to free.
++       * Check if there is an post-EOF extent to free.  If there are any
++       * delalloc blocks attached to the inode (data fork delalloc
++       * reservations or CoW extents of any kind), we need to free them so
++       * that inactivation doesn't fail to erase them.
+        */
+       xfs_ilock(ip, XFS_ILOCK_SHARED);
+-      if (xfs_iext_lookup_extent(ip, &ip->i_df, end_fsb, &icur, &imap))
++      if (ip->i_delayed_blks ||
++          xfs_iext_lookup_extent(ip, &ip->i_df, end_fsb, &icur, &imap))
+               found_blocks = true;
+       xfs_iunlock(ip, XFS_ILOCK_SHARED);
+       return found_blocks;
+-- 
+2.47.1
+