From: Greg Kroah-Hartman Date: Mon, 3 Apr 2023 13:13:27 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v4.14.312~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0becc555d0261f14c9880b9a380a3cf508c6acce;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: btrfs-scan-device-in-non-exclusive-mode.patch s390-uaccess-add-missing-earlyclobber-annotations-to-__clear_user.patch --- diff --git a/queue-5.4/btrfs-scan-device-in-non-exclusive-mode.patch b/queue-5.4/btrfs-scan-device-in-non-exclusive-mode.patch new file mode 100644 index 00000000000..bb8408211a1 --- /dev/null +++ b/queue-5.4/btrfs-scan-device-in-non-exclusive-mode.patch @@ -0,0 +1,87 @@ +From 50d281fc434cb8e2497f5e70a309ccca6b1a09f0 Mon Sep 17 00:00:00 2001 +From: Anand Jain +Date: Thu, 23 Mar 2023 15:56:48 +0800 +Subject: btrfs: scan device in non-exclusive mode + +From: Anand Jain + +commit 50d281fc434cb8e2497f5e70a309ccca6b1a09f0 upstream. + +This fixes mkfs/mount/check failures due to race with systemd-udevd +scan. + +During the device scan initiated by systemd-udevd, other user space +EXCL operations such as mkfs, mount, or check may get blocked and result +in a "Device or resource busy" error. This is because the device +scan process opens the device with the EXCL flag in the kernel. + +Two reports were received: + + - btrfs/179 test case, where the fsck command failed with the -EBUSY + error + + - LTP pwritev03 test case, where mkfs.vfs failed with + the -EBUSY error, when mkfs.vfs tried to overwrite old btrfs filesystem + on the device. + +In both cases, fsck and mkfs (respectively) were racing with a +systemd-udevd device scan, and systemd-udevd won, resulting in the +-EBUSY error for fsck and mkfs. + +Reproducing the problem has been difficult because there is a very +small window during which these userspace threads can race to +acquire the exclusive device open. Even on the system where the problem +was observed, the problem occurrences were anywhere between 10 to 400 +iterations and chances of reproducing decreases with debug printk()s. + +However, an exclusive device open is unnecessary for the scan process, +as there are no write operations on the device during scan. Furthermore, +during the mount process, the superblock is re-read in the below +function call chain: + + btrfs_mount_root + btrfs_open_devices + open_fs_devices + btrfs_open_one_device + btrfs_get_bdev_and_sb + +So, to fix this issue, removes the FMODE_EXCL flag from the scan +operation, and add a comment. + +The case where mkfs may still write to the device and a scan is running, +the btrfs signature is not written at that time so scan will not +recognize such device. + +Reported-by: Sherry Yang +Reported-by: kernel test robot +Link: https://lore.kernel.org/oe-lkp/202303170839.fdf23068-oliver.sang@intel.com +CC: stable@vger.kernel.org # 5.4+ +Signed-off-by: Anand Jain +Reviewed-by: David Sterba +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman +--- + fs/btrfs/volumes.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +--- a/fs/btrfs/volumes.c ++++ b/fs/btrfs/volumes.c +@@ -1579,8 +1579,17 @@ struct btrfs_device *btrfs_scan_one_devi + * later supers, using BTRFS_SUPER_MIRROR_MAX instead + */ + bytenr = btrfs_sb_offset(0); +- flags |= FMODE_EXCL; + ++ /* ++ * Avoid using flag |= FMODE_EXCL here, as the systemd-udev may ++ * initiate the device scan which may race with the user's mount ++ * or mkfs command, resulting in failure. ++ * Since the device scan is solely for reading purposes, there is ++ * no need for FMODE_EXCL. Additionally, the devices are read again ++ * during the mount process. It is ok to get some inconsistent ++ * values temporarily, as the device paths of the fsid are the only ++ * required information for assembling the volume. ++ */ + bdev = blkdev_get_by_path(path, flags, holder); + if (IS_ERR(bdev)) + return ERR_CAST(bdev); diff --git a/queue-5.4/drm-meson-fix-error-handling-when-afbcd.ops-init-fai.patch b/queue-5.4/drm-meson-fix-error-handling-when-afbcd.ops-init-fai.patch deleted file mode 100644 index 559ef124d44..00000000000 --- a/queue-5.4/drm-meson-fix-error-handling-when-afbcd.ops-init-fai.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 12bde1764c3e925b3c5a81d4ec8bb117b47cbeaf Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 31 Dec 2021 00:55:15 +0100 -Subject: drm/meson: Fix error handling when afbcd.ops->init fails - -From: Martin Blumenstingl - -[ Upstream commit fa747d75f65d1b1cbc3f4691fa67b695e8a399c8 ] - -When afbcd.ops->init fails we need to free the struct drm_device. Also -all errors which come after afbcd.ops->init was successful need to exit -the AFBCD, just like meson_drv_unbind() does. - -Fixes: d1b5e41e13a7e9 ("drm/meson: Add AFBCD module driver") -Signed-off-by: Martin Blumenstingl -Acked-by: Neil Armstrong -Signed-off-by: Neil Armstrong -Link: https://patchwork.freedesktop.org/patch/msgid/20211230235515.1627522-3-martin.blumenstingl@googlemail.com -Stable-dep-of: ba98413bf45e ("drm/meson: fix missing component unbind on bind errors") -Signed-off-by: Sasha Levin ---- - drivers/gpu/drm/meson/meson_drv.c | 15 +++++++++------ - 1 file changed, 9 insertions(+), 6 deletions(-) - -diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c -index 9a39afc3939bc..1f81ab515876a 100644 ---- a/drivers/gpu/drm/meson/meson_drv.c -+++ b/drivers/gpu/drm/meson/meson_drv.c -@@ -297,31 +297,31 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) - - ret = meson_venc_cvbs_create(priv); - if (ret) -- goto free_drm; -+ goto exit_afbcd; - - if (has_components) { - ret = component_bind_all(drm->dev, drm); - if (ret) { - dev_err(drm->dev, "Couldn't bind all components\n"); -- goto free_drm; -+ goto exit_afbcd; - } - } - - ret = meson_plane_create(priv); - if (ret) -- goto free_drm; -+ goto exit_afbcd; - - ret = meson_overlay_create(priv); - if (ret) -- goto free_drm; -+ goto exit_afbcd; - - ret = meson_crtc_create(priv); - if (ret) -- goto free_drm; -+ goto exit_afbcd; - - ret = drm_irq_install(drm, priv->vsync_irq); - if (ret) -- goto free_drm; -+ goto exit_afbcd; - - drm_mode_config_reset(drm); - -@@ -339,6 +339,9 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) - - uninstall_irq: - drm_irq_uninstall(drm); -+exit_afbcd: -+ if (priv->afbcd.ops) -+ priv->afbcd.ops->exit(priv); - free_drm: - drm_dev_put(drm); - --- -2.39.2 - diff --git a/queue-5.4/drm-meson-fix-missing-component-unbind-on-bind-error.patch b/queue-5.4/drm-meson-fix-missing-component-unbind-on-bind-error.patch deleted file mode 100644 index 4b18b24c404..00000000000 --- a/queue-5.4/drm-meson-fix-missing-component-unbind-on-bind-error.patch +++ /dev/null @@ -1,65 +0,0 @@ -From ad280f8ae51fae13ee6ec4a17764da73b7c417dc Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 6 Mar 2023 11:35:33 +0100 -Subject: drm/meson: fix missing component unbind on bind errors - -From: Johan Hovold - -[ Upstream commit ba98413bf45edbf33672e2539e321b851b2cfbd1 ] - -Make sure to unbind all subcomponents when binding the aggregate device -fails. - -Fixes: a41e82e6c457 ("drm/meson: Add support for components") -Cc: stable@vger.kernel.org # 4.12 -Cc: Neil Armstrong -Signed-off-by: Johan Hovold -Acked-by: Neil Armstrong -Signed-off-by: Neil Armstrong -Link: https://patchwork.freedesktop.org/patch/msgid/20230306103533.4915-1-johan+linaro@kernel.org -Signed-off-by: Sasha Levin ---- - drivers/gpu/drm/meson/meson_drv.c | 11 +++++++---- - 1 file changed, 7 insertions(+), 4 deletions(-) - -diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c -index 1f81ab515876a..29ee2f9ab16bc 100644 ---- a/drivers/gpu/drm/meson/meson_drv.c -+++ b/drivers/gpu/drm/meson/meson_drv.c -@@ -309,19 +309,19 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) - - ret = meson_plane_create(priv); - if (ret) -- goto exit_afbcd; -+ goto unbind_all; - - ret = meson_overlay_create(priv); - if (ret) -- goto exit_afbcd; -+ goto unbind_all; - - ret = meson_crtc_create(priv); - if (ret) -- goto exit_afbcd; -+ goto unbind_all; - - ret = drm_irq_install(drm, priv->vsync_irq); - if (ret) -- goto exit_afbcd; -+ goto unbind_all; - - drm_mode_config_reset(drm); - -@@ -339,6 +339,9 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) - - uninstall_irq: - drm_irq_uninstall(drm); -+unbind_all: -+ if (has_components) -+ component_unbind_all(drm->dev, drm); - exit_afbcd: - if (priv->afbcd.ops) - priv->afbcd.ops->exit(priv); --- -2.39.2 - diff --git a/queue-5.4/s390-uaccess-add-missing-earlyclobber-annotations-to-__clear_user.patch b/queue-5.4/s390-uaccess-add-missing-earlyclobber-annotations-to-__clear_user.patch new file mode 100644 index 00000000000..09f104cb552 --- /dev/null +++ b/queue-5.4/s390-uaccess-add-missing-earlyclobber-annotations-to-__clear_user.patch @@ -0,0 +1,37 @@ +From 89aba4c26fae4e459f755a18912845c348ee48f3 Mon Sep 17 00:00:00 2001 +From: Heiko Carstens +Date: Thu, 23 Mar 2023 13:09:16 +0100 +Subject: s390/uaccess: add missing earlyclobber annotations to __clear_user() + +From: Heiko Carstens + +commit 89aba4c26fae4e459f755a18912845c348ee48f3 upstream. + +Add missing earlyclobber annotation to size, to, and tmp2 operands of the +__clear_user() inline assembly since they are modified or written to before +the last usage of all input operands. This can lead to incorrect register +allocation for the inline assembly. + +Fixes: 6c2a9e6df604 ("[S390] Use alternative user-copy operations for new hardware.") +Reported-by: Mark Rutland +Link: https://lore.kernel.org/all/20230321122514.1743889-3-mark.rutland@arm.com/ +Cc: stable@vger.kernel.org +Reviewed-by: Gerald Schaefer +Signed-off-by: Heiko Carstens +Signed-off-by: Vasily Gorbik +Signed-off-by: Greg Kroah-Hartman +--- + arch/s390/lib/uaccess.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/s390/lib/uaccess.c ++++ b/arch/s390/lib/uaccess.c +@@ -339,7 +339,7 @@ static inline unsigned long clear_user_m + "4: slgr %0,%0\n" + "5:\n" + EX_TABLE(0b,2b) EX_TABLE(3b,5b) +- : "+a" (size), "+a" (to), "+a" (tmp1), "=a" (tmp2) ++ : "+&a" (size), "+&a" (to), "+a" (tmp1), "=&a" (tmp2) + : "a" (empty_zero_page), "d" (reg0) : "cc", "memory"); + return size; + } diff --git a/queue-5.4/series b/queue-5.4/series index a3710ff4372..a7d303f2fe6 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -59,8 +59,6 @@ tun-avoid-double-free-in-tun_free_netdev.patch ocfs2-fix-data-corruption-after-failed-write.patch fsverity-don-t-drop-pagecache-at-end-of-fs_ioc_enabl.patch bus-imx-weim-fix-branch-condition-evaluates-to-a-gar.patch -drm-meson-fix-error-handling-when-afbcd.ops-init-fai.patch -drm-meson-fix-missing-component-unbind-on-bind-error.patch md-avoid-signed-overflow-in-slot_store.patch alsa-asihpi-check-pao-in-control_message.patch alsa-hda-ca0132-fixup-buffer-overrun-at-tuning_ctl_s.patch @@ -97,3 +95,5 @@ nfsv4-fix-hangs-when-recovering-open-state-after-a-server-reboot.patch alsa-hda-conexant-partial-revert-of-a-quirk-for-lenovo.patch alsa-usb-audio-fix-regression-on-detection-of-roland-vs-100.patch drm-etnaviv-fix-reference-leak-when-mmaping-imported-buffer.patch +s390-uaccess-add-missing-earlyclobber-annotations-to-__clear_user.patch +btrfs-scan-device-in-non-exclusive-mode.patch