]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.15
authorSasha Levin <sashal@kernel.org>
Mon, 13 Jun 2022 01:46:25 +0000 (21:46 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 13 Jun 2022 01:46:25 +0000 (21:46 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
48 files changed:
queue-5.15/ceph-allow-ceph.dir.rctime-xattr-to-be-updatable.patch [new file with mode: 0644]
queue-5.15/ceph-flush-the-mdlog-for-filesystem-sync.patch [new file with mode: 0644]
queue-5.15/char-xillybus-fix-a-refcount-leak-in-cleanup_dev.patch [new file with mode: 0644]
queue-5.15/cifs-version-operations-for-smb20-unneeded-when-lega.patch [new file with mode: 0644]
queue-5.15/clocksource-drivers-sp804-avoid-error-on-multiple-in.patch [new file with mode: 0644]
queue-5.15/drivers-staging-rtl8192bs-fix-deadlock-in-rtw_joinbs.patch [new file with mode: 0644]
queue-5.15/drivers-staging-rtl8192e-fix-deadlock-in-rtllib_beac.patch [new file with mode: 0644]
queue-5.15/drivers-staging-rtl8192u-fix-deadlock-in-ieee80211_b.patch [new file with mode: 0644]
queue-5.15/drivers-staging-rtl8723bs-fix-deadlock-in-rtw_survey.patch [new file with mode: 0644]
queue-5.15/drivers-tty-serial-fix-deadlock-in-sa1100_set_termio.patch [new file with mode: 0644]
queue-5.15/drivers-usb-host-fix-deadlock-in-oxu_bus_suspend.patch [new file with mode: 0644]
queue-5.15/drm-amd-display-check-if-modulo-is-0-before-dividing.patch [new file with mode: 0644]
queue-5.15/drm-amd-pm-fix-missing-thermal-throttler-status.patch [new file with mode: 0644]
queue-5.15/drm-amd-pm-use-bitmap_-from-to-_arr32-where-appropri.patch [new file with mode: 0644]
queue-5.15/drm-radeon-fix-a-possible-null-pointer-dereference.patch [new file with mode: 0644]
queue-5.15/extcon-fix-extcon_get_extcon_dev-error-handling.patch [new file with mode: 0644]
queue-5.15/extcon-modify-extcon-device-to-be-created-after-driv.patch [new file with mode: 0644]
queue-5.15/iio-dummy-iio_simple_dummy-check-the-return-value-of.patch [new file with mode: 0644]
queue-5.15/iio-st_sensors-add-a-local-lock-for-protecting-odr.patch [new file with mode: 0644]
queue-5.15/jump_label-noinstr-avoid-instrumentation-for-jump_la.patch [new file with mode: 0644]
queue-5.15/kernfs-separate-kernfs_pr_cont_buf-and-rename_lock.patch [new file with mode: 0644]
queue-5.15/lkdtm-usercopy-expand-size-of-out-of-frame-object.patch [new file with mode: 0644]
queue-5.15/md-protect-md_unregister_thread-from-reentrancy.patch [new file with mode: 0644]
queue-5.15/misc-rtsx-set-null-intfdata-when-probe-fails.patch [new file with mode: 0644]
queue-5.15/modpost-fix-undefined-behavior-of-is_arm_mapping_sym.patch [new file with mode: 0644]
queue-5.15/nbd-call-genl_unregister_family-first-in-nbd_cleanup.patch [new file with mode: 0644]
queue-5.15/nbd-fix-io-hung-while-disconnecting-device.patch [new file with mode: 0644]
queue-5.15/nbd-fix-race-between-nbd_alloc_config-and-module-rem.patch [new file with mode: 0644]
queue-5.15/nodemask-fix-return-values-to-be-unsigned.patch [new file with mode: 0644]
queue-5.15/revert-net-af_key-add-check-for-pfkey_broadcast-in-f.patch [new file with mode: 0644]
queue-5.15/s390-gmap-voluntarily-schedule-during-key-setting.patch [new file with mode: 0644]
queue-5.15/scsi-myrb-fix-up-null-pointer-access-on-myrb_cleanup.patch [new file with mode: 0644]
queue-5.15/serial-msm_serial-disable-interrupts-in-__msm_consol.patch [new file with mode: 0644]
queue-5.15/series
queue-5.15/soundwire-qcom-adjust-autoenumeration-timeout.patch [new file with mode: 0644]
queue-5.15/staging-rtl8712-fix-a-potential-memory-leak-in-r871x.patch [new file with mode: 0644]
queue-5.15/staging-rtl8712-fix-uninit-value-in-r871xu_drv_init.patch [new file with mode: 0644]
queue-5.15/staging-rtl8712-fix-uninit-value-in-usb_read8-and-fr.patch [new file with mode: 0644]
queue-5.15/sysrq-do-not-omit-current-cpu-when-showing-backtrace.patch [new file with mode: 0644]
queue-5.15/thunderbolt-use-different-lane-for-second-displaypor.patch [new file with mode: 0644]
queue-5.15/tty-fix-a-possible-resource-leak-in-icom_probe.patch [new file with mode: 0644]
queue-5.15/tty-synclink_gt-fix-null-pointer-dereference-in-slgt.patch [new file with mode: 0644]
queue-5.15/um-line-use-separate-irqs-per-line.patch [new file with mode: 0644]
queue-5.15/usb-dwc2-gadget-don-t-reset-gadget-s-driver-bus.patch [new file with mode: 0644]
queue-5.15/usb-hcd-pci-fully-suspend-across-freeze-thaw-cycle.patch [new file with mode: 0644]
queue-5.15/usb-host-isp116x-check-return-value-after-calling-pl.patch [new file with mode: 0644]
queue-5.15/watchdog-wdat_wdt-stop-watchdog-when-rebooting-the-s.patch [new file with mode: 0644]
queue-5.15/x86-cpu-elide-kcsan-for-cpu_has-and-friends.patch [new file with mode: 0644]

diff --git a/queue-5.15/ceph-allow-ceph.dir.rctime-xattr-to-be-updatable.patch b/queue-5.15/ceph-allow-ceph.dir.rctime-xattr-to-be-updatable.patch
new file mode 100644 (file)
index 0000000..82716cf
--- /dev/null
@@ -0,0 +1,67 @@
+From 483d63422efafc4b8989f99968647b14a1a79df9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 10 Mar 2022 09:34:19 -0500
+Subject: ceph: allow ceph.dir.rctime xattr to be updatable
+
+From: Venky Shankar <vshankar@redhat.com>
+
+[ Upstream commit d7a2dc523085f8b8c60548ceedc696934aefeb0e ]
+
+`rctime' has been a pain point in cephfs due to its buggy
+nature - inconsistent values reported and those sorts.
+Fixing rctime is non-trivial needing an overall redesign
+of the entire nested statistics infrastructure.
+
+As a workaround, PR
+
+     http://github.com/ceph/ceph/pull/37938
+
+allows this extended attribute to be manually set. This allows
+users to "fixup" inconsistent rctime values. While this sounds
+messy, its probably the wisest approach allowing users/scripts
+to workaround buggy rctime values.
+
+The above PR enables Ceph MDS to allow manually setting
+rctime extended attribute with the corresponding user-land
+changes. We may as well allow the same to be done via kclient
+for parity.
+
+Signed-off-by: Venky Shankar <vshankar@redhat.com>
+Reviewed-by: Xiubo Li <xiubli@redhat.com>
+Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/ceph/xattr.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
+index 159a1ffa4f4b..db288b4aee6d 100644
+--- a/fs/ceph/xattr.c
++++ b/fs/ceph/xattr.c
+@@ -366,6 +366,14 @@ static ssize_t ceph_vxattrcb_auth_mds(struct ceph_inode_info *ci,
+       }
+ #define XATTR_RSTAT_FIELD(_type, _name)                       \
+       XATTR_NAME_CEPH(_type, _name, VXATTR_FLAG_RSTAT)
++#define XATTR_RSTAT_FIELD_UPDATABLE(_type, _name)                     \
++      {                                                               \
++              .name = CEPH_XATTR_NAME(_type, _name),                  \
++              .name_size = sizeof (CEPH_XATTR_NAME(_type, _name)),    \
++              .getxattr_cb = ceph_vxattrcb_ ## _type ## _ ## _name,   \
++              .exists_cb = NULL,                                      \
++              .flags = VXATTR_FLAG_RSTAT,                             \
++      }
+ #define XATTR_LAYOUT_FIELD(_type, _name, _field)                      \
+       {                                                               \
+               .name = CEPH_XATTR_NAME2(_type, _name, _field), \
+@@ -404,7 +412,7 @@ static struct ceph_vxattr ceph_dir_vxattrs[] = {
+       XATTR_RSTAT_FIELD(dir, rsubdirs),
+       XATTR_RSTAT_FIELD(dir, rsnaps),
+       XATTR_RSTAT_FIELD(dir, rbytes),
+-      XATTR_RSTAT_FIELD(dir, rctime),
++      XATTR_RSTAT_FIELD_UPDATABLE(dir, rctime),
+       {
+               .name = "ceph.dir.pin",
+               .name_size = sizeof("ceph.dir.pin"),
+-- 
+2.35.1
+
diff --git a/queue-5.15/ceph-flush-the-mdlog-for-filesystem-sync.patch b/queue-5.15/ceph-flush-the-mdlog-for-filesystem-sync.patch
new file mode 100644 (file)
index 0000000..996b4c9
--- /dev/null
@@ -0,0 +1,113 @@
+From 087c57f109938c0ccae3fca1f99b8d31288d3388 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 19 Apr 2022 08:58:49 +0800
+Subject: ceph: flush the mdlog for filesystem sync
+
+From: Xiubo Li <xiubli@redhat.com>
+
+[ Upstream commit 1b2ba3c5616e17ff951359e25c658a1c3f146f1e ]
+
+Before waiting for a request's safe reply, we will send the mdlog flush
+request to the relevant MDS. And this will also flush the mdlog for all
+the other unsafe requests in the same session, so we can record the last
+session and no need to flush mdlog again in the next loop. But there
+still have cases that it may send the mdlog flush requst twice or more,
+but that should be not often.
+
+Rename wait_unsafe_requests() to
+flush_mdlog_and_wait_mdsc_unsafe_requests() to make it more
+descriptive.
+
+[xiubli: fold in MDS request refcount leak fix from Jeff]
+
+URL: https://tracker.ceph.com/issues/55284
+URL: https://tracker.ceph.com/issues/55411
+Signed-off-by: Xiubo Li <xiubli@redhat.com>
+Reviewed-by: Jeff Layton <jlayton@kernel.org>
+Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/ceph/mds_client.c | 33 +++++++++++++++++++++++++++------
+ 1 file changed, 27 insertions(+), 6 deletions(-)
+
+diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
+index e9409c460acd..912903de4de4 100644
+--- a/fs/ceph/mds_client.c
++++ b/fs/ceph/mds_client.c
+@@ -4794,15 +4794,17 @@ void ceph_mdsc_pre_umount(struct ceph_mds_client *mdsc)
+ }
+ /*
+- * wait for all write mds requests to flush.
++ * flush the mdlog and wait for all write mds requests to flush.
+  */
+-static void wait_unsafe_requests(struct ceph_mds_client *mdsc, u64 want_tid)
++static void flush_mdlog_and_wait_mdsc_unsafe_requests(struct ceph_mds_client *mdsc,
++                                               u64 want_tid)
+ {
+       struct ceph_mds_request *req = NULL, *nextreq;
++      struct ceph_mds_session *last_session = NULL;
+       struct rb_node *n;
+       mutex_lock(&mdsc->mutex);
+-      dout("wait_unsafe_requests want %lld\n", want_tid);
++      dout("%s want %lld\n", __func__, want_tid);
+ restart:
+       req = __get_oldest_req(mdsc);
+       while (req && req->r_tid <= want_tid) {
+@@ -4814,14 +4816,32 @@ static void wait_unsafe_requests(struct ceph_mds_client *mdsc, u64 want_tid)
+                       nextreq = NULL;
+               if (req->r_op != CEPH_MDS_OP_SETFILELOCK &&
+                   (req->r_op & CEPH_MDS_OP_WRITE)) {
++                      struct ceph_mds_session *s = req->r_session;
++
++                      if (!s) {
++                              req = nextreq;
++                              continue;
++                      }
++
+                       /* write op */
+                       ceph_mdsc_get_request(req);
+                       if (nextreq)
+                               ceph_mdsc_get_request(nextreq);
++                      s = ceph_get_mds_session(s);
+                       mutex_unlock(&mdsc->mutex);
+-                      dout("wait_unsafe_requests  wait on %llu (want %llu)\n",
++
++                      /* send flush mdlog request to MDS */
++                      if (last_session != s) {
++                              send_flush_mdlog(s);
++                              ceph_put_mds_session(last_session);
++                              last_session = s;
++                      } else {
++                              ceph_put_mds_session(s);
++                      }
++                      dout("%s wait on %llu (want %llu)\n", __func__,
+                            req->r_tid, want_tid);
+                       wait_for_completion(&req->r_safe_completion);
++
+                       mutex_lock(&mdsc->mutex);
+                       ceph_mdsc_put_request(req);
+                       if (!nextreq)
+@@ -4836,7 +4856,8 @@ static void wait_unsafe_requests(struct ceph_mds_client *mdsc, u64 want_tid)
+               req = nextreq;
+       }
+       mutex_unlock(&mdsc->mutex);
+-      dout("wait_unsafe_requests done\n");
++      ceph_put_mds_session(last_session);
++      dout("%s done\n", __func__);
+ }
+ void ceph_mdsc_sync(struct ceph_mds_client *mdsc)
+@@ -4865,7 +4886,7 @@ void ceph_mdsc_sync(struct ceph_mds_client *mdsc)
+       dout("sync want tid %lld flush_seq %lld\n",
+            want_tid, want_flush);
+-      wait_unsafe_requests(mdsc, want_tid);
++      flush_mdlog_and_wait_mdsc_unsafe_requests(mdsc, want_tid);
+       wait_caps_flush(mdsc, want_flush);
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/char-xillybus-fix-a-refcount-leak-in-cleanup_dev.patch b/queue-5.15/char-xillybus-fix-a-refcount-leak-in-cleanup_dev.patch
new file mode 100644 (file)
index 0000000..d7c9a13
--- /dev/null
@@ -0,0 +1,36 @@
+From 39bee343033cc3636a4f50b8173ee7606fda6f4c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 6 Apr 2022 15:57:03 +0800
+Subject: char: xillybus: fix a refcount leak in cleanup_dev()
+
+From: Hangyu Hua <hbh25y@gmail.com>
+
+[ Upstream commit b67d19662fdee275c479d21853bc1239600a798f ]
+
+usb_get_dev is called in xillyusb_probe. So it is better to call
+usb_put_dev before xdev is released.
+
+Acked-by: Eli Billauer <eli.billauer@gmail.com>
+Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
+Link: https://lore.kernel.org/r/20220406075703.23464-1-hbh25y@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/char/xillybus/xillyusb.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/char/xillybus/xillyusb.c b/drivers/char/xillybus/xillyusb.c
+index dc3551796e5e..39bcbfd908b4 100644
+--- a/drivers/char/xillybus/xillyusb.c
++++ b/drivers/char/xillybus/xillyusb.c
+@@ -549,6 +549,7 @@ static void cleanup_dev(struct kref *kref)
+       if (xdev->workq)
+               destroy_workqueue(xdev->workq);
++      usb_put_dev(xdev->udev);
+       kfree(xdev->channels); /* Argument may be NULL, and that's fine */
+       kfree(xdev);
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/cifs-version-operations-for-smb20-unneeded-when-lega.patch b/queue-5.15/cifs-version-operations-for-smb20-unneeded-when-lega.patch
new file mode 100644 (file)
index 0000000..b9c5d7b
--- /dev/null
@@ -0,0 +1,97 @@
+From dfe7a15e42d17119ae829c070a6a723052c49fc9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 1 Jun 2022 22:08:46 -0500
+Subject: cifs: version operations for smb20 unneeded when legacy support
+ disabled
+
+From: Steve French <stfrench@microsoft.com>
+
+[ Upstream commit 7ef93ffccd55fb0ba000ed16ef6a81cd7dee07b5 ]
+
+We should not be including unused smb20 specific code when legacy
+support is disabled (CONFIG_CIFS_ALLOW_INSECURE_LEGACY turned
+off).  For example smb2_operations and smb2_values aren't used
+in that case.  Over time we can move more and more SMB1/CIFS and SMB2.0
+code into the insecure legacy ifdefs
+
+Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/cifs/cifsglob.h | 4 +++-
+ fs/cifs/smb2ops.c  | 7 ++++++-
+ 2 files changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
+index b33835b2943e..a97ed30843cf 100644
+--- a/fs/cifs/cifsglob.h
++++ b/fs/cifs/cifsglob.h
+@@ -1890,11 +1890,13 @@ extern mempool_t *cifs_mid_poolp;
+ /* Operations for different SMB versions */
+ #define SMB1_VERSION_STRING   "1.0"
++#define SMB20_VERSION_STRING    "2.0"
++#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
+ extern struct smb_version_operations smb1_operations;
+ extern struct smb_version_values smb1_values;
+-#define SMB20_VERSION_STRING  "2.0"
+ extern struct smb_version_operations smb20_operations;
+ extern struct smb_version_values smb20_values;
++#endif /* CIFS_ALLOW_INSECURE_LEGACY */
+ #define SMB21_VERSION_STRING  "2.1"
+ extern struct smb_version_operations smb21_operations;
+ extern struct smb_version_values smb21_values;
+diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
+index 775296e4d3c8..735aafee63be 100644
+--- a/fs/cifs/smb2ops.c
++++ b/fs/cifs/smb2ops.c
+@@ -4271,11 +4271,13 @@ smb3_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock,
+       }
+ }
++#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
+ static bool
+ smb2_is_read_op(__u32 oplock)
+ {
+       return oplock == SMB2_OPLOCK_LEVEL_II;
+ }
++#endif /* CIFS_ALLOW_INSECURE_LEGACY */
+ static bool
+ smb21_is_read_op(__u32 oplock)
+@@ -5371,7 +5373,7 @@ smb2_make_node(unsigned int xid, struct inode *inode,
+       return rc;
+ }
+-
++#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
+ struct smb_version_operations smb20_operations = {
+       .compare_fids = smb2_compare_fids,
+       .setup_request = smb2_setup_request,
+@@ -5470,6 +5472,7 @@ struct smb_version_operations smb20_operations = {
+       .is_status_io_timeout = smb2_is_status_io_timeout,
+       .is_network_name_deleted = smb2_is_network_name_deleted,
+ };
++#endif /* CIFS_ALLOW_INSECURE_LEGACY */
+ struct smb_version_operations smb21_operations = {
+       .compare_fids = smb2_compare_fids,
+@@ -5801,6 +5804,7 @@ struct smb_version_operations smb311_operations = {
+       .is_network_name_deleted = smb2_is_network_name_deleted,
+ };
++#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
+ struct smb_version_values smb20_values = {
+       .version_string = SMB20_VERSION_STRING,
+       .protocol_id = SMB20_PROT_ID,
+@@ -5821,6 +5825,7 @@ struct smb_version_values smb20_values = {
+       .signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED,
+       .create_lease_size = sizeof(struct create_lease),
+ };
++#endif /* ALLOW_INSECURE_LEGACY */
+ struct smb_version_values smb21_values = {
+       .version_string = SMB21_VERSION_STRING,
+-- 
+2.35.1
+
diff --git a/queue-5.15/clocksource-drivers-sp804-avoid-error-on-multiple-in.patch b/queue-5.15/clocksource-drivers-sp804-avoid-error-on-multiple-in.patch
new file mode 100644 (file)
index 0000000..bcae7bb
--- /dev/null
@@ -0,0 +1,65 @@
+From 5140618428b5188004ad3b2c5d5cab95bac9090a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 6 May 2022 17:25:22 +0100
+Subject: clocksource/drivers/sp804: Avoid error on multiple instances
+
+From: Andre Przywara <andre.przywara@arm.com>
+
+[ Upstream commit a98399cbc1e05f7b977419f03905501d566cf54e ]
+
+When a machine sports more than one SP804 timer instance, we only bring
+up the first one, since multiple timers of the same kind are not useful
+to Linux. As this is intentional behaviour, we should not return an
+error message, as we do today:
+===============
+[    0.000800] Failed to initialize '/bus@8000000/motherboard-bus@8000000/iofpga-bus@300000000/timer@120000': -22
+===============
+
+Replace the -EINVAL return with a debug message and return 0 instead.
+
+Also we do not reach the init function anymore if the DT node is
+disabled (as this is now handled by OF_DECLARE), so remove the explicit
+check for that case.
+
+This fixes a long standing bogus error when booting ARM's fastmodels.
+
+Signed-off-by: Andre Przywara <andre.przywara@arm.com>
+Reviewed-by: Robin Murphy <robin.murphy@arm.com>
+Link: https://lore.kernel.org/r/20220506162522.3675399-1-andre.przywara@arm.com
+Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/clocksource/timer-sp804.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/clocksource/timer-sp804.c b/drivers/clocksource/timer-sp804.c
+index 401d592e85f5..e6a87f4af2b5 100644
+--- a/drivers/clocksource/timer-sp804.c
++++ b/drivers/clocksource/timer-sp804.c
+@@ -259,6 +259,11 @@ static int __init sp804_of_init(struct device_node *np, struct sp804_timer *time
+       struct clk *clk1, *clk2;
+       const char *name = of_get_property(np, "compatible", NULL);
++      if (initialized) {
++              pr_debug("%pOF: skipping further SP804 timer device\n", np);
++              return 0;
++      }
++
+       base = of_iomap(np, 0);
+       if (!base)
+               return -ENXIO;
+@@ -270,11 +275,6 @@ static int __init sp804_of_init(struct device_node *np, struct sp804_timer *time
+       writel(0, timer1_base + timer->ctrl);
+       writel(0, timer2_base + timer->ctrl);
+-      if (initialized || !of_device_is_available(np)) {
+-              ret = -EINVAL;
+-              goto err;
+-      }
+-
+       clk1 = of_clk_get(np, 0);
+       if (IS_ERR(clk1))
+               clk1 = NULL;
+-- 
+2.35.1
+
diff --git a/queue-5.15/drivers-staging-rtl8192bs-fix-deadlock-in-rtw_joinbs.patch b/queue-5.15/drivers-staging-rtl8192bs-fix-deadlock-in-rtw_joinbs.patch
new file mode 100644 (file)
index 0000000..966646b
--- /dev/null
@@ -0,0 +1,76 @@
+From 25472cdf4047f237e5807be7ce73b8ac77f12784 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 9 Apr 2022 14:49:53 +0800
+Subject: drivers: staging: rtl8192bs: Fix deadlock in
+ rtw_joinbss_event_prehandle()
+
+From: Duoming Zhou <duoming@zju.edu.cn>
+
+[ Upstream commit 041879b12ddb0c6c83ed9c0bdd10dc82a056f2fc ]
+
+There is a deadlock in rtw_joinbss_event_prehandle(), which is shown
+below:
+
+   (Thread 1)                |      (Thread 2)
+                             | _set_timer()
+rtw_joinbss_event_prehandle()|  mod_timer()
+ spin_lock_bh() //(1)        |  (wait a time)
+ ...                         | _rtw_join_timeout_handler()
+ del_timer_sync()            |  spin_lock_bh() //(2)
+ (wait timer to stop)        |  ...
+
+We hold pmlmepriv->lock in position (1) of thread 1 and
+use del_timer_sync() to wait timer to stop, but timer handler
+also need pmlmepriv->lock in position (2) of thread 2.
+As a result, rtw_joinbss_event_prehandle() will block forever.
+
+This patch extracts del_timer_sync() from the protection of
+spin_lock_bh(), which could let timer handler to obtain
+the needed lock. What`s more, we change spin_lock_bh() to
+spin_lock_irq() in _rtw_join_timeout_handler() in order to
+prevent deadlock.
+
+Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
+Link: https://lore.kernel.org/r/20220409064953.67420-1-duoming@zju.edu.cn
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/staging/rtl8723bs/core/rtw_mlme.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
+index 2c20bf26b10e..952c3e14d1b3 100644
+--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
++++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
+@@ -1238,8 +1238,10 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf)
+                       spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
++                      spin_unlock_bh(&pmlmepriv->lock);
+                       /* s5. Cancel assoc_timer */
+                       del_timer_sync(&pmlmepriv->assoc_timer);
++                      spin_lock_bh(&pmlmepriv->lock);
+               } else {
+                       spin_unlock_bh(&(pmlmepriv->scanned_queue.lock));
+               }
+@@ -1545,7 +1547,7 @@ void _rtw_join_timeout_handler(struct timer_list *t)
+       if (adapter->bDriverStopped || adapter->bSurpriseRemoved)
+               return;
+-      spin_lock_bh(&pmlmepriv->lock);
++      spin_lock_irq(&pmlmepriv->lock);
+       if (rtw_to_roam(adapter) > 0) { /* join timeout caused by roaming */
+               while (1) {
+@@ -1573,7 +1575,7 @@ void _rtw_join_timeout_handler(struct timer_list *t)
+       }
+-      spin_unlock_bh(&pmlmepriv->lock);
++      spin_unlock_irq(&pmlmepriv->lock);
+ }
+ /*
+-- 
+2.35.1
+
diff --git a/queue-5.15/drivers-staging-rtl8192e-fix-deadlock-in-rtllib_beac.patch b/queue-5.15/drivers-staging-rtl8192e-fix-deadlock-in-rtllib_beac.patch
new file mode 100644 (file)
index 0000000..83703ed
--- /dev/null
@@ -0,0 +1,55 @@
+From 27eb80a0fbf5f36b6fbbd70da6a46831a0187f54 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 17 Apr 2022 22:16:41 +0800
+Subject: drivers: staging: rtl8192e: Fix deadlock in rtllib_beacons_stop()
+
+From: Duoming Zhou <duoming@zju.edu.cn>
+
+[ Upstream commit 9b6bdbd9337de3917945847bde262a34a87a6303 ]
+
+There is a deadlock in rtllib_beacons_stop(), which is shown
+below:
+
+   (Thread 1)              |      (Thread 2)
+                           | rtllib_send_beacon()
+rtllib_beacons_stop()      |  mod_timer()
+ spin_lock_irqsave() //(1) |  (wait a time)
+ ...                       | rtllib_send_beacon_cb()
+ del_timer_sync()          |  spin_lock_irqsave() //(2)
+ (wait timer to stop)      |  ...
+
+We hold ieee->beacon_lock in position (1) of thread 1 and
+use del_timer_sync() to wait timer to stop, but timer handler
+also need ieee->beacon_lock in position (2) of thread 2.
+As a result, rtllib_beacons_stop() will block forever.
+
+This patch extracts del_timer_sync() from the protection of
+spin_lock_irqsave(), which could let timer handler to obtain
+the needed lock.
+
+Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
+Link: https://lore.kernel.org/r/20220417141641.124388-1-duoming@zju.edu.cn
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/staging/rtl8192e/rtllib_softmac.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
+index 503d33be71d9..ea8bc27fce49 100644
+--- a/drivers/staging/rtl8192e/rtllib_softmac.c
++++ b/drivers/staging/rtl8192e/rtllib_softmac.c
+@@ -651,9 +651,9 @@ static void rtllib_beacons_stop(struct rtllib_device *ieee)
+       spin_lock_irqsave(&ieee->beacon_lock, flags);
+       ieee->beacon_txing = 0;
+-      del_timer_sync(&ieee->beacon_timer);
+       spin_unlock_irqrestore(&ieee->beacon_lock, flags);
++      del_timer_sync(&ieee->beacon_timer);
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/drivers-staging-rtl8192u-fix-deadlock-in-ieee80211_b.patch b/queue-5.15/drivers-staging-rtl8192u-fix-deadlock-in-ieee80211_b.patch
new file mode 100644 (file)
index 0000000..02b716b
--- /dev/null
@@ -0,0 +1,54 @@
+From b1cb0ea39a1d0ee8347526e7fca76d2bda82f49d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 17 Apr 2022 21:54:07 +0800
+Subject: drivers: staging: rtl8192u: Fix deadlock in ieee80211_beacons_stop()
+
+From: Duoming Zhou <duoming@zju.edu.cn>
+
+[ Upstream commit 806c7b53414934ba2a39449b31fd1a038e500273 ]
+
+There is a deadlock in ieee80211_beacons_stop(), which is shown below:
+
+   (Thread 1)              |      (Thread 2)
+                           | ieee80211_send_beacon()
+ieee80211_beacons_stop()   |  mod_timer()
+ spin_lock_irqsave() //(1) |  (wait a time)
+ ...                       | ieee80211_send_beacon_cb()
+ del_timer_sync()          |  spin_lock_irqsave() //(2)
+ (wait timer to stop)      |  ...
+
+We hold ieee->beacon_lock in position (1) of thread 1 and use
+del_timer_sync() to wait timer to stop, but timer handler
+also need ieee->beacon_lock in position (2) of thread 2.
+As a result, ieee80211_beacons_stop() will block forever.
+
+This patch extracts del_timer_sync() from the protection of
+spin_lock_irqsave(), which could let timer handler to obtain
+the needed lock.
+
+Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
+Link: https://lore.kernel.org/r/20220417135407.109536-1-duoming@zju.edu.cn
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+index 1a193f900779..2b06706a7071 100644
+--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
++++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+@@ -528,9 +528,9 @@ static void ieee80211_beacons_stop(struct ieee80211_device *ieee)
+       spin_lock_irqsave(&ieee->beacon_lock, flags);
+       ieee->beacon_txing = 0;
+-      del_timer_sync(&ieee->beacon_timer);
+       spin_unlock_irqrestore(&ieee->beacon_lock, flags);
++      del_timer_sync(&ieee->beacon_timer);
+ }
+ void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
+-- 
+2.35.1
+
diff --git a/queue-5.15/drivers-staging-rtl8723bs-fix-deadlock-in-rtw_survey.patch b/queue-5.15/drivers-staging-rtl8723bs-fix-deadlock-in-rtw_survey.patch
new file mode 100644 (file)
index 0000000..867b6f2
--- /dev/null
@@ -0,0 +1,71 @@
+From 59d95324777939d8cbb02760594f8ece9da49c68 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 9 Apr 2022 14:18:35 +0800
+Subject: drivers: staging: rtl8723bs: Fix deadlock in
+ rtw_surveydone_event_callback()
+
+From: Duoming Zhou <duoming@zju.edu.cn>
+
+[ Upstream commit cc7ad0d77b51c872d629bcd98aea463a3c4109e7 ]
+
+There is a deadlock in rtw_surveydone_event_callback(),
+which is shown below:
+
+   (Thread 1)                  |      (Thread 2)
+                               | _set_timer()
+rtw_surveydone_event_callback()|  mod_timer()
+ spin_lock_bh() //(1)          |  (wait a time)
+ ...                           | rtw_scan_timeout_handler()
+ del_timer_sync()              |  spin_lock_bh() //(2)
+ (wait timer to stop)          |  ...
+
+We hold pmlmepriv->lock in position (1) of thread 1 and use
+del_timer_sync() to wait timer to stop, but timer handler
+also need pmlmepriv->lock in position (2) of thread 2.
+As a result, rtw_surveydone_event_callback() will block forever.
+
+This patch extracts del_timer_sync() from the protection of
+spin_lock_bh(), which could let timer handler to obtain
+the needed lock. What`s more, we change spin_lock_bh() in
+rtw_scan_timeout_handler() to spin_lock_irq(). Otherwise,
+spin_lock_bh() will also cause deadlock() in timer handler.
+
+Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
+Link: https://lore.kernel.org/r/20220409061836.60529-1-duoming@zju.edu.cn
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/staging/rtl8723bs/core/rtw_mlme.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
+index cf79bec916c5..2c20bf26b10e 100644
+--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
++++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
+@@ -749,7 +749,9 @@ void rtw_surveydone_event_callback(struct adapter  *adapter, u8 *pbuf)
+       }
+       if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) {
++              spin_unlock_bh(&pmlmepriv->lock);
+               del_timer_sync(&pmlmepriv->scan_to_timer);
++              spin_lock_bh(&pmlmepriv->lock);
+               _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY);
+       }
+@@ -1584,11 +1586,11 @@ void rtw_scan_timeout_handler(struct timer_list *t)
+                                                 mlmepriv.scan_to_timer);
+       struct  mlme_priv *pmlmepriv = &adapter->mlmepriv;
+-      spin_lock_bh(&pmlmepriv->lock);
++      spin_lock_irq(&pmlmepriv->lock);
+       _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY);
+-      spin_unlock_bh(&pmlmepriv->lock);
++      spin_unlock_irq(&pmlmepriv->lock);
+       rtw_indicate_scan_done(adapter, true);
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/drivers-tty-serial-fix-deadlock-in-sa1100_set_termio.patch b/queue-5.15/drivers-tty-serial-fix-deadlock-in-sa1100_set_termio.patch
new file mode 100644 (file)
index 0000000..90e2894
--- /dev/null
@@ -0,0 +1,61 @@
+From 45d105e8fa57dd8c37178f2371dfdeeb256a841f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 17 Apr 2022 19:16:26 +0800
+Subject: drivers: tty: serial: Fix deadlock in sa1100_set_termios()
+
+From: Duoming Zhou <duoming@zju.edu.cn>
+
+[ Upstream commit 62b2caef400c1738b6d22f636c628d9f85cd4c4c ]
+
+There is a deadlock in sa1100_set_termios(), which is shown
+below:
+
+   (Thread 1)              |      (Thread 2)
+                           | sa1100_enable_ms()
+sa1100_set_termios()       |  mod_timer()
+ spin_lock_irqsave() //(1) |  (wait a time)
+ ...                       | sa1100_timeout()
+ del_timer_sync()          |  spin_lock_irqsave() //(2)
+ (wait timer to stop)      |  ...
+
+We hold sport->port.lock in position (1) of thread 1 and
+use del_timer_sync() to wait timer to stop, but timer handler
+also need sport->port.lock in position (2) of thread 2. As a result,
+sa1100_set_termios() will block forever.
+
+This patch moves del_timer_sync() before spin_lock_irqsave()
+in order to prevent the deadlock.
+
+Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
+Link: https://lore.kernel.org/r/20220417111626.7802-1-duoming@zju.edu.cn
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/tty/serial/sa1100.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/tty/serial/sa1100.c b/drivers/tty/serial/sa1100.c
+index 697b6a002a16..4ddcc985621a 100644
+--- a/drivers/tty/serial/sa1100.c
++++ b/drivers/tty/serial/sa1100.c
+@@ -446,6 +446,8 @@ sa1100_set_termios(struct uart_port *port, struct ktermios *termios,
+       baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); 
+       quot = uart_get_divisor(port, baud);
++      del_timer_sync(&sport->timer);
++
+       spin_lock_irqsave(&sport->port.lock, flags);
+       sport->port.read_status_mask &= UTSR0_TO_SM(UTSR0_TFS);
+@@ -476,8 +478,6 @@ sa1100_set_termios(struct uart_port *port, struct ktermios *termios,
+                               UTSR1_TO_SM(UTSR1_ROR);
+       }
+-      del_timer_sync(&sport->timer);
+-
+       /*
+        * Update the per-port timeout.
+        */
+-- 
+2.35.1
+
diff --git a/queue-5.15/drivers-usb-host-fix-deadlock-in-oxu_bus_suspend.patch b/queue-5.15/drivers-usb-host-fix-deadlock-in-oxu_bus_suspend.patch
new file mode 100644 (file)
index 0000000..338c4d2
--- /dev/null
@@ -0,0 +1,54 @@
+From 44e9993a0008a51edbb1c8c4b3458c3c17c4172f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 17 Apr 2022 20:03:05 +0800
+Subject: drivers: usb: host: Fix deadlock in oxu_bus_suspend()
+
+From: Duoming Zhou <duoming@zju.edu.cn>
+
+[ Upstream commit 4d378f2ae58138d4c55684e1d274e7dd94aa6524 ]
+
+There is a deadlock in oxu_bus_suspend(), which is shown below:
+
+   (Thread 1)              |      (Thread 2)
+                           | timer_action()
+oxu_bus_suspend()          |  mod_timer()
+ spin_lock_irq() //(1)     |  (wait a time)
+ ...                       | oxu_watchdog()
+ del_timer_sync()          |  spin_lock_irq() //(2)
+ (wait timer to stop)      |  ...
+
+We hold oxu->lock in position (1) of thread 1, and use
+del_timer_sync() to wait timer to stop, but timer handler
+also need oxu->lock in position (2) of thread 2. As a result,
+oxu_bus_suspend() will block forever.
+
+This patch extracts del_timer_sync() from the protection of
+spin_lock_irq(), which could let timer handler to obtain
+the needed lock.
+
+Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
+Link: https://lore.kernel.org/r/20220417120305.64577-1-duoming@zju.edu.cn
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/usb/host/oxu210hp-hcd.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
+index 4300326b3730..6be6c5878d08 100644
+--- a/drivers/usb/host/oxu210hp-hcd.c
++++ b/drivers/usb/host/oxu210hp-hcd.c
+@@ -3909,8 +3909,10 @@ static int oxu_bus_suspend(struct usb_hcd *hcd)
+               }
+       }
++      spin_unlock_irq(&oxu->lock);
+       /* turn off now-idle HC */
+       del_timer_sync(&oxu->watchdog);
++      spin_lock_irq(&oxu->lock);
+       ehci_halt(oxu);
+       hcd->state = HC_STATE_SUSPENDED;
+-- 
+2.35.1
+
diff --git a/queue-5.15/drm-amd-display-check-if-modulo-is-0-before-dividing.patch b/queue-5.15/drm-amd-display-check-if-modulo-is-0-before-dividing.patch
new file mode 100644 (file)
index 0000000..87f4ad8
--- /dev/null
@@ -0,0 +1,45 @@
+From 0a6f4edf549ab257a848c5c70637b86ee3361335 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 3 May 2022 18:30:25 -0400
+Subject: drm/amd/display: Check if modulo is 0 before dividing.
+
+From: David Galiffi <David.Galiffi@amd.com>
+
+[ Upstream commit 49947b906a6bd9668eaf4f9cf691973c25c26955 ]
+
+[How & Why]
+If a value of 0 is read, then this will cause a divide-by-0 panic.
+
+Reviewed-by: Martin Leung <Martin.Leung@amd.com>
+Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
+Signed-off-by: David Galiffi <David.Galiffi@amd.com>
+Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
+index 2c7eb982eabc..054823d12403 100644
+--- a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
++++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
+@@ -1013,9 +1013,12 @@ static bool get_pixel_clk_frequency_100hz(
+                        * not be programmed equal to DPREFCLK
+                        */
+                       modulo_hz = REG_READ(MODULO[inst]);
+-                      *pixel_clk_khz = div_u64((uint64_t)clock_hz*
+-                              clock_source->ctx->dc->clk_mgr->dprefclk_khz*10,
+-                              modulo_hz);
++                      if (modulo_hz)
++                              *pixel_clk_khz = div_u64((uint64_t)clock_hz*
++                                      clock_source->ctx->dc->clk_mgr->dprefclk_khz*10,
++                                      modulo_hz);
++                      else
++                              *pixel_clk_khz = 0;
+               } else {
+                       /* NOTE: There is agreement with VBIOS here that MODULO is
+                        * programmed equal to DPREFCLK, in which case PHASE will be
+-- 
+2.35.1
+
diff --git a/queue-5.15/drm-amd-pm-fix-missing-thermal-throttler-status.patch b/queue-5.15/drm-amd-pm-fix-missing-thermal-throttler-status.patch
new file mode 100644 (file)
index 0000000..55c2539
--- /dev/null
@@ -0,0 +1,36 @@
+From bebd1e07e26d9d1948feb753cbf5f7df8100a15f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 19 May 2022 10:50:25 +0530
+Subject: drm/amd/pm: Fix missing thermal throttler status
+
+From: Lijo Lazar <lijo.lazar@amd.com>
+
+[ Upstream commit b0f4d663fce6a4232d3c20ce820f919111b1c60b ]
+
+On aldebaran, when thermal throttling happens due to excessive GPU
+temperature, the reason for throttling event is missed in warning
+message. This patch fixes it.
+
+Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
+Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
+index c9cfeb094750..d0c6b864d00a 100644
+--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
++++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
+@@ -1627,6 +1627,7 @@ static const struct throttling_logging_label {
+       uint32_t feature_mask;
+       const char *label;
+ } logging_label[] = {
++      {(1U << THROTTLER_TEMP_GPU_BIT), "GPU"},
+       {(1U << THROTTLER_TEMP_MEM_BIT), "HBM"},
+       {(1U << THROTTLER_TEMP_VR_GFX_BIT), "VR of GFX rail"},
+       {(1U << THROTTLER_TEMP_VR_MEM_BIT), "VR of HBM rail"},
+-- 
+2.35.1
+
diff --git a/queue-5.15/drm-amd-pm-use-bitmap_-from-to-_arr32-where-appropri.patch b/queue-5.15/drm-amd-pm-use-bitmap_-from-to-_arr32-where-appropri.patch
new file mode 100644 (file)
index 0000000..06445d8
--- /dev/null
@@ -0,0 +1,59 @@
+From 826749bead808c7add3af05c1377c9cbd6cb0416 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 28 Apr 2022 13:51:16 -0700
+Subject: drm/amd/pm: use bitmap_{from,to}_arr32 where appropriate
+
+From: Yury Norov <yury.norov@gmail.com>
+
+[ Upstream commit 525d6515604eb1373ce5e6372a6b6640953b2d6a ]
+
+The smu_v1X_0_set_allowed_mask() uses bitmap_copy() to convert
+bitmap to 32-bit array. This may be wrong due to endiannes issues.
+Fix it by switching to bitmap_{from,to}_arr32.
+
+CC: Alexander Gordeev <agordeev@linux.ibm.com>
+CC: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+CC: Christian Borntraeger <borntraeger@linux.ibm.com>
+CC: Claudio Imbrenda <imbrenda@linux.ibm.com>
+CC: David Hildenbrand <david@redhat.com>
+CC: Heiko Carstens <hca@linux.ibm.com>
+CC: Janosch Frank <frankja@linux.ibm.com>
+CC: Rasmus Villemoes <linux@rasmusvillemoes.dk>
+CC: Sven Schnelle <svens@linux.ibm.com>
+CC: Vasily Gorbik <gor@linux.ibm.com>
+Signed-off-by: Yury Norov <yury.norov@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 2 +-
+ drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
+index 87b055466a33..e6c93396434f 100644
+--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
++++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
+@@ -772,7 +772,7 @@ int smu_v11_0_set_allowed_mask(struct smu_context *smu)
+               goto failed;
+       }
+-      bitmap_copy((unsigned long *)feature_mask, feature->allowed, 64);
++      bitmap_to_arr32(feature_mask, feature->allowed, 64);
+       ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetAllowedFeaturesMaskHigh,
+                                         feature_mask[1], NULL);
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
+index 8d4aa16b2ae7..6211570fb64f 100644
+--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
++++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
+@@ -721,7 +721,7 @@ int smu_v13_0_set_allowed_mask(struct smu_context *smu)
+       if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) || feature->feature_num < 64)
+               goto failed;
+-      bitmap_copy((unsigned long *)feature_mask, feature->allowed, 64);
++      bitmap_to_arr32(feature_mask, feature->allowed, 64);
+       ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetAllowedFeaturesMaskHigh,
+                                             feature_mask[1], NULL);
+-- 
+2.35.1
+
diff --git a/queue-5.15/drm-radeon-fix-a-possible-null-pointer-dereference.patch b/queue-5.15/drm-radeon-fix-a-possible-null-pointer-dereference.patch
new file mode 100644 (file)
index 0000000..d71bd61
--- /dev/null
@@ -0,0 +1,47 @@
+From eae5d1ea6b6ed43c18aa3122350080269fd857ec Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 17 May 2022 17:57:00 +0800
+Subject: drm/radeon: fix a possible null pointer dereference
+
+From: Gong Yuanjun <ruc_gongyuanjun@163.com>
+
+[ Upstream commit a2b28708b645c5632dc93669ab06e97874c8244f ]
+
+In radeon_fp_native_mode(), the return value of drm_mode_duplicate()
+is assigned to mode, which will lead to a NULL pointer dereference
+on failure of drm_mode_duplicate(). Add a check to avoid npd.
+
+The failure status of drm_cvt_mode() on the other path is checked too.
+
+Signed-off-by: Gong Yuanjun <ruc_gongyuanjun@163.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/radeon/radeon_connectors.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
+index 1546abcadacf..d157bb9072e8 100644
+--- a/drivers/gpu/drm/radeon/radeon_connectors.c
++++ b/drivers/gpu/drm/radeon/radeon_connectors.c
+@@ -473,6 +473,8 @@ static struct drm_display_mode *radeon_fp_native_mode(struct drm_encoder *encode
+           native_mode->vdisplay != 0 &&
+           native_mode->clock != 0) {
+               mode = drm_mode_duplicate(dev, native_mode);
++              if (!mode)
++                      return NULL;
+               mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER;
+               drm_mode_set_name(mode);
+@@ -487,6 +489,8 @@ static struct drm_display_mode *radeon_fp_native_mode(struct drm_encoder *encode
+                * simpler.
+                */
+               mode = drm_cvt_mode(dev, native_mode->hdisplay, native_mode->vdisplay, 60, true, false, false);
++              if (!mode)
++                      return NULL;
+               mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER;
+               DRM_DEBUG_KMS("Adding cvt approximation of native panel mode %s\n", mode->name);
+       }
+-- 
+2.35.1
+
diff --git a/queue-5.15/extcon-fix-extcon_get_extcon_dev-error-handling.patch b/queue-5.15/extcon-fix-extcon_get_extcon_dev-error-handling.patch
new file mode 100644 (file)
index 0000000..3ac8458
--- /dev/null
@@ -0,0 +1,230 @@
+From f10a9c97efe413f0dc08124584297396e0e0b475 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 17 Dec 2021 09:28:46 +0300
+Subject: extcon: Fix extcon_get_extcon_dev() error handling
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit 58e4a2d27d3255e4e8c507fdc13734dccc9fc4c7 ]
+
+The extcon_get_extcon_dev() function returns error pointers on error,
+NULL when it's a -EPROBE_DEFER defer situation, and ERR_PTR(-ENODEV)
+when the CONFIG_EXTCON option is disabled.  This is very complicated for
+the callers to handle and a number of them had bugs that would lead to
+an Oops.
+
+In real life, there are two things which prevented crashes.  First,
+error pointers would only be returned if there was bug in the caller
+where they passed a NULL "extcon_name" and none of them do that.
+Second, only two out of the eight drivers will build when CONFIG_EXTCON
+is disabled.
+
+The normal way to write this would be to return -EPROBE_DEFER directly
+when appropriate and return NULL when CONFIG_EXTCON is disabled.  Then
+the error handling is simple and just looks like:
+
+       dev->edev = extcon_get_extcon_dev(acpi_dev_name(adev));
+       if (IS_ERR(dev->edev))
+               return PTR_ERR(dev->edev);
+
+For the two drivers which can build with CONFIG_EXTCON disabled, then
+extcon_get_extcon_dev() will now return NULL which is not treated as an
+error and the probe will continue successfully.  Those two drivers are
+"typec_fusb302" and "max8997-battery".  In the original code, the
+typec_fusb302 driver had an 800ms hang in tcpm_get_current_limit() but
+now that function is a no-op.  For the max8997-battery driver everything
+should continue working as is.
+
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Reviewed-by: Guenter Roeck <linux@roeck-us.net>
+Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
+Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/extcon/extcon-axp288.c         |  4 ++--
+ drivers/extcon/extcon.c                |  4 +++-
+ drivers/power/supply/axp288_charger.c  | 17 ++++++++++-------
+ drivers/power/supply/charger-manager.c |  7 ++-----
+ drivers/power/supply/max8997_charger.c |  8 ++++----
+ drivers/usb/dwc3/drd.c                 |  9 ++-------
+ drivers/usb/phy/phy-omap-otg.c         |  4 ++--
+ drivers/usb/typec/tcpm/fusb302.c       |  4 ++--
+ include/linux/extcon.h                 |  2 +-
+ 9 files changed, 28 insertions(+), 31 deletions(-)
+
+diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
+index fdb31954cf2b..8073bc7d3e61 100644
+--- a/drivers/extcon/extcon-axp288.c
++++ b/drivers/extcon/extcon-axp288.c
+@@ -375,8 +375,8 @@ static int axp288_extcon_probe(struct platform_device *pdev)
+               if (adev) {
+                       info->id_extcon = extcon_get_extcon_dev(acpi_dev_name(adev));
+                       put_device(&adev->dev);
+-                      if (!info->id_extcon)
+-                              return -EPROBE_DEFER;
++                      if (IS_ERR(info->id_extcon))
++                              return PTR_ERR(info->id_extcon);
+                       dev_info(dev, "controlling USB role\n");
+               } else {
+diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
+index e7a9561a826d..9eb92997f3ae 100644
+--- a/drivers/extcon/extcon.c
++++ b/drivers/extcon/extcon.c
+@@ -863,6 +863,8 @@ EXPORT_SYMBOL_GPL(extcon_set_property_capability);
+  * @extcon_name:      the extcon name provided with extcon_dev_register()
+  *
+  * Return the pointer of extcon device if success or ERR_PTR(err) if fail.
++ * NOTE: This function returns -EPROBE_DEFER so it may only be called from
++ * probe() functions.
+  */
+ struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name)
+ {
+@@ -876,7 +878,7 @@ struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name)
+               if (!strcmp(sd->name, extcon_name))
+                       goto out;
+       }
+-      sd = NULL;
++      sd = ERR_PTR(-EPROBE_DEFER);
+ out:
+       mutex_unlock(&extcon_dev_list_lock);
+       return sd;
+diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c
+index fb9db7f43895..22378dad4d9f 100644
+--- a/drivers/power/supply/axp288_charger.c
++++ b/drivers/power/supply/axp288_charger.c
+@@ -832,17 +832,20 @@ static int axp288_charger_probe(struct platform_device *pdev)
+       info->regmap_irqc = axp20x->regmap_irqc;
+       info->cable.edev = extcon_get_extcon_dev(AXP288_EXTCON_DEV_NAME);
+-      if (info->cable.edev == NULL) {
+-              dev_dbg(dev, "%s is not ready, probe deferred\n",
+-                      AXP288_EXTCON_DEV_NAME);
+-              return -EPROBE_DEFER;
++      if (IS_ERR(info->cable.edev)) {
++              dev_err_probe(dev, PTR_ERR(info->cable.edev),
++                            "extcon_get_extcon_dev(%s) failed\n",
++                            AXP288_EXTCON_DEV_NAME);
++              return PTR_ERR(info->cable.edev);
+       }
+       if (acpi_dev_present(USB_HOST_EXTCON_HID, NULL, -1)) {
+               info->otg.cable = extcon_get_extcon_dev(USB_HOST_EXTCON_NAME);
+-              if (info->otg.cable == NULL) {
+-                      dev_dbg(dev, "EXTCON_USB_HOST is not ready, probe deferred\n");
+-                      return -EPROBE_DEFER;
++              if (IS_ERR(info->otg.cable)) {
++                      dev_err_probe(dev, PTR_ERR(info->otg.cable),
++                                    "extcon_get_extcon_dev(%s) failed\n",
++                                    USB_HOST_EXTCON_NAME);
++                      return PTR_ERR(info->otg.cable);
+               }
+               dev_info(dev, "Using " USB_HOST_EXTCON_HID " extcon for usb-id\n");
+       }
+diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c
+index d67edb760c94..92db79400a6a 100644
+--- a/drivers/power/supply/charger-manager.c
++++ b/drivers/power/supply/charger-manager.c
+@@ -985,13 +985,10 @@ static int charger_extcon_init(struct charger_manager *cm,
+       cable->nb.notifier_call = charger_extcon_notifier;
+       cable->extcon_dev = extcon_get_extcon_dev(cable->extcon_name);
+-      if (IS_ERR_OR_NULL(cable->extcon_dev)) {
++      if (IS_ERR(cable->extcon_dev)) {
+               pr_err("Cannot find extcon_dev for %s (cable: %s)\n",
+                       cable->extcon_name, cable->name);
+-              if (cable->extcon_dev == NULL)
+-                      return -EPROBE_DEFER;
+-              else
+-                      return PTR_ERR(cable->extcon_dev);
++              return PTR_ERR(cable->extcon_dev);
+       }
+       for (i = 0; i < ARRAY_SIZE(extcon_mapping); i++) {
+diff --git a/drivers/power/supply/max8997_charger.c b/drivers/power/supply/max8997_charger.c
+index 25207fe2aa68..bfa7a576523d 100644
+--- a/drivers/power/supply/max8997_charger.c
++++ b/drivers/power/supply/max8997_charger.c
+@@ -248,10 +248,10 @@ static int max8997_battery_probe(struct platform_device *pdev)
+               dev_info(&pdev->dev, "couldn't get charger regulator\n");
+       }
+       charger->edev = extcon_get_extcon_dev("max8997-muic");
+-      if (IS_ERR_OR_NULL(charger->edev)) {
+-              if (!charger->edev)
+-                      return -EPROBE_DEFER;
+-              dev_info(charger->dev, "couldn't get extcon device\n");
++      if (IS_ERR(charger->edev)) {
++              dev_err_probe(charger->dev, PTR_ERR(charger->edev),
++                            "couldn't get extcon device: max8997-muic\n");
++              return PTR_ERR(charger->edev);
+       }
+       if (!IS_ERR(charger->reg) && !IS_ERR_OR_NULL(charger->edev)) {
+diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
+index f148b0370f82..81ff21bd405a 100644
+--- a/drivers/usb/dwc3/drd.c
++++ b/drivers/usb/dwc3/drd.c
+@@ -454,13 +454,8 @@ static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc)
+        * This device property is for kernel internal use only and
+        * is expected to be set by the glue code.
+        */
+-      if (device_property_read_string(dev, "linux,extcon-name", &name) == 0) {
+-              edev = extcon_get_extcon_dev(name);
+-              if (!edev)
+-                      return ERR_PTR(-EPROBE_DEFER);
+-
+-              return edev;
+-      }
++      if (device_property_read_string(dev, "linux,extcon-name", &name) == 0)
++              return extcon_get_extcon_dev(name);
+       /*
+        * Try to get an extcon device from the USB PHY controller's "port"
+diff --git a/drivers/usb/phy/phy-omap-otg.c b/drivers/usb/phy/phy-omap-otg.c
+index ee0863c6553e..6e6ef8c0bc7e 100644
+--- a/drivers/usb/phy/phy-omap-otg.c
++++ b/drivers/usb/phy/phy-omap-otg.c
+@@ -95,8 +95,8 @@ static int omap_otg_probe(struct platform_device *pdev)
+               return -ENODEV;
+       extcon = extcon_get_extcon_dev(config->extcon);
+-      if (!extcon)
+-              return -EPROBE_DEFER;
++      if (IS_ERR(extcon))
++              return PTR_ERR(extcon);
+       otg_dev = devm_kzalloc(&pdev->dev, sizeof(*otg_dev), GFP_KERNEL);
+       if (!otg_dev)
+diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
+index 72f9001b0792..96c55eaf3f80 100644
+--- a/drivers/usb/typec/tcpm/fusb302.c
++++ b/drivers/usb/typec/tcpm/fusb302.c
+@@ -1708,8 +1708,8 @@ static int fusb302_probe(struct i2c_client *client,
+        */
+       if (device_property_read_string(dev, "linux,extcon-name", &name) == 0) {
+               chip->extcon = extcon_get_extcon_dev(name);
+-              if (!chip->extcon)
+-                      return -EPROBE_DEFER;
++              if (IS_ERR(chip->extcon))
++                      return PTR_ERR(chip->extcon);
+       }
+       chip->vbus = devm_regulator_get(chip->dev, "vbus");
+diff --git a/include/linux/extcon.h b/include/linux/extcon.h
+index 0c19010da77f..685401d94d39 100644
+--- a/include/linux/extcon.h
++++ b/include/linux/extcon.h
+@@ -296,7 +296,7 @@ static inline void devm_extcon_unregister_notifier_all(struct device *dev,
+ static inline struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name)
+ {
+-      return ERR_PTR(-ENODEV);
++      return NULL;
+ }
+ static inline struct extcon_dev *extcon_find_edev_by_node(struct device_node *node)
+-- 
+2.35.1
+
diff --git a/queue-5.15/extcon-modify-extcon-device-to-be-created-after-driv.patch b/queue-5.15/extcon-modify-extcon-device-to-be-created-after-driv.patch
new file mode 100644 (file)
index 0000000..430df1e
--- /dev/null
@@ -0,0 +1,100 @@
+From 624d9e6d6b675c74675220a381d1fd0d6bde9cb2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Apr 2022 12:00:05 +0900
+Subject: extcon: Modify extcon device to be created after driver data is set
+
+From: bumwoo lee <bw365.lee@samsung.com>
+
+[ Upstream commit 5dcc2afe716d69f5112ce035cb14f007461ff189 ]
+
+Currently, someone can invoke the sysfs such as state_show()
+intermittently before dev_set_drvdata() is done.
+And it can be a cause of kernel Oops because of edev is Null at that time.
+So modified the driver registration to after setting drviver data.
+
+- Oops's backtrace.
+
+Backtrace:
+[<c067865c>] (state_show) from [<c05222e8>] (dev_attr_show)
+[<c05222c0>] (dev_attr_show) from [<c02c66e0>] (sysfs_kf_seq_show)
+[<c02c6648>] (sysfs_kf_seq_show) from [<c02c496c>] (kernfs_seq_show)
+[<c02c4938>] (kernfs_seq_show) from [<c025e2a0>] (seq_read)
+[<c025e11c>] (seq_read) from [<c02c50a0>] (kernfs_fop_read)
+[<c02c5064>] (kernfs_fop_read) from [<c0231cac>] (__vfs_read)
+[<c0231c5c>] (__vfs_read) from [<c0231ee0>] (vfs_read)
+[<c0231e34>] (vfs_read) from [<c0232464>] (ksys_read)
+[<c02323f0>] (ksys_read) from [<c02324fc>] (sys_read)
+[<c02324e4>] (sys_read) from [<c00091d0>] (__sys_trace_return)
+
+Signed-off-by: bumwoo lee <bw365.lee@samsung.com>
+Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/extcon/extcon.c | 29 +++++++++++++++++------------
+ 1 file changed, 17 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
+index 9eb92997f3ae..f305503ec27e 100644
+--- a/drivers/extcon/extcon.c
++++ b/drivers/extcon/extcon.c
+@@ -1232,19 +1232,14 @@ int extcon_dev_register(struct extcon_dev *edev)
+               edev->dev.type = &edev->extcon_dev_type;
+       }
+-      ret = device_register(&edev->dev);
+-      if (ret) {
+-              put_device(&edev->dev);
+-              goto err_dev;
+-      }
+-
+       spin_lock_init(&edev->lock);
+-      edev->nh = devm_kcalloc(&edev->dev, edev->max_supported,
+-                              sizeof(*edev->nh), GFP_KERNEL);
+-      if (!edev->nh) {
+-              ret = -ENOMEM;
+-              device_unregister(&edev->dev);
+-              goto err_dev;
++      if (edev->max_supported) {
++              edev->nh = kcalloc(edev->max_supported, sizeof(*edev->nh),
++                              GFP_KERNEL);
++              if (!edev->nh) {
++                      ret = -ENOMEM;
++                      goto err_alloc_nh;
++              }
+       }
+       for (index = 0; index < edev->max_supported; index++)
+@@ -1255,6 +1250,12 @@ int extcon_dev_register(struct extcon_dev *edev)
+       dev_set_drvdata(&edev->dev, edev);
+       edev->state = 0;
++      ret = device_register(&edev->dev);
++      if (ret) {
++              put_device(&edev->dev);
++              goto err_dev;
++      }
++
+       mutex_lock(&extcon_dev_list_lock);
+       list_add(&edev->entry, &extcon_dev_list);
+       mutex_unlock(&extcon_dev_list_lock);
+@@ -1262,6 +1263,9 @@ int extcon_dev_register(struct extcon_dev *edev)
+       return 0;
+ err_dev:
++      if (edev->max_supported)
++              kfree(edev->nh);
++err_alloc_nh:
+       if (edev->max_supported)
+               kfree(edev->extcon_dev_type.groups);
+ err_alloc_groups:
+@@ -1322,6 +1326,7 @@ void extcon_dev_unregister(struct extcon_dev *edev)
+       if (edev->max_supported) {
+               kfree(edev->extcon_dev_type.groups);
+               kfree(edev->cables);
++              kfree(edev->nh);
+       }
+       put_device(&edev->dev);
+-- 
+2.35.1
+
diff --git a/queue-5.15/iio-dummy-iio_simple_dummy-check-the-return-value-of.patch b/queue-5.15/iio-dummy-iio_simple_dummy-check-the-return-value-of.patch
new file mode 100644 (file)
index 0000000..165ef68
--- /dev/null
@@ -0,0 +1,88 @@
+From 3cbb63c0d812a2051286cac8239b993aac6ad6d9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 5 Mar 2022 11:14:05 +0800
+Subject: iio: dummy: iio_simple_dummy: check the return value of kstrdup()
+
+From: Xiaoke Wang <xkernel.wang@foxmail.com>
+
+[ Upstream commit ba93642188a6fed754bf7447f638bc410e05a929 ]
+
+kstrdup() is also a memory allocation-related function, it returns NULL
+when some memory errors happen. So it is better to check the return
+value of it so to catch the memory error in time. Besides, there should
+have a kfree() to clear up the allocation if we get a failure later in
+this function to prevent memory leak.
+
+Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
+Link: https://lore.kernel.org/r/tencent_C920CFCC33B9CC1C63141FE1334A39FF8508@qq.com
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/iio/dummy/iio_simple_dummy.c | 20 ++++++++++++--------
+ 1 file changed, 12 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/iio/dummy/iio_simple_dummy.c b/drivers/iio/dummy/iio_simple_dummy.c
+index c0b7ef900735..c24f609c2ade 100644
+--- a/drivers/iio/dummy/iio_simple_dummy.c
++++ b/drivers/iio/dummy/iio_simple_dummy.c
+@@ -575,10 +575,9 @@ static struct iio_sw_device *iio_dummy_probe(const char *name)
+        */
+       swd = kzalloc(sizeof(*swd), GFP_KERNEL);
+-      if (!swd) {
+-              ret = -ENOMEM;
+-              goto error_kzalloc;
+-      }
++      if (!swd)
++              return ERR_PTR(-ENOMEM);
++
+       /*
+        * Allocate an IIO device.
+        *
+@@ -590,7 +589,7 @@ static struct iio_sw_device *iio_dummy_probe(const char *name)
+       indio_dev = iio_device_alloc(parent, sizeof(*st));
+       if (!indio_dev) {
+               ret = -ENOMEM;
+-              goto error_ret;
++              goto error_free_swd;
+       }
+       st = iio_priv(indio_dev);
+@@ -616,6 +615,10 @@ static struct iio_sw_device *iio_dummy_probe(const char *name)
+        *    indio_dev->name = spi_get_device_id(spi)->name;
+        */
+       indio_dev->name = kstrdup(name, GFP_KERNEL);
++      if (!indio_dev->name) {
++              ret = -ENOMEM;
++              goto error_free_device;
++      }
+       /* Provide description of available channels */
+       indio_dev->channels = iio_dummy_channels;
+@@ -632,7 +635,7 @@ static struct iio_sw_device *iio_dummy_probe(const char *name)
+       ret = iio_simple_dummy_events_register(indio_dev);
+       if (ret < 0)
+-              goto error_free_device;
++              goto error_free_name;
+       ret = iio_simple_dummy_configure_buffer(indio_dev);
+       if (ret < 0)
+@@ -649,11 +652,12 @@ static struct iio_sw_device *iio_dummy_probe(const char *name)
+       iio_simple_dummy_unconfigure_buffer(indio_dev);
+ error_unregister_events:
+       iio_simple_dummy_events_unregister(indio_dev);
++error_free_name:
++      kfree(indio_dev->name);
+ error_free_device:
+       iio_device_free(indio_dev);
+-error_ret:
++error_free_swd:
+       kfree(swd);
+-error_kzalloc:
+       return ERR_PTR(ret);
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/iio-st_sensors-add-a-local-lock-for-protecting-odr.patch b/queue-5.15/iio-st_sensors-add-a-local-lock-for-protecting-odr.patch
new file mode 100644 (file)
index 0000000..c0b25b4
--- /dev/null
@@ -0,0 +1,123 @@
+From cc6f40e955229da9c8e73b928227313f92fece2f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 7 Feb 2022 15:38:33 +0100
+Subject: iio: st_sensors: Add a local lock for protecting odr
+
+From: Miquel Raynal <miquel.raynal@bootlin.com>
+
+[ Upstream commit 474010127e2505fc463236470908e1ff5ddb3578 ]
+
+Right now the (framework) mlock lock is (ab)used for multiple purposes:
+1- protecting concurrent accesses over the odr local cache
+2- avoid changing samplig frequency whilst buffer is running
+
+Let's start by handling situation #1 with a local lock.
+
+Suggested-by: Jonathan Cameron <jic23@kernel.org>
+Cc: Denis Ciocca <denis.ciocca@st.com>
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/r/20220207143840.707510-7-miquel.raynal@bootlin.com
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../iio/common/st_sensors/st_sensors_core.c   | 24 ++++++++++++++-----
+ include/linux/iio/common/st_sensors.h         |  3 +++
+ 2 files changed, 21 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
+index 0bbb090b108c..aff981551617 100644
+--- a/drivers/iio/common/st_sensors/st_sensors_core.c
++++ b/drivers/iio/common/st_sensors/st_sensors_core.c
+@@ -71,16 +71,18 @@ static int st_sensors_match_odr(struct st_sensor_settings *sensor_settings,
+ int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr)
+ {
+-      int err;
++      int err = 0;
+       struct st_sensor_odr_avl odr_out = {0, 0};
+       struct st_sensor_data *sdata = iio_priv(indio_dev);
++      mutex_lock(&sdata->odr_lock);
++
+       if (!sdata->sensor_settings->odr.mask)
+-              return 0;
++              goto unlock_mutex;
+       err = st_sensors_match_odr(sdata->sensor_settings, odr, &odr_out);
+       if (err < 0)
+-              goto st_sensors_match_odr_error;
++              goto unlock_mutex;
+       if ((sdata->sensor_settings->odr.addr ==
+                                       sdata->sensor_settings->pw.addr) &&
+@@ -103,7 +105,9 @@ int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr)
+       if (err >= 0)
+               sdata->odr = odr_out.hz;
+-st_sensors_match_odr_error:
++unlock_mutex:
++      mutex_unlock(&sdata->odr_lock);
++
+       return err;
+ }
+ EXPORT_SYMBOL(st_sensors_set_odr);
+@@ -365,6 +369,8 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
+       struct st_sensors_platform_data *of_pdata;
+       int err = 0;
++      mutex_init(&sdata->odr_lock);
++
+       /* If OF/DT pdata exists, it will take precedence of anything else */
+       of_pdata = st_sensors_dev_probe(indio_dev->dev.parent, pdata);
+       if (IS_ERR(of_pdata))
+@@ -558,18 +564,24 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev,
+               err = -EBUSY;
+               goto out;
+       } else {
++              mutex_lock(&sdata->odr_lock);
+               err = st_sensors_set_enable(indio_dev, true);
+-              if (err < 0)
++              if (err < 0) {
++                      mutex_unlock(&sdata->odr_lock);
+                       goto out;
++              }
+               msleep((sdata->sensor_settings->bootime * 1000) / sdata->odr);
+               err = st_sensors_read_axis_data(indio_dev, ch, val);
+-              if (err < 0)
++              if (err < 0) {
++                      mutex_unlock(&sdata->odr_lock);
+                       goto out;
++              }
+               *val = *val >> ch->scan_type.shift;
+               err = st_sensors_set_enable(indio_dev, false);
++              mutex_unlock(&sdata->odr_lock);
+       }
+ out:
+       mutex_unlock(&indio_dev->mlock);
+diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
+index 8bdbaf3f3796..69f4a1f6b536 100644
+--- a/include/linux/iio/common/st_sensors.h
++++ b/include/linux/iio/common/st_sensors.h
+@@ -238,6 +238,7 @@ struct st_sensor_settings {
+  * @hw_irq_trigger: if we're using the hardware interrupt on the sensor.
+  * @hw_timestamp: Latest timestamp from the interrupt handler, when in use.
+  * @buffer_data: Data used by buffer part.
++ * @odr_lock: Local lock for preventing concurrent ODR accesses/changes
+  */
+ struct st_sensor_data {
+       struct device *dev;
+@@ -263,6 +264,8 @@ struct st_sensor_data {
+       s64 hw_timestamp;
+       char buffer_data[ST_SENSORS_MAX_BUFFER_SIZE] ____cacheline_aligned;
++
++      struct mutex odr_lock;
+ };
+ #ifdef CONFIG_IIO_BUFFER
+-- 
+2.35.1
+
diff --git a/queue-5.15/jump_label-noinstr-avoid-instrumentation-for-jump_la.patch b/queue-5.15/jump_label-noinstr-avoid-instrumentation-for-jump_la.patch
new file mode 100644 (file)
index 0000000..32ba63c
--- /dev/null
@@ -0,0 +1,44 @@
+From b2636ac1c8ac6539f8046c312308f7de5a11a93b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 2 May 2022 12:30:20 +0200
+Subject: jump_label,noinstr: Avoid instrumentation for JUMP_LABEL=n builds
+
+From: Peter Zijlstra <peterz@infradead.org>
+
+[ Upstream commit 656d054e0a15ec327bd82801ccd58201e59f6896 ]
+
+When building x86_64 with JUMP_LABEL=n it's possible for
+instrumentation to sneak into noinstr:
+
+vmlinux.o: warning: objtool: exit_to_user_mode+0x14: call to static_key_count.constprop.0() leaves .noinstr.text section
+vmlinux.o: warning: objtool: syscall_exit_to_user_mode+0x2d: call to static_key_count.constprop.0() leaves .noinstr.text section
+vmlinux.o: warning: objtool: irqentry_exit_to_user_mode+0x1b: call to static_key_count.constprop.0() leaves .noinstr.text section
+
+Switch to arch_ prefixed atomic to avoid the explicit instrumentation.
+
+Reported-by: kernel test robot <lkp@intel.com>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/jump_label.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
+index 48b9b2a82767..019e55c13248 100644
+--- a/include/linux/jump_label.h
++++ b/include/linux/jump_label.h
+@@ -261,9 +261,9 @@ extern void static_key_disable_cpuslocked(struct static_key *key);
+ #include <linux/atomic.h>
+ #include <linux/bug.h>
+-static inline int static_key_count(struct static_key *key)
++static __always_inline int static_key_count(struct static_key *key)
+ {
+-      return atomic_read(&key->enabled);
++      return arch_atomic_read(&key->enabled);
+ }
+ static __always_inline void jump_label_init(void)
+-- 
+2.35.1
+
diff --git a/queue-5.15/kernfs-separate-kernfs_pr_cont_buf-and-rename_lock.patch b/queue-5.15/kernfs-separate-kernfs_pr_cont_buf-and-rename_lock.patch
new file mode 100644 (file)
index 0000000..9f1443a
--- /dev/null
@@ -0,0 +1,142 @@
+From 1ddf8c4972c624dafa6c009714c2aae56f97236a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 16 May 2022 12:09:51 -0700
+Subject: kernfs: Separate kernfs_pr_cont_buf and rename_lock.
+
+From: Hao Luo <haoluo@google.com>
+
+[ Upstream commit 1a702dc88e150487c9c173a249b3d236498b9183 ]
+
+Previously the protection of kernfs_pr_cont_buf was piggy backed by
+rename_lock, which means that pr_cont() needs to be protected under
+rename_lock. This can cause potential circular lock dependencies.
+
+If there is an OOM, we have the following call hierarchy:
+
+ -> cpuset_print_current_mems_allowed()
+   -> pr_cont_cgroup_name()
+     -> pr_cont_kernfs_name()
+
+pr_cont_kernfs_name() will grab rename_lock and call printk. So we have
+the following lock dependencies:
+
+ kernfs_rename_lock -> console_sem
+
+Sometimes, printk does a wakeup before releasing console_sem, which has
+the dependence chain:
+
+ console_sem -> p->pi_lock -> rq->lock
+
+Now, imagine one wants to read cgroup_name under rq->lock, for example,
+printing cgroup_name in a tracepoint in the scheduler code. They will
+be holding rq->lock and take rename_lock:
+
+ rq->lock -> kernfs_rename_lock
+
+Now they will deadlock.
+
+A prevention to this circular lock dependency is to separate the
+protection of pr_cont_buf from rename_lock. In principle, rename_lock
+is to protect the integrity of cgroup name when copying to buf. Once
+pr_cont_buf has got its content, rename_lock can be dropped. So it's
+safe to drop rename_lock after kernfs_name_locked (and
+kernfs_path_from_node_locked) and rely on a dedicated pr_cont_lock
+to protect pr_cont_buf.
+
+Acked-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Hao Luo <haoluo@google.com>
+Link: https://lore.kernel.org/r/20220516190951.3144144-1-haoluo@google.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/kernfs/dir.c | 31 +++++++++++++++++++------------
+ 1 file changed, 19 insertions(+), 12 deletions(-)
+
+diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
+index 8e0a1378a4b1..7bf1d5fc2e9c 100644
+--- a/fs/kernfs/dir.c
++++ b/fs/kernfs/dir.c
+@@ -19,7 +19,15 @@
+ DECLARE_RWSEM(kernfs_rwsem);
+ static DEFINE_SPINLOCK(kernfs_rename_lock);   /* kn->parent and ->name */
+-static char kernfs_pr_cont_buf[PATH_MAX];     /* protected by rename_lock */
++/*
++ * Don't use rename_lock to piggy back on pr_cont_buf. We don't want to
++ * call pr_cont() while holding rename_lock. Because sometimes pr_cont()
++ * will perform wakeups when releasing console_sem. Holding rename_lock
++ * will introduce deadlock if the scheduler reads the kernfs_name in the
++ * wakeup path.
++ */
++static DEFINE_SPINLOCK(kernfs_pr_cont_lock);
++static char kernfs_pr_cont_buf[PATH_MAX];     /* protected by pr_cont_lock */
+ static DEFINE_SPINLOCK(kernfs_idr_lock);      /* root->ino_idr */
+ #define rb_to_kn(X) rb_entry((X), struct kernfs_node, rb)
+@@ -230,12 +238,12 @@ void pr_cont_kernfs_name(struct kernfs_node *kn)
+ {
+       unsigned long flags;
+-      spin_lock_irqsave(&kernfs_rename_lock, flags);
++      spin_lock_irqsave(&kernfs_pr_cont_lock, flags);
+-      kernfs_name_locked(kn, kernfs_pr_cont_buf, sizeof(kernfs_pr_cont_buf));
++      kernfs_name(kn, kernfs_pr_cont_buf, sizeof(kernfs_pr_cont_buf));
+       pr_cont("%s", kernfs_pr_cont_buf);
+-      spin_unlock_irqrestore(&kernfs_rename_lock, flags);
++      spin_unlock_irqrestore(&kernfs_pr_cont_lock, flags);
+ }
+ /**
+@@ -249,10 +257,10 @@ void pr_cont_kernfs_path(struct kernfs_node *kn)
+       unsigned long flags;
+       int sz;
+-      spin_lock_irqsave(&kernfs_rename_lock, flags);
++      spin_lock_irqsave(&kernfs_pr_cont_lock, flags);
+-      sz = kernfs_path_from_node_locked(kn, NULL, kernfs_pr_cont_buf,
+-                                        sizeof(kernfs_pr_cont_buf));
++      sz = kernfs_path_from_node(kn, NULL, kernfs_pr_cont_buf,
++                                 sizeof(kernfs_pr_cont_buf));
+       if (sz < 0) {
+               pr_cont("(error)");
+               goto out;
+@@ -266,7 +274,7 @@ void pr_cont_kernfs_path(struct kernfs_node *kn)
+       pr_cont("%s", kernfs_pr_cont_buf);
+ out:
+-      spin_unlock_irqrestore(&kernfs_rename_lock, flags);
++      spin_unlock_irqrestore(&kernfs_pr_cont_lock, flags);
+ }
+ /**
+@@ -822,13 +830,12 @@ static struct kernfs_node *kernfs_walk_ns(struct kernfs_node *parent,
+       lockdep_assert_held_read(&kernfs_rwsem);
+-      /* grab kernfs_rename_lock to piggy back on kernfs_pr_cont_buf */
+-      spin_lock_irq(&kernfs_rename_lock);
++      spin_lock_irq(&kernfs_pr_cont_lock);
+       len = strlcpy(kernfs_pr_cont_buf, path, sizeof(kernfs_pr_cont_buf));
+       if (len >= sizeof(kernfs_pr_cont_buf)) {
+-              spin_unlock_irq(&kernfs_rename_lock);
++              spin_unlock_irq(&kernfs_pr_cont_lock);
+               return NULL;
+       }
+@@ -840,7 +847,7 @@ static struct kernfs_node *kernfs_walk_ns(struct kernfs_node *parent,
+               parent = kernfs_find_ns(parent, name, ns);
+       }
+-      spin_unlock_irq(&kernfs_rename_lock);
++      spin_unlock_irq(&kernfs_pr_cont_lock);
+       return parent;
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/lkdtm-usercopy-expand-size-of-out-of-frame-object.patch b/queue-5.15/lkdtm-usercopy-expand-size-of-out-of-frame-object.patch
new file mode 100644 (file)
index 0000000..b416527
--- /dev/null
@@ -0,0 +1,75 @@
+From 07bf30878abbe5b85f1973b6a6cb21b4cc1b0184 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 16 Feb 2022 12:15:03 -0800
+Subject: lkdtm/usercopy: Expand size of "out of frame" object
+
+From: Kees Cook <keescook@chromium.org>
+
+[ Upstream commit f387e86d3a74407bdd9c5815820ac9d060962840 ]
+
+To be sufficiently out of range for the usercopy test to see the lifetime
+mismatch, expand the size of the "bad" buffer, which will let it be
+beyond current_stack_pointer regardless of stack growth direction.
+Paired with the recent addition of stack depth checking under
+CONFIG_HARDENED_USERCOPY=y, this will correctly start tripping again.
+
+Reported-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
+Cc: Arnd Bergmann <arnd@arndb.de>
+Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
+Link: https://lore.kernel.org/lkml/762faf1b-0443-5ddf-4430-44a20cf2ec4d@collabora.com/
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/misc/lkdtm/usercopy.c | 17 ++++++++++++++---
+ 1 file changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/misc/lkdtm/usercopy.c b/drivers/misc/lkdtm/usercopy.c
+index 9161ce7ed47a..3fead5efe523 100644
+--- a/drivers/misc/lkdtm/usercopy.c
++++ b/drivers/misc/lkdtm/usercopy.c
+@@ -30,12 +30,12 @@ static const unsigned char test_text[] = "This is a test.\n";
+  */
+ static noinline unsigned char *trick_compiler(unsigned char *stack)
+ {
+-      return stack + 0;
++      return stack + unconst;
+ }
+ static noinline unsigned char *do_usercopy_stack_callee(int value)
+ {
+-      unsigned char buf[32];
++      unsigned char buf[128];
+       int i;
+       /* Exercise stack to avoid everything living in registers. */
+@@ -43,7 +43,12 @@ static noinline unsigned char *do_usercopy_stack_callee(int value)
+               buf[i] = value & 0xff;
+       }
+-      return trick_compiler(buf);
++      /*
++       * Put the target buffer in the middle of stack allocation
++       * so that we don't step on future stack users regardless
++       * of stack growth direction.
++       */
++      return trick_compiler(&buf[(128/2)-32]);
+ }
+ static noinline void do_usercopy_stack(bool to_user, bool bad_frame)
+@@ -66,6 +71,12 @@ static noinline void do_usercopy_stack(bool to_user, bool bad_frame)
+               bad_stack -= sizeof(unsigned long);
+       }
++#ifdef ARCH_HAS_CURRENT_STACK_POINTER
++      pr_info("stack     : %px\n", (void *)current_stack_pointer);
++#endif
++      pr_info("good_stack: %px-%px\n", good_stack, good_stack + sizeof(good_stack));
++      pr_info("bad_stack : %px-%px\n", bad_stack, bad_stack + sizeof(good_stack));
++
+       user_addr = vm_mmap(NULL, 0, PAGE_SIZE,
+                           PROT_READ | PROT_WRITE | PROT_EXEC,
+                           MAP_ANONYMOUS | MAP_PRIVATE, 0);
+-- 
+2.35.1
+
diff --git a/queue-5.15/md-protect-md_unregister_thread-from-reentrancy.patch b/queue-5.15/md-protect-md_unregister_thread-from-reentrancy.patch
new file mode 100644 (file)
index 0000000..71fabd5
--- /dev/null
@@ -0,0 +1,63 @@
+From 5753559fd7524403ef602d0f7d0fe6bb35925fea Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 29 Apr 2022 16:49:09 +0800
+Subject: md: protect md_unregister_thread from reentrancy
+
+From: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
+
+[ Upstream commit 1e267742283a4b5a8ca65755c44166be27e9aa0f ]
+
+Generally, the md_unregister_thread is called with reconfig_mutex, but
+raid_message in dm-raid doesn't hold reconfig_mutex to unregister thread,
+so md_unregister_thread can be called simulitaneously from two call sites
+in theory.
+
+Then after previous commit which remove the protection of reconfig_mutex
+for md_unregister_thread completely, the potential issue could be worse
+than before.
+
+Let's take pers_lock at the beginning of function to ensure reentrancy.
+
+Reported-by: Donald Buczek <buczek@molgen.mpg.de>
+Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
+Signed-off-by: Song Liu <song@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/md/md.c | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/md/md.c b/drivers/md/md.c
+index b553654cbebc..bf1c5c0e472e 100644
+--- a/drivers/md/md.c
++++ b/drivers/md/md.c
+@@ -7942,17 +7942,22 @@ EXPORT_SYMBOL(md_register_thread);
+ void md_unregister_thread(struct md_thread **threadp)
+ {
+-      struct md_thread *thread = *threadp;
+-      if (!thread)
+-              return;
+-      pr_debug("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk));
+-      /* Locking ensures that mddev_unlock does not wake_up a
++      struct md_thread *thread;
++
++      /*
++       * Locking ensures that mddev_unlock does not wake_up a
+        * non-existent thread
+        */
+       spin_lock(&pers_lock);
++      thread = *threadp;
++      if (!thread) {
++              spin_unlock(&pers_lock);
++              return;
++      }
+       *threadp = NULL;
+       spin_unlock(&pers_lock);
++      pr_debug("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk));
+       kthread_stop(thread->tsk);
+       kfree(thread);
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/misc-rtsx-set-null-intfdata-when-probe-fails.patch b/queue-5.15/misc-rtsx-set-null-intfdata-when-probe-fails.patch
new file mode 100644 (file)
index 0000000..5deac98
--- /dev/null
@@ -0,0 +1,39 @@
+From 5e722ae9e8d8a50bcf8bd5011b0c5bdabdfde9b5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 29 Apr 2022 15:09:13 -0600
+Subject: misc: rtsx: set NULL intfdata when probe fails
+
+From: Shuah Khan <skhan@linuxfoundation.org>
+
+[ Upstream commit f861d36e021e1ac4a0a2a1f6411d623809975d63 ]
+
+rtsx_usb_probe() doesn't call usb_set_intfdata() to null out the
+interface pointer when probe fails. This leaves a stale pointer.
+Noticed the missing usb_set_intfdata() while debugging an unrelated
+invalid DMA mapping problem.
+
+Fix it with a call to usb_set_intfdata(..., NULL).
+
+Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
+Link: https://lore.kernel.org/r/20220429210913.46804-1-skhan@linuxfoundation.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/misc/cardreader/rtsx_usb.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/misc/cardreader/rtsx_usb.c b/drivers/misc/cardreader/rtsx_usb.c
+index 59eda55d92a3..1ef9b61077c4 100644
+--- a/drivers/misc/cardreader/rtsx_usb.c
++++ b/drivers/misc/cardreader/rtsx_usb.c
+@@ -667,6 +667,7 @@ static int rtsx_usb_probe(struct usb_interface *intf,
+       return 0;
+ out_init_fail:
++      usb_set_intfdata(ucr->pusb_intf, NULL);
+       usb_free_coherent(ucr->pusb_dev, IOBUF_SIZE, ucr->iobuf,
+                       ucr->iobuf_dma);
+       return ret;
+-- 
+2.35.1
+
diff --git a/queue-5.15/modpost-fix-undefined-behavior-of-is_arm_mapping_sym.patch b/queue-5.15/modpost-fix-undefined-behavior-of-is_arm_mapping_sym.patch
new file mode 100644 (file)
index 0000000..2ec8ba6
--- /dev/null
@@ -0,0 +1,63 @@
+From 55c12a0cb34077f046ad3569653a1e1f4f68db7d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 24 May 2022 01:46:22 +0900
+Subject: modpost: fix undefined behavior of is_arm_mapping_symbol()
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+[ Upstream commit d6b732666a1bae0df3c3ae06925043bba34502b1 ]
+
+The return value of is_arm_mapping_symbol() is unpredictable when "$"
+is passed in.
+
+strchr(3) says:
+  The strchr() and strrchr() functions return a pointer to the matched
+  character or NULL if the character is not found. The terminating null
+  byte is considered part of the string, so that if c is specified as
+  '\0', these functions return a pointer to the terminator.
+
+When str[1] is '\0', strchr("axtd", str[1]) is not NULL, and str[2] is
+referenced (i.e. buffer overrun).
+
+Test code
+---------
+
+  char str1[] = "abc";
+  char str2[] = "ab";
+
+  strcpy(str1, "$");
+  strcpy(str2, "$");
+
+  printf("test1: %d\n", is_arm_mapping_symbol(str1));
+  printf("test2: %d\n", is_arm_mapping_symbol(str2));
+
+Result
+------
+
+  test1: 0
+  test2: 1
+
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ scripts/mod/modpost.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
+index 7a5bddb8913e..94041ee32798 100644
+--- a/scripts/mod/modpost.c
++++ b/scripts/mod/modpost.c
+@@ -1260,7 +1260,8 @@ static int secref_whitelist(const struct sectioncheck *mismatch,
+ static inline int is_arm_mapping_symbol(const char *str)
+ {
+-      return str[0] == '$' && strchr("axtd", str[1])
++      return str[0] == '$' &&
++             (str[1] == 'a' || str[1] == 'd' || str[1] == 't' || str[1] == 'x')
+              && (str[2] == '\0' || str[2] == '.');
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/nbd-call-genl_unregister_family-first-in-nbd_cleanup.patch b/queue-5.15/nbd-call-genl_unregister_family-first-in-nbd_cleanup.patch
new file mode 100644 (file)
index 0000000..2dff04e
--- /dev/null
@@ -0,0 +1,74 @@
+From a593e1a95608459b0eabdf826639299cea24bc67 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 21 May 2022 15:37:44 +0800
+Subject: nbd: call genl_unregister_family() first in nbd_cleanup()
+
+From: Yu Kuai <yukuai3@huawei.com>
+
+[ Upstream commit 06c4da89c24e7023ea448cadf8e9daf06a0aae6e ]
+
+Otherwise there may be race between module removal and the handling of
+netlink command, which can lead to the oops as shown below:
+
+  BUG: kernel NULL pointer dereference, address: 0000000000000098
+  Oops: 0002 [#1] SMP PTI
+  CPU: 1 PID: 31299 Comm: nbd-client Tainted: G            E     5.14.0-rc4
+  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
+  RIP: 0010:down_write+0x1a/0x50
+  Call Trace:
+   start_creating+0x89/0x130
+   debugfs_create_dir+0x1b/0x130
+   nbd_start_device+0x13d/0x390 [nbd]
+   nbd_genl_connect+0x42f/0x748 [nbd]
+   genl_family_rcv_msg_doit.isra.0+0xec/0x150
+   genl_rcv_msg+0xe5/0x1e0
+   netlink_rcv_skb+0x55/0x100
+   genl_rcv+0x29/0x40
+   netlink_unicast+0x1a8/0x250
+   netlink_sendmsg+0x21b/0x430
+   ____sys_sendmsg+0x2a4/0x2d0
+   ___sys_sendmsg+0x81/0xc0
+   __sys_sendmsg+0x62/0xb0
+   __x64_sys_sendmsg+0x1f/0x30
+   do_syscall_64+0x3b/0xc0
+   entry_SYSCALL_64_after_hwframe+0x44/0xae
+  Modules linked in: nbd(E-)
+
+Signed-off-by: Hou Tao <houtao1@huawei.com>
+Signed-off-by: Yu Kuai <yukuai3@huawei.com>
+Reviewed-by: Josef Bacik <josef@toxicpanda.com>
+Link: https://lore.kernel.org/r/20220521073749.3146892-2-yukuai3@huawei.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/block/nbd.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
+index 8704212482e5..4be8ae20d1da 100644
+--- a/drivers/block/nbd.c
++++ b/drivers/block/nbd.c
+@@ -2478,6 +2478,12 @@ static void __exit nbd_cleanup(void)
+       struct nbd_device *nbd;
+       LIST_HEAD(del_list);
++      /*
++       * Unregister netlink interface prior to waiting
++       * for the completion of netlink commands.
++       */
++      genl_unregister_family(&nbd_genl_family);
++
+       nbd_dbg_close();
+       mutex_lock(&nbd_index_mutex);
+@@ -2496,7 +2502,6 @@ static void __exit nbd_cleanup(void)
+       destroy_workqueue(nbd_del_wq);
+       idr_destroy(&nbd_index_idr);
+-      genl_unregister_family(&nbd_genl_family);
+       unregister_blkdev(NBD_MAJOR, "nbd");
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/nbd-fix-io-hung-while-disconnecting-device.patch b/queue-5.15/nbd-fix-io-hung-while-disconnecting-device.patch
new file mode 100644 (file)
index 0000000..9e2991e
--- /dev/null
@@ -0,0 +1,78 @@
+From 71aca0629a974f284b8f0e77315b2b150bf52db9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 21 May 2022 15:37:47 +0800
+Subject: nbd: fix io hung while disconnecting device
+
+From: Yu Kuai <yukuai3@huawei.com>
+
+[ Upstream commit 09dadb5985023e27d4740ebd17e6fea4640110e5 ]
+
+In our tests, "qemu-nbd" triggers a io hung:
+
+INFO: task qemu-nbd:11445 blocked for more than 368 seconds.
+      Not tainted 5.18.0-rc3-next-20220422-00003-g2176915513ca #884
+"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
+task:qemu-nbd        state:D stack:    0 pid:11445 ppid:     1 flags:0x00000000
+Call Trace:
+ <TASK>
+ __schedule+0x480/0x1050
+ ? _raw_spin_lock_irqsave+0x3e/0xb0
+ schedule+0x9c/0x1b0
+ blk_mq_freeze_queue_wait+0x9d/0xf0
+ ? ipi_rseq+0x70/0x70
+ blk_mq_freeze_queue+0x2b/0x40
+ nbd_add_socket+0x6b/0x270 [nbd]
+ nbd_ioctl+0x383/0x510 [nbd]
+ blkdev_ioctl+0x18e/0x3e0
+ __x64_sys_ioctl+0xac/0x120
+ do_syscall_64+0x35/0x80
+ entry_SYSCALL_64_after_hwframe+0x44/0xae
+RIP: 0033:0x7fd8ff706577
+RSP: 002b:00007fd8fcdfebf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
+RAX: ffffffffffffffda RBX: 0000000040000000 RCX: 00007fd8ff706577
+RDX: 000000000000000d RSI: 000000000000ab00 RDI: 000000000000000f
+RBP: 000000000000000f R08: 000000000000fbe8 R09: 000055fe497c62b0
+R10: 00000002aff20000 R11: 0000000000000246 R12: 000000000000006d
+R13: 0000000000000000 R14: 00007ffe82dc5e70 R15: 00007fd8fcdff9c0
+
+"qemu-ndb -d" will call ioctl 'NBD_DISCONNECT' first, however, following
+message was found:
+
+block nbd0: Send disconnect failed -32
+
+Which indicate that something is wrong with the server. Then,
+"qemu-nbd -d" will call ioctl 'NBD_CLEAR_SOCK', however ioctl can't clear
+requests after commit 2516ab1543fd("nbd: only clear the queue on device
+teardown"). And in the meantime, request can't complete through timeout
+because nbd_xmit_timeout() will always return 'BLK_EH_RESET_TIMER', which
+means such request will never be completed in this situation.
+
+Now that the flag 'NBD_CMD_INFLIGHT' can make sure requests won't
+complete multiple times, switch back to call nbd_clear_sock() in
+nbd_clear_sock_ioctl(), so that inflight requests can be cleared.
+
+Signed-off-by: Yu Kuai <yukuai3@huawei.com>
+Reviewed-by: Josef Bacik <josef@toxicpanda.com>
+Link: https://lore.kernel.org/r/20220521073749.3146892-5-yukuai3@huawei.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/block/nbd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
+index b31eb9c7f239..b391ca062add 100644
+--- a/drivers/block/nbd.c
++++ b/drivers/block/nbd.c
+@@ -1368,7 +1368,7 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd, struct block_device *b
+ static void nbd_clear_sock_ioctl(struct nbd_device *nbd,
+                                struct block_device *bdev)
+ {
+-      sock_shutdown(nbd);
++      nbd_clear_sock(nbd);
+       __invalidate_device(bdev, true);
+       nbd_bdev_reset(bdev);
+       if (test_and_clear_bit(NBD_RT_HAS_CONFIG_REF,
+-- 
+2.35.1
+
diff --git a/queue-5.15/nbd-fix-race-between-nbd_alloc_config-and-module-rem.patch b/queue-5.15/nbd-fix-race-between-nbd_alloc_config-and-module-rem.patch
new file mode 100644 (file)
index 0000000..d072f72
--- /dev/null
@@ -0,0 +1,124 @@
+From 9f52911d38edf24f21d8d99159c0cb8bbeee5641 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 21 May 2022 15:37:45 +0800
+Subject: nbd: fix race between nbd_alloc_config() and module removal
+
+From: Yu Kuai <yukuai3@huawei.com>
+
+[ Upstream commit c55b2b983b0fa012942c3eb16384b2b722caa810 ]
+
+When nbd module is being removing, nbd_alloc_config() may be
+called concurrently by nbd_genl_connect(), although try_module_get()
+will return false, but nbd_alloc_config() doesn't handle it.
+
+The race may lead to the leak of nbd_config and its related
+resources (e.g, recv_workq) and oops in nbd_read_stat() due
+to the unload of nbd module as shown below:
+
+  BUG: kernel NULL pointer dereference, address: 0000000000000040
+  Oops: 0000 [#1] SMP PTI
+  CPU: 5 PID: 13840 Comm: kworker/u17:33 Not tainted 5.14.0+ #1
+  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
+  Workqueue: knbd16-recv recv_work [nbd]
+  RIP: 0010:nbd_read_stat.cold+0x130/0x1a4 [nbd]
+  Call Trace:
+   recv_work+0x3b/0xb0 [nbd]
+   process_one_work+0x1ed/0x390
+   worker_thread+0x4a/0x3d0
+   kthread+0x12a/0x150
+   ret_from_fork+0x22/0x30
+
+Fixing it by checking the return value of try_module_get()
+in nbd_alloc_config(). As nbd_alloc_config() may return ERR_PTR(-ENODEV),
+assign nbd->config only when nbd_alloc_config() succeeds to ensure
+the value of nbd->config is binary (valid or NULL).
+
+Also adding a debug message to check the reference counter
+of nbd_config during module removal.
+
+Signed-off-by: Hou Tao <houtao1@huawei.com>
+Signed-off-by: Yu Kuai <yukuai3@huawei.com>
+Reviewed-by: Josef Bacik <josef@toxicpanda.com>
+Link: https://lore.kernel.org/r/20220521073749.3146892-3-yukuai3@huawei.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/block/nbd.c | 28 +++++++++++++++++++---------
+ 1 file changed, 19 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
+index 4be8ae20d1da..b31eb9c7f239 100644
+--- a/drivers/block/nbd.c
++++ b/drivers/block/nbd.c
+@@ -1467,15 +1467,20 @@ static struct nbd_config *nbd_alloc_config(void)
+ {
+       struct nbd_config *config;
++      if (!try_module_get(THIS_MODULE))
++              return ERR_PTR(-ENODEV);
++
+       config = kzalloc(sizeof(struct nbd_config), GFP_NOFS);
+-      if (!config)
+-              return NULL;
++      if (!config) {
++              module_put(THIS_MODULE);
++              return ERR_PTR(-ENOMEM);
++      }
++
+       atomic_set(&config->recv_threads, 0);
+       init_waitqueue_head(&config->recv_wq);
+       init_waitqueue_head(&config->conn_wait);
+       config->blksize_bits = NBD_DEF_BLKSIZE_BITS;
+       atomic_set(&config->live_connections, 0);
+-      try_module_get(THIS_MODULE);
+       return config;
+ }
+@@ -1502,12 +1507,13 @@ static int nbd_open(struct block_device *bdev, fmode_t mode)
+                       mutex_unlock(&nbd->config_lock);
+                       goto out;
+               }
+-              config = nbd->config = nbd_alloc_config();
+-              if (!config) {
+-                      ret = -ENOMEM;
++              config = nbd_alloc_config();
++              if (IS_ERR(config)) {
++                      ret = PTR_ERR(config);
+                       mutex_unlock(&nbd->config_lock);
+                       goto out;
+               }
++              nbd->config = config;
+               refcount_set(&nbd->config_refs, 1);
+               refcount_inc(&nbd->refs);
+               mutex_unlock(&nbd->config_lock);
+@@ -1914,13 +1920,14 @@ static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info)
+               nbd_put(nbd);
+               return -EINVAL;
+       }
+-      config = nbd->config = nbd_alloc_config();
+-      if (!nbd->config) {
++      config = nbd_alloc_config();
++      if (IS_ERR(config)) {
+               mutex_unlock(&nbd->config_lock);
+               nbd_put(nbd);
+               printk(KERN_ERR "nbd: couldn't allocate config\n");
+-              return -ENOMEM;
++              return PTR_ERR(config);
+       }
++      nbd->config = config;
+       refcount_set(&nbd->config_refs, 1);
+       set_bit(NBD_RT_BOUND, &config->runtime_flags);
+@@ -2493,6 +2500,9 @@ static void __exit nbd_cleanup(void)
+       while (!list_empty(&del_list)) {
+               nbd = list_first_entry(&del_list, struct nbd_device, list);
+               list_del_init(&nbd->list);
++              if (refcount_read(&nbd->config_refs))
++                      printk(KERN_ERR "nbd: possibly leaking nbd_config (ref %d)\n",
++                                      refcount_read(&nbd->config_refs));
+               if (refcount_read(&nbd->refs) != 1)
+                       printk(KERN_ERR "nbd: possibly leaking a device\n");
+               nbd_put(nbd);
+-- 
+2.35.1
+
diff --git a/queue-5.15/nodemask-fix-return-values-to-be-unsigned.patch b/queue-5.15/nodemask-fix-return-values-to-be-unsigned.patch
new file mode 100644 (file)
index 0000000..efa10c0
--- /dev/null
@@ -0,0 +1,189 @@
+From 241e248f2cf0ccb5e0f48577495cf2f82d79f85d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 18 May 2022 13:52:23 -0700
+Subject: nodemask: Fix return values to be unsigned
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Kees Cook <keescook@chromium.org>
+
+[ Upstream commit 0dfe54071d7c828a02917b595456bfde1afdddc9 ]
+
+The nodemask routines had mixed return values that provided potentially
+signed return values that could never happen. This was leading to the
+compiler getting confusing about the range of possible return values
+(it was thinking things could be negative where they could not be). Fix
+all the nodemask routines that should be returning unsigned
+(or bool) values. Silences:
+
+ mm/swapfile.c: In function â€˜setup_swap_info’:
+ mm/swapfile.c:2291:47: error: array subscript -1 is below array bounds of â€˜struct plist_node[]’ [-Werror=array-bounds]
+  2291 |                                 p->avail_lists[i].prio = 1;
+       |                                 ~~~~~~~~~~~~~~^~~
+ In file included from mm/swapfile.c:16:
+ ./include/linux/swap.h:292:27: note: while referencing â€˜avail_lists’
+   292 |         struct plist_node avail_lists[]; /*
+       |                           ^~~~~~~~~~~
+
+Reported-by: Christophe de Dinechin <dinechin@redhat.com>
+Link: https://lore.kernel.org/lkml/20220414150855.2407137-3-dinechin@redhat.com/
+Cc: Alexey Dobriyan <adobriyan@gmail.com>
+Cc: Yury Norov <yury.norov@gmail.com>
+Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Cc: Zhen Lei <thunder.leizhen@huawei.com>
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Signed-off-by: Yury Norov <yury.norov@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/nodemask.h | 38 +++++++++++++++++++-------------------
+ lib/nodemask.c           |  4 ++--
+ 2 files changed, 21 insertions(+), 21 deletions(-)
+
+diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
+index c6199dbe2591..0f233b76c9ce 100644
+--- a/include/linux/nodemask.h
++++ b/include/linux/nodemask.h
+@@ -42,11 +42,11 @@
+  * void nodes_shift_right(dst, src, n)        Shift right
+  * void nodes_shift_left(dst, src, n) Shift left
+  *
+- * int first_node(mask)                       Number lowest set bit, or MAX_NUMNODES
+- * int next_node(node, mask)          Next node past 'node', or MAX_NUMNODES
+- * int next_node_in(node, mask)               Next node past 'node', or wrap to first,
++ * unsigned int first_node(mask)      Number lowest set bit, or MAX_NUMNODES
++ * unsigend int next_node(node, mask) Next node past 'node', or MAX_NUMNODES
++ * unsigned int next_node_in(node, mask) Next node past 'node', or wrap to first,
+  *                                    or MAX_NUMNODES
+- * int first_unset_node(mask)         First node not set in mask, or 
++ * unsigned int first_unset_node(mask)        First node not set in mask, or
+  *                                    MAX_NUMNODES
+  *
+  * nodemask_t nodemask_of_node(node)  Return nodemask with bit 'node' set
+@@ -153,7 +153,7 @@ static inline void __nodes_clear(nodemask_t *dstp, unsigned int nbits)
+ #define node_test_and_set(node, nodemask) \
+                       __node_test_and_set((node), &(nodemask))
+-static inline int __node_test_and_set(int node, nodemask_t *addr)
++static inline bool __node_test_and_set(int node, nodemask_t *addr)
+ {
+       return test_and_set_bit(node, addr->bits);
+ }
+@@ -200,7 +200,7 @@ static inline void __nodes_complement(nodemask_t *dstp,
+ #define nodes_equal(src1, src2) \
+                       __nodes_equal(&(src1), &(src2), MAX_NUMNODES)
+-static inline int __nodes_equal(const nodemask_t *src1p,
++static inline bool __nodes_equal(const nodemask_t *src1p,
+                                       const nodemask_t *src2p, unsigned int nbits)
+ {
+       return bitmap_equal(src1p->bits, src2p->bits, nbits);
+@@ -208,7 +208,7 @@ static inline int __nodes_equal(const nodemask_t *src1p,
+ #define nodes_intersects(src1, src2) \
+                       __nodes_intersects(&(src1), &(src2), MAX_NUMNODES)
+-static inline int __nodes_intersects(const nodemask_t *src1p,
++static inline bool __nodes_intersects(const nodemask_t *src1p,
+                                       const nodemask_t *src2p, unsigned int nbits)
+ {
+       return bitmap_intersects(src1p->bits, src2p->bits, nbits);
+@@ -216,20 +216,20 @@ static inline int __nodes_intersects(const nodemask_t *src1p,
+ #define nodes_subset(src1, src2) \
+                       __nodes_subset(&(src1), &(src2), MAX_NUMNODES)
+-static inline int __nodes_subset(const nodemask_t *src1p,
++static inline bool __nodes_subset(const nodemask_t *src1p,
+                                       const nodemask_t *src2p, unsigned int nbits)
+ {
+       return bitmap_subset(src1p->bits, src2p->bits, nbits);
+ }
+ #define nodes_empty(src) __nodes_empty(&(src), MAX_NUMNODES)
+-static inline int __nodes_empty(const nodemask_t *srcp, unsigned int nbits)
++static inline bool __nodes_empty(const nodemask_t *srcp, unsigned int nbits)
+ {
+       return bitmap_empty(srcp->bits, nbits);
+ }
+ #define nodes_full(nodemask) __nodes_full(&(nodemask), MAX_NUMNODES)
+-static inline int __nodes_full(const nodemask_t *srcp, unsigned int nbits)
++static inline bool __nodes_full(const nodemask_t *srcp, unsigned int nbits)
+ {
+       return bitmap_full(srcp->bits, nbits);
+ }
+@@ -260,15 +260,15 @@ static inline void __nodes_shift_left(nodemask_t *dstp,
+           > MAX_NUMNODES, then the silly min_ts could be dropped. */
+ #define first_node(src) __first_node(&(src))
+-static inline int __first_node(const nodemask_t *srcp)
++static inline unsigned int __first_node(const nodemask_t *srcp)
+ {
+-      return min_t(int, MAX_NUMNODES, find_first_bit(srcp->bits, MAX_NUMNODES));
++      return min_t(unsigned int, MAX_NUMNODES, find_first_bit(srcp->bits, MAX_NUMNODES));
+ }
+ #define next_node(n, src) __next_node((n), &(src))
+-static inline int __next_node(int n, const nodemask_t *srcp)
++static inline unsigned int __next_node(int n, const nodemask_t *srcp)
+ {
+-      return min_t(int,MAX_NUMNODES,find_next_bit(srcp->bits, MAX_NUMNODES, n+1));
++      return min_t(unsigned int, MAX_NUMNODES, find_next_bit(srcp->bits, MAX_NUMNODES, n+1));
+ }
+ /*
+@@ -276,7 +276,7 @@ static inline int __next_node(int n, const nodemask_t *srcp)
+  * the first node in src if needed.  Returns MAX_NUMNODES if src is empty.
+  */
+ #define next_node_in(n, src) __next_node_in((n), &(src))
+-int __next_node_in(int node, const nodemask_t *srcp);
++unsigned int __next_node_in(int node, const nodemask_t *srcp);
+ static inline void init_nodemask_of_node(nodemask_t *mask, int node)
+ {
+@@ -296,9 +296,9 @@ static inline void init_nodemask_of_node(nodemask_t *mask, int node)
+ })
+ #define first_unset_node(mask) __first_unset_node(&(mask))
+-static inline int __first_unset_node(const nodemask_t *maskp)
++static inline unsigned int __first_unset_node(const nodemask_t *maskp)
+ {
+-      return min_t(int,MAX_NUMNODES,
++      return min_t(unsigned int, MAX_NUMNODES,
+                       find_first_zero_bit(maskp->bits, MAX_NUMNODES));
+ }
+@@ -435,11 +435,11 @@ static inline int num_node_state(enum node_states state)
+ #define first_online_node     first_node(node_states[N_ONLINE])
+ #define first_memory_node     first_node(node_states[N_MEMORY])
+-static inline int next_online_node(int nid)
++static inline unsigned int next_online_node(int nid)
+ {
+       return next_node(nid, node_states[N_ONLINE]);
+ }
+-static inline int next_memory_node(int nid)
++static inline unsigned int next_memory_node(int nid)
+ {
+       return next_node(nid, node_states[N_MEMORY]);
+ }
+diff --git a/lib/nodemask.c b/lib/nodemask.c
+index 3aa454c54c0d..e22647f5181b 100644
+--- a/lib/nodemask.c
++++ b/lib/nodemask.c
+@@ -3,9 +3,9 @@
+ #include <linux/module.h>
+ #include <linux/random.h>
+-int __next_node_in(int node, const nodemask_t *srcp)
++unsigned int __next_node_in(int node, const nodemask_t *srcp)
+ {
+-      int ret = __next_node(node, srcp);
++      unsigned int ret = __next_node(node, srcp);
+       if (ret == MAX_NUMNODES)
+               ret = __first_node(srcp);
+-- 
+2.35.1
+
diff --git a/queue-5.15/revert-net-af_key-add-check-for-pfkey_broadcast-in-f.patch b/queue-5.15/revert-net-af_key-add-check-for-pfkey_broadcast-in-f.patch
new file mode 100644 (file)
index 0000000..1d9cdf4
--- /dev/null
@@ -0,0 +1,60 @@
+From 85f96de5f93479a5676f790748de404532fee2f7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 23 May 2022 22:05:24 +0200
+Subject: Revert "net: af_key: add check for pfkey_broadcast in function
+ pfkey_process"
+
+From: Michal Kubecek <mkubecek@suse.cz>
+
+[ Upstream commit 9c90c9b3e50e16d03c7f87d63e9db373974781e0 ]
+
+This reverts commit 4dc2a5a8f6754492180741facf2a8787f2c415d7.
+
+A non-zero return value from pfkey_broadcast() does not necessarily mean
+an error occurred as this function returns -ESRCH when no registered
+listener received the message. In particular, a call with
+BROADCAST_PROMISC_ONLY flag and null one_sk argument can never return
+zero so that this commit in fact prevents processing any PF_KEY message.
+One visible effect is that racoon daemon fails to find encryption
+algorithms like aes and refuses to start.
+
+Excluding -ESRCH return value would fix this but it's not obvious that
+we really want to bail out here and most other callers of
+pfkey_broadcast() also ignore the return value. Also, as pointed out by
+Steffen Klassert, PF_KEY is kind of deprecated and newer userspace code
+should use netlink instead so that we should only disturb the code for
+really important fixes.
+
+v2: add a comment explaining why is the return value ignored
+
+Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
+Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/key/af_key.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/net/key/af_key.c b/net/key/af_key.c
+index 339d95df19d3..d93bde657359 100644
+--- a/net/key/af_key.c
++++ b/net/key/af_key.c
+@@ -2826,10 +2826,12 @@ static int pfkey_process(struct sock *sk, struct sk_buff *skb, const struct sadb
+       void *ext_hdrs[SADB_EXT_MAX];
+       int err;
+-      err = pfkey_broadcast(skb_clone(skb, GFP_KERNEL), GFP_KERNEL,
+-                            BROADCAST_PROMISC_ONLY, NULL, sock_net(sk));
+-      if (err)
+-              return err;
++      /* Non-zero return value of pfkey_broadcast() does not always signal
++       * an error and even on an actual error we may still want to process
++       * the message so rather ignore the return value.
++       */
++      pfkey_broadcast(skb_clone(skb, GFP_KERNEL), GFP_KERNEL,
++                      BROADCAST_PROMISC_ONLY, NULL, sock_net(sk));
+       memset(ext_hdrs, 0, sizeof(ext_hdrs));
+       err = parse_exthdrs(skb, hdr, ext_hdrs);
+-- 
+2.35.1
+
diff --git a/queue-5.15/s390-gmap-voluntarily-schedule-during-key-setting.patch b/queue-5.15/s390-gmap-voluntarily-schedule-during-key-setting.patch
new file mode 100644 (file)
index 0000000..bb0c7b7
--- /dev/null
@@ -0,0 +1,86 @@
+From df26f6c7b36a4d7d736ca88e3ffe8835a768264f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 30 May 2022 11:27:05 +0200
+Subject: s390/gmap: voluntarily schedule during key setting
+
+From: Christian Borntraeger <borntraeger@linux.ibm.com>
+
+[ Upstream commit 6d5946274df1fff539a7eece458a43be733d1db8 ]
+
+With large and many guest with storage keys it is possible to create
+large latencies or stalls during initial key setting:
+
+rcu: INFO: rcu_sched self-detected stall on CPU
+rcu:   18-....: (2099 ticks this GP) idle=54e/1/0x4000000000000002 softirq=35598716/35598716 fqs=998
+       (t=2100 jiffies g=155867385 q=20879)
+Task dump for CPU 18:
+CPU 1/KVM       R  running task        0 1030947 256019 0x06000004
+Call Trace:
+sched_show_task
+rcu_dump_cpu_stacks
+rcu_sched_clock_irq
+update_process_times
+tick_sched_handle
+tick_sched_timer
+__hrtimer_run_queues
+hrtimer_interrupt
+do_IRQ
+ext_int_handler
+ptep_zap_key
+
+The mmap lock is held during the page walking but since this is a
+semaphore scheduling is still possible. Same for the kvm srcu.
+To minimize overhead do this on every segment table entry or large page.
+
+Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
+Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
+Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
+Link: https://lore.kernel.org/r/20220530092706.11637-2-borntraeger@linux.ibm.com
+Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
+Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/s390/mm/gmap.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
+index d63c0ccc5ccd..4ce3a2f01c91 100644
+--- a/arch/s390/mm/gmap.c
++++ b/arch/s390/mm/gmap.c
+@@ -2601,6 +2601,18 @@ static int __s390_enable_skey_pte(pte_t *pte, unsigned long addr,
+       return 0;
+ }
++/*
++ * Give a chance to schedule after setting a key to 256 pages.
++ * We only hold the mm lock, which is a rwsem and the kvm srcu.
++ * Both can sleep.
++ */
++static int __s390_enable_skey_pmd(pmd_t *pmd, unsigned long addr,
++                                unsigned long next, struct mm_walk *walk)
++{
++      cond_resched();
++      return 0;
++}
++
+ static int __s390_enable_skey_hugetlb(pte_t *pte, unsigned long addr,
+                                     unsigned long hmask, unsigned long next,
+                                     struct mm_walk *walk)
+@@ -2623,12 +2635,14 @@ static int __s390_enable_skey_hugetlb(pte_t *pte, unsigned long addr,
+       end = start + HPAGE_SIZE - 1;
+       __storage_key_init_range(start, end);
+       set_bit(PG_arch_1, &page->flags);
++      cond_resched();
+       return 0;
+ }
+ static const struct mm_walk_ops enable_skey_walk_ops = {
+       .hugetlb_entry          = __s390_enable_skey_hugetlb,
+       .pte_entry              = __s390_enable_skey_pte,
++      .pmd_entry              = __s390_enable_skey_pmd,
+ };
+ int s390_enable_skey(void)
+-- 
+2.35.1
+
diff --git a/queue-5.15/scsi-myrb-fix-up-null-pointer-access-on-myrb_cleanup.patch b/queue-5.15/scsi-myrb-fix-up-null-pointer-access-on-myrb_cleanup.patch
new file mode 100644 (file)
index 0000000..8537e52
--- /dev/null
@@ -0,0 +1,57 @@
+From 957b18df234cf874fed1cd3f6ca47c498b255aa9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 23 May 2022 14:02:44 +0200
+Subject: scsi: myrb: Fix up null pointer access on myrb_cleanup()
+
+From: Hannes Reinecke <hare@suse.de>
+
+[ Upstream commit f9f0a46141e2e39bedb4779c88380d1b5f018c14 ]
+
+When myrb_probe() fails the callback might not be set, so we need to
+validate the 'disable_intr' callback in myrb_cleanup() to not cause a null
+pointer exception. And while at it do not call myrb_cleanup() if we cannot
+enable the PCI device at all.
+
+Link: https://lore.kernel.org/r/20220523120244.99515-1-hare@suse.de
+Reported-by: Zheyu Ma <zheyuma97@gmail.com>
+Tested-by: Zheyu Ma <zheyuma97@gmail.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/myrb.c | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/scsi/myrb.c b/drivers/scsi/myrb.c
+index a4a88323e020..386256369dfc 100644
+--- a/drivers/scsi/myrb.c
++++ b/drivers/scsi/myrb.c
+@@ -1239,7 +1239,8 @@ static void myrb_cleanup(struct myrb_hba *cb)
+       myrb_unmap(cb);
+       if (cb->mmio_base) {
+-              cb->disable_intr(cb->io_base);
++              if (cb->disable_intr)
++                      cb->disable_intr(cb->io_base);
+               iounmap(cb->mmio_base);
+       }
+       if (cb->irq)
+@@ -3409,9 +3410,13 @@ static struct myrb_hba *myrb_detect(struct pci_dev *pdev,
+       mutex_init(&cb->dcmd_mutex);
+       mutex_init(&cb->dma_mutex);
+       cb->pdev = pdev;
++      cb->host = shost;
+-      if (pci_enable_device(pdev))
+-              goto failure;
++      if (pci_enable_device(pdev)) {
++              dev_err(&pdev->dev, "Failed to enable PCI device\n");
++              scsi_host_put(shost);
++              return NULL;
++      }
+       if (privdata->hw_init == DAC960_PD_hw_init ||
+           privdata->hw_init == DAC960_P_hw_init) {
+-- 
+2.35.1
+
diff --git a/queue-5.15/serial-msm_serial-disable-interrupts-in-__msm_consol.patch b/queue-5.15/serial-msm_serial-disable-interrupts-in-__msm_consol.patch
new file mode 100644 (file)
index 0000000..201506d
--- /dev/null
@@ -0,0 +1,59 @@
+From 9e85ca32e2eefd443275b70e33234af934dfe3e3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 6 May 2022 23:39:24 +0206
+Subject: serial: msm_serial: disable interrupts in __msm_console_write()
+
+From: John Ogness <john.ogness@linutronix.de>
+
+[ Upstream commit aabdbb1b7a5819e18c403334a31fb0cc2c06ad41 ]
+
+__msm_console_write() assumes that interrupts are disabled, but
+with threaded console printers it is possible that the write()
+callback of the console is called with interrupts enabled.
+
+Explicitly disable interrupts using local_irq_save() to preserve
+the assumed context.
+
+Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
+Reviewed-by: Petr Mladek <pmladek@suse.com>
+Signed-off-by: John Ogness <john.ogness@linutronix.de>
+Link: https://lore.kernel.org/r/20220506213324.470461-1-john.ogness@linutronix.de
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/tty/serial/msm_serial.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
+index 489d19274f9a..03ff63438e77 100644
+--- a/drivers/tty/serial/msm_serial.c
++++ b/drivers/tty/serial/msm_serial.c
+@@ -1588,6 +1588,7 @@ static inline struct uart_port *msm_get_port_from_line(unsigned int line)
+ static void __msm_console_write(struct uart_port *port, const char *s,
+                               unsigned int count, bool is_uartdm)
+ {
++      unsigned long flags;
+       int i;
+       int num_newlines = 0;
+       bool replaced = false;
+@@ -1605,6 +1606,8 @@ static void __msm_console_write(struct uart_port *port, const char *s,
+                       num_newlines++;
+       count += num_newlines;
++      local_irq_save(flags);
++
+       if (port->sysrq)
+               locked = 0;
+       else if (oops_in_progress)
+@@ -1650,6 +1653,8 @@ static void __msm_console_write(struct uart_port *port, const char *s,
+       if (locked)
+               spin_unlock(&port->lock);
++
++      local_irq_restore(flags);
+ }
+ static void msm_console_write(struct console *co, const char *s,
+-- 
+2.35.1
+
index 8a3942a4fff9026375c69afce6e7e0fc1d3bf8ce..6fbc26e78c931daed93eab0dadbdcee8a5b7f509 100644 (file)
@@ -163,3 +163,50 @@ tcp-use-alloc_large_system_hash-to-allocate-table_pe.patch
 drm-imx-fix-compiler-warning-with-gcc-12.patch
 nfp-flower-restructure-flow-key-for-gre-vlan-combina.patch
 iov_iter-fix-iter_xarray_get_pages-_alloc.patch
+iio-dummy-iio_simple_dummy-check-the-return-value-of.patch
+staging-rtl8712-fix-a-potential-memory-leak-in-r871x.patch
+iio-st_sensors-add-a-local-lock-for-protecting-odr.patch
+lkdtm-usercopy-expand-size-of-out-of-frame-object.patch
+drivers-staging-rtl8723bs-fix-deadlock-in-rtw_survey.patch
+drivers-staging-rtl8192bs-fix-deadlock-in-rtw_joinbs.patch
+tty-synclink_gt-fix-null-pointer-dereference-in-slgt.patch
+tty-fix-a-possible-resource-leak-in-icom_probe.patch
+thunderbolt-use-different-lane-for-second-displaypor.patch
+drivers-staging-rtl8192u-fix-deadlock-in-ieee80211_b.patch
+drivers-staging-rtl8192e-fix-deadlock-in-rtllib_beac.patch
+usb-host-isp116x-check-return-value-after-calling-pl.patch
+drivers-tty-serial-fix-deadlock-in-sa1100_set_termio.patch
+drivers-usb-host-fix-deadlock-in-oxu_bus_suspend.patch
+usb-hcd-pci-fully-suspend-across-freeze-thaw-cycle.patch
+char-xillybus-fix-a-refcount-leak-in-cleanup_dev.patch
+sysrq-do-not-omit-current-cpu-when-showing-backtrace.patch
+usb-dwc2-gadget-don-t-reset-gadget-s-driver-bus.patch
+soundwire-qcom-adjust-autoenumeration-timeout.patch
+misc-rtsx-set-null-intfdata-when-probe-fails.patch
+extcon-fix-extcon_get_extcon_dev-error-handling.patch
+extcon-modify-extcon-device-to-be-created-after-driv.patch
+clocksource-drivers-sp804-avoid-error-on-multiple-in.patch
+staging-rtl8712-fix-uninit-value-in-usb_read8-and-fr.patch
+staging-rtl8712-fix-uninit-value-in-r871xu_drv_init.patch
+serial-msm_serial-disable-interrupts-in-__msm_consol.patch
+kernfs-separate-kernfs_pr_cont_buf-and-rename_lock.patch
+watchdog-wdat_wdt-stop-watchdog-when-rebooting-the-s.patch
+md-protect-md_unregister_thread-from-reentrancy.patch
+scsi-myrb-fix-up-null-pointer-access-on-myrb_cleanup.patch
+revert-net-af_key-add-check-for-pfkey_broadcast-in-f.patch
+ceph-allow-ceph.dir.rctime-xattr-to-be-updatable.patch
+ceph-flush-the-mdlog-for-filesystem-sync.patch
+drm-amd-display-check-if-modulo-is-0-before-dividing.patch
+drm-radeon-fix-a-possible-null-pointer-dereference.patch
+drm-amd-pm-fix-missing-thermal-throttler-status.patch
+um-line-use-separate-irqs-per-line.patch
+modpost-fix-undefined-behavior-of-is_arm_mapping_sym.patch
+x86-cpu-elide-kcsan-for-cpu_has-and-friends.patch
+jump_label-noinstr-avoid-instrumentation-for-jump_la.patch
+nbd-call-genl_unregister_family-first-in-nbd_cleanup.patch
+nbd-fix-race-between-nbd_alloc_config-and-module-rem.patch
+nbd-fix-io-hung-while-disconnecting-device.patch
+s390-gmap-voluntarily-schedule-during-key-setting.patch
+cifs-version-operations-for-smb20-unneeded-when-lega.patch
+drm-amd-pm-use-bitmap_-from-to-_arr32-where-appropri.patch
+nodemask-fix-return-values-to-be-unsigned.patch
diff --git a/queue-5.15/soundwire-qcom-adjust-autoenumeration-timeout.patch b/queue-5.15/soundwire-qcom-adjust-autoenumeration-timeout.patch
new file mode 100644 (file)
index 0000000..1928365
--- /dev/null
@@ -0,0 +1,42 @@
+From 0dbbb3865b9aa421941122376f4ea4e0d36c3950 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 6 May 2022 09:47:05 +0100
+Subject: soundwire: qcom: adjust autoenumeration timeout
+
+From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
+
+[ Upstream commit 74da272400b46f2e898f115d1b1cd60828766919 ]
+
+Currently timeout for autoenumeration during probe and bus reset is set to
+2 secs which is really a big value. This can have an adverse effect on
+boot time if the slave device is not ready/reset.
+This was the case with wcd938x which was not reset yet but we spent 2
+secs waiting in the soundwire controller probe. Reduce this time to
+1/10 of Hz which should be good enough time to finish autoenumeration
+if any slaves are available on the bus.
+
+Reported-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
+Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
+Link: https://lore.kernel.org/r/20220506084705.18525-1-srinivas.kandagatla@linaro.org
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/soundwire/qcom.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
+index 0ef79d60e88e..f5955826b152 100644
+--- a/drivers/soundwire/qcom.c
++++ b/drivers/soundwire/qcom.c
+@@ -97,7 +97,7 @@
+ #define SWRM_SPECIAL_CMD_ID   0xF
+ #define MAX_FREQ_NUM          1
+-#define TIMEOUT_MS            (2 * HZ)
++#define TIMEOUT_MS            100
+ #define QCOM_SWRM_MAX_RD_LEN  0x1
+ #define QCOM_SDW_MAX_PORTS    14
+ #define DEFAULT_CLK_FREQ      9600000
+-- 
+2.35.1
+
diff --git a/queue-5.15/staging-rtl8712-fix-a-potential-memory-leak-in-r871x.patch b/queue-5.15/staging-rtl8712-fix-a-potential-memory-leak-in-r871x.patch
new file mode 100644 (file)
index 0000000..13ab8bc
--- /dev/null
@@ -0,0 +1,81 @@
+From 4d79a9fa7e8753b1e3ffa278eb99c096d5e971df Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 5 Apr 2022 12:43:07 +0800
+Subject: staging: rtl8712: fix a potential memory leak in r871xu_drv_init()
+
+From: Xiaoke Wang <xkernel.wang@foxmail.com>
+
+[ Upstream commit 7288ff561de650d4139fab80e9cb0da9b5b32434 ]
+
+In r871xu_drv_init(), if r8712_init_drv_sw() fails, then the memory
+allocated by r8712_alloc_io_queue() in r8712_usb_dvobj_init() is not
+properly released as there is no action will be performed by
+r8712_usb_dvobj_deinit().
+To properly release it, we should call r8712_free_io_queue() in
+r8712_usb_dvobj_deinit().
+
+Besides, in r871xu_dev_remove(), r8712_usb_dvobj_deinit() will be called
+by r871x_dev_unload() under condition `padapter->bup` and
+r8712_free_io_queue() is called by r8712_free_drv_sw().
+However, r8712_usb_dvobj_deinit() does not rely on `padapter->bup` and
+calling r8712_free_io_queue() in r8712_free_drv_sw() is negative for
+better understading the code.
+So I move r8712_usb_dvobj_deinit() into r871xu_dev_remove(), and remove
+r8712_free_io_queue() from r8712_free_drv_sw().
+
+Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
+Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
+Link: https://lore.kernel.org/r/tencent_B8048C592777830380A23A7C4409F9DF1305@qq.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/staging/rtl8712/os_intfs.c | 1 -
+ drivers/staging/rtl8712/usb_intf.c | 6 +++---
+ 2 files changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c
+index 9502f6aa5306..bc033849fcea 100644
+--- a/drivers/staging/rtl8712/os_intfs.c
++++ b/drivers/staging/rtl8712/os_intfs.c
+@@ -332,7 +332,6 @@ void r8712_free_drv_sw(struct _adapter *padapter)
+       r8712_free_evt_priv(&padapter->evtpriv);
+       r8712_DeInitSwLeds(padapter);
+       r8712_free_mlme_priv(&padapter->mlmepriv);
+-      r8712_free_io_queue(padapter);
+       _free_xmit_priv(&padapter->xmitpriv);
+       _r8712_free_sta_priv(&padapter->stapriv);
+       _r8712_free_recv_priv(&padapter->recvpriv);
+diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c
+index cae04272deff..a61dd96ab2a4 100644
+--- a/drivers/staging/rtl8712/usb_intf.c
++++ b/drivers/staging/rtl8712/usb_intf.c
+@@ -265,6 +265,7 @@ static uint r8712_usb_dvobj_init(struct _adapter *padapter)
+ static void r8712_usb_dvobj_deinit(struct _adapter *padapter)
+ {
++      r8712_free_io_queue(padapter);
+ }
+ void rtl871x_intf_stop(struct _adapter *padapter)
+@@ -302,9 +303,6 @@ void r871x_dev_unload(struct _adapter *padapter)
+                       rtl8712_hal_deinit(padapter);
+               }
+-              /*s6.*/
+-              if (padapter->dvobj_deinit)
+-                      padapter->dvobj_deinit(padapter);
+               padapter->bup = false;
+       }
+ }
+@@ -607,6 +605,8 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf)
+       /* Stop driver mlme relation timer */
+       r8712_stop_drv_timers(padapter);
+       r871x_dev_unload(padapter);
++      if (padapter->dvobj_deinit)
++              padapter->dvobj_deinit(padapter);
+       r8712_free_drv_sw(padapter);
+       free_netdev(pnetdev);
+-- 
+2.35.1
+
diff --git a/queue-5.15/staging-rtl8712-fix-uninit-value-in-r871xu_drv_init.patch b/queue-5.15/staging-rtl8712-fix-uninit-value-in-r871xu_drv_init.patch
new file mode 100644 (file)
index 0000000..c7e3871
--- /dev/null
@@ -0,0 +1,88 @@
+From 715dc1922ff24be17a23fc5738015dfbf68f57ec Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 16 May 2022 17:22:41 +0800
+Subject: staging: rtl8712: fix uninit-value in r871xu_drv_init()
+
+From: Wang Cheng <wanngchenng@gmail.com>
+
+[ Upstream commit 0458e5428e5e959d201a40ffe71d762a79ecedc4 ]
+
+When 'tmpU1b' returns from r8712_read8(padapter, EE_9346CR) is 0,
+'mac[6]' will not be initialized.
+
+BUG: KMSAN: uninit-value in r871xu_drv_init+0x2d54/0x3070 drivers/staging/rtl8712/usb_intf.c:541
+ r871xu_drv_init+0x2d54/0x3070 drivers/staging/rtl8712/usb_intf.c:541
+ usb_probe_interface+0xf19/0x1600 drivers/usb/core/driver.c:396
+ really_probe+0x653/0x14b0 drivers/base/dd.c:596
+ __driver_probe_device+0x3e9/0x530 drivers/base/dd.c:752
+ driver_probe_device drivers/base/dd.c:782 [inline]
+ __device_attach_driver+0x79f/0x1120 drivers/base/dd.c:899
+ bus_for_each_drv+0x2d6/0x3f0 drivers/base/bus.c:427
+ __device_attach+0x593/0x8e0 drivers/base/dd.c:970
+ device_initial_probe+0x4a/0x60 drivers/base/dd.c:1017
+ bus_probe_device+0x17b/0x3e0 drivers/base/bus.c:487
+ device_add+0x1fff/0x26e0 drivers/base/core.c:3405
+ usb_set_configuration+0x37e9/0x3ed0 drivers/usb/core/message.c:2170
+ usb_generic_driver_probe+0x13c/0x300 drivers/usb/core/generic.c:238
+ usb_probe_device+0x309/0x570 drivers/usb/core/driver.c:293
+ really_probe+0x653/0x14b0 drivers/base/dd.c:596
+ __driver_probe_device+0x3e9/0x530 drivers/base/dd.c:752
+ driver_probe_device drivers/base/dd.c:782 [inline]
+ __device_attach_driver+0x79f/0x1120 drivers/base/dd.c:899
+ bus_for_each_drv+0x2d6/0x3f0 drivers/base/bus.c:427
+ __device_attach+0x593/0x8e0 drivers/base/dd.c:970
+ device_initial_probe+0x4a/0x60 drivers/base/dd.c:1017
+ bus_probe_device+0x17b/0x3e0 drivers/base/bus.c:487
+ device_add+0x1fff/0x26e0 drivers/base/core.c:3405
+ usb_new_device+0x1b8e/0x2950 drivers/usb/core/hub.c:2566
+ hub_port_connect drivers/usb/core/hub.c:5358 [inline]
+ hub_port_connect_change drivers/usb/core/hub.c:5502 [inline]
+ port_event drivers/usb/core/hub.c:5660 [inline]
+ hub_event+0x58e3/0x89e0 drivers/usb/core/hub.c:5742
+ process_one_work+0xdb6/0x1820 kernel/workqueue.c:2307
+ worker_thread+0x10b3/0x21e0 kernel/workqueue.c:2454
+ kthread+0x3c7/0x500 kernel/kthread.c:377
+ ret_from_fork+0x1f/0x30
+
+Local variable mac created at:
+ r871xu_drv_init+0x1771/0x3070 drivers/staging/rtl8712/usb_intf.c:394
+ usb_probe_interface+0xf19/0x1600 drivers/usb/core/driver.c:396
+
+KMSAN: uninit-value in r871xu_drv_init
+https://syzkaller.appspot.com/bug?id=3cd92b1d85428b128503bfa7a250294c9ae00bd8
+
+Reported-by: <syzbot+6f5ecd144854c0d8580b@syzkaller.appspotmail.com>
+Tested-by: <syzbot+6f5ecd144854c0d8580b@syzkaller.appspotmail.com>
+Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
+Signed-off-by: Wang Cheng <wanngchenng@gmail.com>
+Link: https://lore.kernel.org/r/14c3886173dfa4597f0704547c414cfdbcd11d16.1652618244.git.wanngchenng@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/staging/rtl8712/usb_intf.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c
+index a61dd96ab2a4..6db2493e6d3a 100644
+--- a/drivers/staging/rtl8712/usb_intf.c
++++ b/drivers/staging/rtl8712/usb_intf.c
+@@ -536,13 +536,13 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
+               } else {
+                       AutoloadFail = false;
+               }
+-              if (((mac[0] == 0xff) && (mac[1] == 0xff) &&
++              if ((!AutoloadFail) ||
++                  ((mac[0] == 0xff) && (mac[1] == 0xff) &&
+                    (mac[2] == 0xff) && (mac[3] == 0xff) &&
+                    (mac[4] == 0xff) && (mac[5] == 0xff)) ||
+                   ((mac[0] == 0x00) && (mac[1] == 0x00) &&
+                    (mac[2] == 0x00) && (mac[3] == 0x00) &&
+-                   (mac[4] == 0x00) && (mac[5] == 0x00)) ||
+-                   (!AutoloadFail)) {
++                   (mac[4] == 0x00) && (mac[5] == 0x00))) {
+                       mac[0] = 0x00;
+                       mac[1] = 0xe0;
+                       mac[2] = 0x4c;
+-- 
+2.35.1
+
diff --git a/queue-5.15/staging-rtl8712-fix-uninit-value-in-usb_read8-and-fr.patch b/queue-5.15/staging-rtl8712-fix-uninit-value-in-usb_read8-and-fr.patch
new file mode 100644 (file)
index 0000000..c82b0c7
--- /dev/null
@@ -0,0 +1,153 @@
+From a5f0093ecb20afd04ff5222c4a69bee00f5cdf61 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 16 May 2022 17:22:23 +0800
+Subject: staging: rtl8712: fix uninit-value in usb_read8() and friends
+
+From: Wang Cheng <wanngchenng@gmail.com>
+
+[ Upstream commit d1b57669732d09da7e13ef86d058dab0cd57f6e0 ]
+
+When r8712_usbctrl_vendorreq() returns negative, 'data' in
+usb_read{8,16,32} will not be initialized.
+
+BUG: KMSAN: uninit-value in string_nocheck lib/vsprintf.c:643 [inline]
+BUG: KMSAN: uninit-value in string+0x4ec/0x6f0 lib/vsprintf.c:725
+ string_nocheck lib/vsprintf.c:643 [inline]
+ string+0x4ec/0x6f0 lib/vsprintf.c:725
+ vsnprintf+0x2222/0x3650 lib/vsprintf.c:2806
+ va_format lib/vsprintf.c:1704 [inline]
+ pointer+0x18e6/0x1f70 lib/vsprintf.c:2443
+ vsnprintf+0x1a9b/0x3650 lib/vsprintf.c:2810
+ vprintk_store+0x537/0x2150 kernel/printk/printk.c:2158
+ vprintk_emit+0x28b/0xab0 kernel/printk/printk.c:2256
+ dev_vprintk_emit+0x5ef/0x6d0 drivers/base/core.c:4604
+ dev_printk_emit+0x1dd/0x21f drivers/base/core.c:4615
+ __dev_printk+0x3be/0x440 drivers/base/core.c:4627
+ _dev_info+0x1ea/0x22f drivers/base/core.c:4673
+ r871xu_drv_init+0x1929/0x3070 drivers/staging/rtl8712/usb_intf.c:401
+ usb_probe_interface+0xf19/0x1600 drivers/usb/core/driver.c:396
+ really_probe+0x6c7/0x1350 drivers/base/dd.c:621
+ __driver_probe_device+0x3e9/0x530 drivers/base/dd.c:752
+ driver_probe_device drivers/base/dd.c:782 [inline]
+ __device_attach_driver+0x79f/0x1120 drivers/base/dd.c:899
+ bus_for_each_drv+0x2d6/0x3f0 drivers/base/bus.c:427
+ __device_attach+0x593/0x8e0 drivers/base/dd.c:970
+ device_initial_probe+0x4a/0x60 drivers/base/dd.c:1017
+ bus_probe_device+0x17b/0x3e0 drivers/base/bus.c:487
+ device_add+0x1fff/0x26e0 drivers/base/core.c:3405
+ usb_set_configuration+0x37e9/0x3ed0 drivers/usb/core/message.c:2170
+ usb_generic_driver_probe+0x13c/0x300 drivers/usb/core/generic.c:238
+ usb_probe_device+0x309/0x570 drivers/usb/core/driver.c:293
+ really_probe+0x6c7/0x1350 drivers/base/dd.c:621
+ __driver_probe_device+0x3e9/0x530 drivers/base/dd.c:752
+ driver_probe_device drivers/base/dd.c:782 [inline]
+ __device_attach_driver+0x79f/0x1120 drivers/base/dd.c:899
+ bus_for_each_drv+0x2d6/0x3f0 drivers/base/bus.c:427
+ __device_attach+0x593/0x8e0 drivers/base/dd.c:970
+ device_initial_probe+0x4a/0x60 drivers/base/dd.c:1017
+ bus_probe_device+0x17b/0x3e0 drivers/base/bus.c:487
+ device_add+0x1fff/0x26e0 drivers/base/core.c:3405
+ usb_new_device+0x1b91/0x2950 drivers/usb/core/hub.c:2566
+ hub_port_connect drivers/usb/core/hub.c:5363 [inline]
+ hub_port_connect_change drivers/usb/core/hub.c:5507 [inline]
+ port_event drivers/usb/core/hub.c:5665 [inline]
+ hub_event+0x58e3/0x89e0 drivers/usb/core/hub.c:5747
+ process_one_work+0xdb6/0x1820 kernel/workqueue.c:2289
+ worker_thread+0x10d0/0x2240 kernel/workqueue.c:2436
+ kthread+0x3c7/0x500 kernel/kthread.c:376
+ ret_from_fork+0x1f/0x30
+
+Local variable data created at:
+ usb_read8+0x5d/0x130 drivers/staging/rtl8712/usb_ops.c:33
+ r8712_read8+0xa5/0xd0 drivers/staging/rtl8712/rtl8712_io.c:29
+
+KMSAN: uninit-value in r871xu_drv_init
+https://syzkaller.appspot.com/bug?id=3cd92b1d85428b128503bfa7a250294c9ae00bd8
+
+Reported-by: <syzbot+6f5ecd144854c0d8580b@syzkaller.appspotmail.com>
+Tested-by: <syzbot+6f5ecd144854c0d8580b@syzkaller.appspotmail.com>
+Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
+Signed-off-by: Wang Cheng <wanngchenng@gmail.com>
+Link: https://lore.kernel.org/r/b9b7a6ee02c02aa28054f5cf16129977775f3cd9.1652618244.git.wanngchenng@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/staging/rtl8712/usb_ops.c | 27 ++++++++++++++++++---------
+ 1 file changed, 18 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/staging/rtl8712/usb_ops.c b/drivers/staging/rtl8712/usb_ops.c
+index e64845e6adf3..af9966d03979 100644
+--- a/drivers/staging/rtl8712/usb_ops.c
++++ b/drivers/staging/rtl8712/usb_ops.c
+@@ -29,7 +29,8 @@ static u8 usb_read8(struct intf_hdl *intfhdl, u32 addr)
+       u16 wvalue;
+       u16 index;
+       u16 len;
+-      __le32 data;
++      int status;
++      __le32 data = 0;
+       struct intf_priv *intfpriv = intfhdl->pintfpriv;
+       request = 0x05;
+@@ -37,8 +38,10 @@ static u8 usb_read8(struct intf_hdl *intfhdl, u32 addr)
+       index = 0;
+       wvalue = (u16)(addr & 0x0000ffff);
+       len = 1;
+-      r8712_usbctrl_vendorreq(intfpriv, request, wvalue, index, &data, len,
+-                              requesttype);
++      status = r8712_usbctrl_vendorreq(intfpriv, request, wvalue, index,
++                                       &data, len, requesttype);
++      if (status < 0)
++              return 0;
+       return (u8)(le32_to_cpu(data) & 0x0ff);
+ }
+@@ -49,7 +52,8 @@ static u16 usb_read16(struct intf_hdl *intfhdl, u32 addr)
+       u16 wvalue;
+       u16 index;
+       u16 len;
+-      __le32 data;
++      int status;
++      __le32 data = 0;
+       struct intf_priv *intfpriv = intfhdl->pintfpriv;
+       request = 0x05;
+@@ -57,8 +61,10 @@ static u16 usb_read16(struct intf_hdl *intfhdl, u32 addr)
+       index = 0;
+       wvalue = (u16)(addr & 0x0000ffff);
+       len = 2;
+-      r8712_usbctrl_vendorreq(intfpriv, request, wvalue, index, &data, len,
+-                              requesttype);
++      status = r8712_usbctrl_vendorreq(intfpriv, request, wvalue, index,
++                                       &data, len, requesttype);
++      if (status < 0)
++              return 0;
+       return (u16)(le32_to_cpu(data) & 0xffff);
+ }
+@@ -69,7 +75,8 @@ static u32 usb_read32(struct intf_hdl *intfhdl, u32 addr)
+       u16 wvalue;
+       u16 index;
+       u16 len;
+-      __le32 data;
++      int status;
++      __le32 data = 0;
+       struct intf_priv *intfpriv = intfhdl->pintfpriv;
+       request = 0x05;
+@@ -77,8 +84,10 @@ static u32 usb_read32(struct intf_hdl *intfhdl, u32 addr)
+       index = 0;
+       wvalue = (u16)(addr & 0x0000ffff);
+       len = 4;
+-      r8712_usbctrl_vendorreq(intfpriv, request, wvalue, index, &data, len,
+-                              requesttype);
++      status = r8712_usbctrl_vendorreq(intfpriv, request, wvalue, index,
++                                       &data, len, requesttype);
++      if (status < 0)
++              return 0;
+       return le32_to_cpu(data);
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/sysrq-do-not-omit-current-cpu-when-showing-backtrace.patch b/queue-5.15/sysrq-do-not-omit-current-cpu-when-showing-backtrace.patch
new file mode 100644 (file)
index 0000000..8a12fd7
--- /dev/null
@@ -0,0 +1,91 @@
+From d97b16c23ad55105f05ee07362a9917b18932e1e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 17 Jan 2022 23:43:00 +0800
+Subject: sysrq: do not omit current cpu when showing backtrace of all active
+ CPUs
+
+From: Changbin Du <changbin.du@gmail.com>
+
+[ Upstream commit 5390e7f46b9d5546d45a83e6463bc656678b1d0e ]
+
+The backtrace of current CPU also should be printed as it is active. This
+change add stack trace for current CPU and print a hint for idle CPU for
+the generic workqueue based printing. (x86 already does this)
+
+Now it looks like below:
+[  279.401567] sysrq: Show backtrace of all active CPUs
+[  279.407234] sysrq: CPU5:
+[  279.407505] Call Trace:
+[  279.408789] [<ffffffff8000606c>] dump_backtrace+0x2c/0x3a
+[  279.411698] [<ffffffff800060ac>] show_stack+0x32/0x3e
+[  279.411809] [<ffffffff80542258>] sysrq_handle_showallcpus+0x4c/0xc6
+[  279.411929] [<ffffffff80542f16>] __handle_sysrq+0x106/0x26c
+[  279.412034] [<ffffffff805436a8>] write_sysrq_trigger+0x64/0x74
+[  279.412139] [<ffffffff8029cd48>] proc_reg_write+0x8e/0xe2
+[  279.412252] [<ffffffff8021a8f8>] vfs_write+0x90/0x2be
+[  279.412362] [<ffffffff8021acd2>] ksys_write+0xa6/0xce
+[  279.412467] [<ffffffff8021ad24>] sys_write+0x2a/0x38
+[  279.412689] [<ffffffff80003ff8>] ret_from_syscall+0x0/0x2
+[  279.417173] sysrq: CPU6: backtrace skipped as idling
+[  279.417185] sysrq: CPU4: backtrace skipped as idling
+[  279.417187] sysrq: CPU0: backtrace skipped as idling
+[  279.417181] sysrq: CPU7: backtrace skipped as idling
+[  279.417190] sysrq: CPU1: backtrace skipped as idling
+[  279.417193] sysrq: CPU3: backtrace skipped as idling
+[  279.417219] sysrq: CPU2:
+[  279.419179] Call Trace:
+[  279.419440] [<ffffffff8000606c>] dump_backtrace+0x2c/0x3a
+[  279.419782] [<ffffffff800060ac>] show_stack+0x32/0x3e
+[  279.420015] [<ffffffff80542b30>] showacpu+0x5c/0x96
+[  279.420317] [<ffffffff800ba71c>] flush_smp_call_function_queue+0xd6/0x218
+[  279.420569] [<ffffffff800bb438>] generic_smp_call_function_single_interrupt+0x14/0x1c
+[  279.420798] [<ffffffff800079ae>] handle_IPI+0xaa/0x13a
+[  279.421024] [<ffffffff804dcb92>] riscv_intc_irq+0x56/0x70
+[  279.421274] [<ffffffff80a05b70>] generic_handle_arch_irq+0x6a/0xfa
+[  279.421518] [<ffffffff80004006>] ret_from_exception+0x0/0x10
+[  279.421750] [<ffffffff80096492>] rcu_idle_enter+0x16/0x1e
+
+Signed-off-by: Changbin Du <changbin.du@gmail.com>
+Link: https://lore.kernel.org/r/20220117154300.2808-1-changbin.du@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/tty/sysrq.c | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
+index c911196ac893..6b445ece8339 100644
+--- a/drivers/tty/sysrq.c
++++ b/drivers/tty/sysrq.c
+@@ -232,8 +232,10 @@ static void showacpu(void *dummy)
+       unsigned long flags;
+       /* Idle CPUs have no interesting backtrace. */
+-      if (idle_cpu(smp_processor_id()))
++      if (idle_cpu(smp_processor_id())) {
++              pr_info("CPU%d: backtrace skipped as idling\n", smp_processor_id());
+               return;
++      }
+       raw_spin_lock_irqsave(&show_lock, flags);
+       pr_info("CPU%d:\n", smp_processor_id());
+@@ -260,10 +262,13 @@ static void sysrq_handle_showallcpus(int key)
+               if (in_hardirq())
+                       regs = get_irq_regs();
+-              if (regs) {
+-                      pr_info("CPU%d:\n", smp_processor_id());
++
++              pr_info("CPU%d:\n", smp_processor_id());
++              if (regs)
+                       show_regs(regs);
+-              }
++              else
++                      show_stack(NULL, NULL, KERN_INFO);
++
+               schedule_work(&sysrq_showallcpus);
+       }
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/thunderbolt-use-different-lane-for-second-displaypor.patch b/queue-5.15/thunderbolt-use-different-lane-for-second-displaypor.patch
new file mode 100644 (file)
index 0000000..f5c6125
--- /dev/null
@@ -0,0 +1,218 @@
+From 7a6b8e6aa4fe91cbff5cd419ad5c2bfad577ab5a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 1 Apr 2022 17:24:28 +0300
+Subject: thunderbolt: Use different lane for second DisplayPort tunnel
+
+From: Mika Westerberg <mika.westerberg@linux.intel.com>
+
+[ Upstream commit 9d2d0a5cf0ca063f417681cc33e767ce52615286 ]
+
+Brad reported that on Apple hardware with Light Ridge or Falcon Ridge
+controller, plugging in a chain of Thunderbolt displays (Light Ridge
+based controllers) causes all kinds of tearing and flickering. The
+reason for this is that on Thunderbolt 1 hardware there is no lane
+bonding so we have two independent 10 Gb/s lanes, and currently Linux
+tunnels both displays through the lane 1. This makes the displays to
+share the 10 Gb/s bandwidth which may not be enough for higher
+resolutions.
+
+For this reason make the second tunnel go through the lane 0 instead.
+This seems to match what the macOS connection manager is also doing.
+
+Reported-by: Brad Campbell <lists2009@fnarfbargle.com>
+Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Tested-by: Brad Campbell <lists2009@fnarfbargle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/thunderbolt/tb.c     | 19 +++++++++++++++++--
+ drivers/thunderbolt/test.c   | 16 ++++++++--------
+ drivers/thunderbolt/tunnel.c | 11 ++++++-----
+ drivers/thunderbolt/tunnel.h |  4 ++--
+ 4 files changed, 33 insertions(+), 17 deletions(-)
+
+diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
+index 2897a77d44c3..b805b6939794 100644
+--- a/drivers/thunderbolt/tb.c
++++ b/drivers/thunderbolt/tb.c
+@@ -851,7 +851,7 @@ static struct tb_port *tb_find_dp_out(struct tb *tb, struct tb_port *in)
+ static void tb_tunnel_dp(struct tb *tb)
+ {
+-      int available_up, available_down, ret;
++      int available_up, available_down, ret, link_nr;
+       struct tb_cm *tcm = tb_priv(tb);
+       struct tb_port *port, *in, *out;
+       struct tb_tunnel *tunnel;
+@@ -896,6 +896,20 @@ static void tb_tunnel_dp(struct tb *tb)
+               return;
+       }
++      /*
++       * This is only applicable to links that are not bonded (so
++       * when Thunderbolt 1 hardware is involved somewhere in the
++       * topology). For these try to share the DP bandwidth between
++       * the two lanes.
++       */
++      link_nr = 1;
++      list_for_each_entry(tunnel, &tcm->tunnel_list, list) {
++              if (tb_tunnel_is_dp(tunnel)) {
++                      link_nr = 0;
++                      break;
++              }
++      }
++
+       /*
+        * DP stream needs the domain to be active so runtime resume
+        * both ends of the tunnel.
+@@ -927,7 +941,8 @@ static void tb_tunnel_dp(struct tb *tb)
+       tb_dbg(tb, "available bandwidth for new DP tunnel %u/%u Mb/s\n",
+              available_up, available_down);
+-      tunnel = tb_tunnel_alloc_dp(tb, in, out, available_up, available_down);
++      tunnel = tb_tunnel_alloc_dp(tb, in, out, link_nr, available_up,
++                                  available_down);
+       if (!tunnel) {
+               tb_port_dbg(out, "could not allocate DP tunnel\n");
+               goto err_reclaim;
+diff --git a/drivers/thunderbolt/test.c b/drivers/thunderbolt/test.c
+index 1f69bab236ee..66b6e665e96f 100644
+--- a/drivers/thunderbolt/test.c
++++ b/drivers/thunderbolt/test.c
+@@ -1348,7 +1348,7 @@ static void tb_test_tunnel_dp(struct kunit *test)
+       in = &host->ports[5];
+       out = &dev->ports[13];
+-      tunnel = tb_tunnel_alloc_dp(NULL, in, out, 0, 0);
++      tunnel = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0);
+       KUNIT_ASSERT_TRUE(test, tunnel != NULL);
+       KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DP);
+       KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in);
+@@ -1394,7 +1394,7 @@ static void tb_test_tunnel_dp_chain(struct kunit *test)
+       in = &host->ports[5];
+       out = &dev4->ports[14];
+-      tunnel = tb_tunnel_alloc_dp(NULL, in, out, 0, 0);
++      tunnel = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0);
+       KUNIT_ASSERT_TRUE(test, tunnel != NULL);
+       KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DP);
+       KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in);
+@@ -1444,7 +1444,7 @@ static void tb_test_tunnel_dp_tree(struct kunit *test)
+       in = &dev2->ports[13];
+       out = &dev5->ports[13];
+-      tunnel = tb_tunnel_alloc_dp(NULL, in, out, 0, 0);
++      tunnel = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0);
+       KUNIT_ASSERT_TRUE(test, tunnel != NULL);
+       KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DP);
+       KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in);
+@@ -1509,7 +1509,7 @@ static void tb_test_tunnel_dp_max_length(struct kunit *test)
+       in = &dev6->ports[13];
+       out = &dev12->ports[13];
+-      tunnel = tb_tunnel_alloc_dp(NULL, in, out, 0, 0);
++      tunnel = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0);
+       KUNIT_ASSERT_TRUE(test, tunnel != NULL);
+       KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DP);
+       KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in);
+@@ -1627,7 +1627,7 @@ static void tb_test_tunnel_port_on_path(struct kunit *test)
+       in = &dev2->ports[13];
+       out = &dev5->ports[13];
+-      dp_tunnel = tb_tunnel_alloc_dp(NULL, in, out, 0, 0);
++      dp_tunnel = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0);
+       KUNIT_ASSERT_TRUE(test, dp_tunnel != NULL);
+       KUNIT_EXPECT_TRUE(test, tb_tunnel_port_on_path(dp_tunnel, in));
+@@ -2009,7 +2009,7 @@ static void tb_test_credit_alloc_dp(struct kunit *test)
+       in = &host->ports[5];
+       out = &dev->ports[14];
+-      tunnel = tb_tunnel_alloc_dp(NULL, in, out, 0, 0);
++      tunnel = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0);
+       KUNIT_ASSERT_TRUE(test, tunnel != NULL);
+       KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)3);
+@@ -2245,7 +2245,7 @@ static struct tb_tunnel *TB_TEST_DP_TUNNEL1(struct kunit *test,
+       in = &host->ports[5];
+       out = &dev->ports[13];
+-      dp_tunnel1 = tb_tunnel_alloc_dp(NULL, in, out, 0, 0);
++      dp_tunnel1 = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0);
+       KUNIT_ASSERT_TRUE(test, dp_tunnel1 != NULL);
+       KUNIT_ASSERT_EQ(test, dp_tunnel1->npaths, (size_t)3);
+@@ -2282,7 +2282,7 @@ static struct tb_tunnel *TB_TEST_DP_TUNNEL2(struct kunit *test,
+       in = &host->ports[6];
+       out = &dev->ports[14];
+-      dp_tunnel2 = tb_tunnel_alloc_dp(NULL, in, out, 0, 0);
++      dp_tunnel2 = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0);
+       KUNIT_ASSERT_TRUE(test, dp_tunnel2 != NULL);
+       KUNIT_ASSERT_EQ(test, dp_tunnel2->npaths, (size_t)3);
+diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c
+index bb5cc480fc9a..bd98c719bf55 100644
+--- a/drivers/thunderbolt/tunnel.c
++++ b/drivers/thunderbolt/tunnel.c
+@@ -843,6 +843,7 @@ struct tb_tunnel *tb_tunnel_discover_dp(struct tb *tb, struct tb_port *in)
+  * @tb: Pointer to the domain structure
+  * @in: DP in adapter port
+  * @out: DP out adapter port
++ * @link_nr: Preferred lane adapter when the link is not bonded
+  * @max_up: Maximum available upstream bandwidth for the DP tunnel (%0
+  *        if not limited)
+  * @max_down: Maximum available downstream bandwidth for the DP tunnel
+@@ -854,8 +855,8 @@ struct tb_tunnel *tb_tunnel_discover_dp(struct tb *tb, struct tb_port *in)
+  * Return: Returns a tb_tunnel on success or NULL on failure.
+  */
+ struct tb_tunnel *tb_tunnel_alloc_dp(struct tb *tb, struct tb_port *in,
+-                                   struct tb_port *out, int max_up,
+-                                   int max_down)
++                                   struct tb_port *out, int link_nr,
++                                   int max_up, int max_down)
+ {
+       struct tb_tunnel *tunnel;
+       struct tb_path **paths;
+@@ -879,21 +880,21 @@ struct tb_tunnel *tb_tunnel_alloc_dp(struct tb *tb, struct tb_port *in,
+       paths = tunnel->paths;
+       path = tb_path_alloc(tb, in, TB_DP_VIDEO_HOPID, out, TB_DP_VIDEO_HOPID,
+-                           1, "Video");
++                           link_nr, "Video");
+       if (!path)
+               goto err_free;
+       tb_dp_init_video_path(path);
+       paths[TB_DP_VIDEO_PATH_OUT] = path;
+       path = tb_path_alloc(tb, in, TB_DP_AUX_TX_HOPID, out,
+-                           TB_DP_AUX_TX_HOPID, 1, "AUX TX");
++                           TB_DP_AUX_TX_HOPID, link_nr, "AUX TX");
+       if (!path)
+               goto err_free;
+       tb_dp_init_aux_path(path);
+       paths[TB_DP_AUX_PATH_OUT] = path;
+       path = tb_path_alloc(tb, out, TB_DP_AUX_RX_HOPID, in,
+-                           TB_DP_AUX_RX_HOPID, 1, "AUX RX");
++                           TB_DP_AUX_RX_HOPID, link_nr, "AUX RX");
+       if (!path)
+               goto err_free;
+       tb_dp_init_aux_path(path);
+diff --git a/drivers/thunderbolt/tunnel.h b/drivers/thunderbolt/tunnel.h
+index eea14e24f7e0..a92027431697 100644
+--- a/drivers/thunderbolt/tunnel.h
++++ b/drivers/thunderbolt/tunnel.h
+@@ -69,8 +69,8 @@ struct tb_tunnel *tb_tunnel_alloc_pci(struct tb *tb, struct tb_port *up,
+                                     struct tb_port *down);
+ struct tb_tunnel *tb_tunnel_discover_dp(struct tb *tb, struct tb_port *in);
+ struct tb_tunnel *tb_tunnel_alloc_dp(struct tb *tb, struct tb_port *in,
+-                                   struct tb_port *out, int max_up,
+-                                   int max_down);
++                                   struct tb_port *out, int link_nr,
++                                   int max_up, int max_down);
+ struct tb_tunnel *tb_tunnel_alloc_dma(struct tb *tb, struct tb_port *nhi,
+                                     struct tb_port *dst, int transmit_path,
+                                     int transmit_ring, int receive_path,
+-- 
+2.35.1
+
diff --git a/queue-5.15/tty-fix-a-possible-resource-leak-in-icom_probe.patch b/queue-5.15/tty-fix-a-possible-resource-leak-in-icom_probe.patch
new file mode 100644 (file)
index 0000000..4e63c83
--- /dev/null
@@ -0,0 +1,37 @@
+From 6a8e675c0d4c8d6ec1b025aebbeccf9cff45c054 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 31 Mar 2022 17:10:05 +0800
+Subject: tty: Fix a possible resource leak in icom_probe
+
+From: Huang Guobin <huangguobin4@huawei.com>
+
+[ Upstream commit ee157a79e7c82b01ae4c25de0ac75899801f322c ]
+
+When pci_read_config_dword failed, call pci_release_regions() and
+pci_disable_device() to recycle the resource previously allocated.
+
+Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
+Signed-off-by: Huang Guobin <huangguobin4@huawei.com>
+Link: https://lore.kernel.org/r/20220331091005.3290753-1-huangguobin4@huawei.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/tty/serial/icom.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/tty/serial/icom.c b/drivers/tty/serial/icom.c
+index 03a2fe9f4c9a..02b375ba2f07 100644
+--- a/drivers/tty/serial/icom.c
++++ b/drivers/tty/serial/icom.c
+@@ -1501,7 +1501,7 @@ static int icom_probe(struct pci_dev *dev,
+       retval = pci_read_config_dword(dev, PCI_COMMAND, &command_reg);
+       if (retval) {
+               dev_err(&dev->dev, "PCI Config read FAILED\n");
+-              return retval;
++              goto probe_exit0;
+       }
+       pci_write_config_dword(dev, PCI_COMMAND,
+-- 
+2.35.1
+
diff --git a/queue-5.15/tty-synclink_gt-fix-null-pointer-dereference-in-slgt.patch b/queue-5.15/tty-synclink_gt-fix-null-pointer-dereference-in-slgt.patch
new file mode 100644 (file)
index 0000000..71f2e7b
--- /dev/null
@@ -0,0 +1,47 @@
+From c3b96f04d0a4a538346cbc9aa8dfdbf9360a6d1b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 10 Apr 2022 19:48:14 +0800
+Subject: tty: synclink_gt: Fix null-pointer-dereference in slgt_clean()
+
+From: Zheyu Ma <zheyuma97@gmail.com>
+
+[ Upstream commit 689ca31c542687709ba21ec2195c1fbce34fd029 ]
+
+When the driver fails at alloc_hdlcdev(), and then we remove the driver
+module, we will get the following splat:
+
+[   25.065966] general protection fault, probably for non-canonical address 0xdffffc0000000182: 0000 [#1] PREEMPT SMP KASAN PTI
+[   25.066914] KASAN: null-ptr-deref in range [0x0000000000000c10-0x0000000000000c17]
+[   25.069262] RIP: 0010:detach_hdlc_protocol+0x2a/0x3e0
+[   25.077709] Call Trace:
+[   25.077924]  <TASK>
+[   25.078108]  unregister_hdlc_device+0x16/0x30
+[   25.078481]  slgt_cleanup+0x157/0x9f0 [synclink_gt]
+
+Fix this by checking whether the 'info->netdev' is a null pointer first.
+
+Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
+Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
+Link: https://lore.kernel.org/r/20220410114814.3920474-1-zheyuma97@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/tty/synclink_gt.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c
+index 25c558e65ece..9bc2a9265277 100644
+--- a/drivers/tty/synclink_gt.c
++++ b/drivers/tty/synclink_gt.c
+@@ -1746,6 +1746,8 @@ static int hdlcdev_init(struct slgt_info *info)
+  */
+ static void hdlcdev_exit(struct slgt_info *info)
+ {
++      if (!info->netdev)
++              return;
+       unregister_hdlc_device(info->netdev);
+       free_netdev(info->netdev);
+       info->netdev = NULL;
+-- 
+2.35.1
+
diff --git a/queue-5.15/um-line-use-separate-irqs-per-line.patch b/queue-5.15/um-line-use-separate-irqs-per-line.patch
new file mode 100644 (file)
index 0000000..1642d7a
--- /dev/null
@@ -0,0 +1,252 @@
+From d4aad427e1afe7774eba7316e5f884cc9e6d39b9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 6 May 2022 15:46:12 +0200
+Subject: um: line: Use separate IRQs per line
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+[ Upstream commit d5a9597d6916a76663085db984cb8fe97f0a5c56 ]
+
+Today, all possible serial lines (ssl*=) as well as all
+possible consoles (con*=) each share a single interrupt
+(with a fixed number) with others of the same type.
+
+Now, if you have two lines, say ssl0 and ssl1, and one
+of them is connected to an fd you cannot read (e.g. a
+file), but the other gets a read interrupt, then both
+of them get the interrupt since it's shared. Then, the
+read() call will return EOF, since it's a file being
+written and there's nothing to read (at least not at
+the current offset, at the end).
+
+Unfortunately, this is treated as a read error, and we
+close this line, losing all the possible output.
+
+It might be possible to work around this and make the
+IRQ sharing work, however, now that we have dynamically
+allocated IRQs that are easy to use, simply use that to
+achieve separating between the events; then there's no
+interrupt for that line and we never attempt the read
+in the first place, thus not closing the line.
+
+This manifested itself in the wifi hostap/hwsim tests
+where the parallel script communicates via one serial
+console and the kernel messages go to another (a file)
+and sending data on the communication console caused
+the kernel messages to stop flowing into the file.
+
+Reported-by: Jouni Malinen <j@w1.fi>
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Acked-By: anton ivanov <anton.ivanov@cambridgegreys.com>
+Signed-off-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/um/drivers/chan_kern.c     | 10 +++++-----
+ arch/um/drivers/line.c          | 22 +++++++++++++---------
+ arch/um/drivers/line.h          |  4 ++--
+ arch/um/drivers/ssl.c           |  2 --
+ arch/um/drivers/stdio_console.c |  2 --
+ arch/um/include/asm/irq.h       | 22 +++++++++-------------
+ 6 files changed, 29 insertions(+), 33 deletions(-)
+
+diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
+index 62997055c454..26a702a06515 100644
+--- a/arch/um/drivers/chan_kern.c
++++ b/arch/um/drivers/chan_kern.c
+@@ -133,7 +133,7 @@ static void line_timer_cb(struct work_struct *work)
+       struct line *line = container_of(work, struct line, task.work);
+       if (!line->throttled)
+-              chan_interrupt(line, line->driver->read_irq);
++              chan_interrupt(line, line->read_irq);
+ }
+ int enable_chan(struct line *line)
+@@ -195,9 +195,9 @@ void free_irqs(void)
+               chan = list_entry(ele, struct chan, free_list);
+               if (chan->input && chan->enabled)
+-                      um_free_irq(chan->line->driver->read_irq, chan);
++                      um_free_irq(chan->line->read_irq, chan);
+               if (chan->output && chan->enabled)
+-                      um_free_irq(chan->line->driver->write_irq, chan);
++                      um_free_irq(chan->line->write_irq, chan);
+               chan->enabled = 0;
+       }
+ }
+@@ -215,9 +215,9 @@ static void close_one_chan(struct chan *chan, int delay_free_irq)
+               spin_unlock_irqrestore(&irqs_to_free_lock, flags);
+       } else {
+               if (chan->input && chan->enabled)
+-                      um_free_irq(chan->line->driver->read_irq, chan);
++                      um_free_irq(chan->line->read_irq, chan);
+               if (chan->output && chan->enabled)
+-                      um_free_irq(chan->line->driver->write_irq, chan);
++                      um_free_irq(chan->line->write_irq, chan);
+               chan->enabled = 0;
+       }
+       if (chan->ops->close != NULL)
+diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
+index 8febf95da96e..02b0befd6763 100644
+--- a/arch/um/drivers/line.c
++++ b/arch/um/drivers/line.c
+@@ -139,7 +139,7 @@ static int flush_buffer(struct line *line)
+               count = line->buffer + LINE_BUFSIZE - line->head;
+               n = write_chan(line->chan_out, line->head, count,
+-                             line->driver->write_irq);
++                             line->write_irq);
+               if (n < 0)
+                       return n;
+               if (n == count) {
+@@ -156,7 +156,7 @@ static int flush_buffer(struct line *line)
+       count = line->tail - line->head;
+       n = write_chan(line->chan_out, line->head, count,
+-                     line->driver->write_irq);
++                     line->write_irq);
+       if (n < 0)
+               return n;
+@@ -195,7 +195,7 @@ int line_write(struct tty_struct *tty, const unsigned char *buf, int len)
+               ret = buffer_data(line, buf, len);
+       else {
+               n = write_chan(line->chan_out, buf, len,
+-                             line->driver->write_irq);
++                             line->write_irq);
+               if (n < 0) {
+                       ret = n;
+                       goto out_up;
+@@ -215,7 +215,7 @@ void line_throttle(struct tty_struct *tty)
+ {
+       struct line *line = tty->driver_data;
+-      deactivate_chan(line->chan_in, line->driver->read_irq);
++      deactivate_chan(line->chan_in, line->read_irq);
+       line->throttled = 1;
+ }
+@@ -224,7 +224,7 @@ void line_unthrottle(struct tty_struct *tty)
+       struct line *line = tty->driver_data;
+       line->throttled = 0;
+-      chan_interrupt(line, line->driver->read_irq);
++      chan_interrupt(line, line->read_irq);
+ }
+ static irqreturn_t line_write_interrupt(int irq, void *data)
+@@ -260,19 +260,23 @@ int line_setup_irq(int fd, int input, int output, struct line *line, void *data)
+       int err;
+       if (input) {
+-              err = um_request_irq(driver->read_irq, fd, IRQ_READ,
+-                                   line_interrupt, IRQF_SHARED,
++              err = um_request_irq(UM_IRQ_ALLOC, fd, IRQ_READ,
++                                   line_interrupt, 0,
+                                    driver->read_irq_name, data);
+               if (err < 0)
+                       return err;
++
++              line->read_irq = err;
+       }
+       if (output) {
+-              err = um_request_irq(driver->write_irq, fd, IRQ_WRITE,
+-                                   line_write_interrupt, IRQF_SHARED,
++              err = um_request_irq(UM_IRQ_ALLOC, fd, IRQ_WRITE,
++                                   line_write_interrupt, 0,
+                                    driver->write_irq_name, data);
+               if (err < 0)
+                       return err;
++
++              line->write_irq = err;
+       }
+       return 0;
+diff --git a/arch/um/drivers/line.h b/arch/um/drivers/line.h
+index bdb16b96e76f..f15be75a3bf3 100644
+--- a/arch/um/drivers/line.h
++++ b/arch/um/drivers/line.h
+@@ -23,9 +23,7 @@ struct line_driver {
+       const short minor_start;
+       const short type;
+       const short subtype;
+-      const int read_irq;
+       const char *read_irq_name;
+-      const int write_irq;
+       const char *write_irq_name;
+       struct mc_device mc;
+       struct tty_driver *driver;
+@@ -35,6 +33,8 @@ struct line {
+       struct tty_port port;
+       int valid;
++      int read_irq, write_irq;
++
+       char *init_str;
+       struct list_head chan_list;
+       struct chan *chan_in, *chan_out;
+diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c
+index 41eae2e8fb65..8514966778d5 100644
+--- a/arch/um/drivers/ssl.c
++++ b/arch/um/drivers/ssl.c
+@@ -47,9 +47,7 @@ static struct line_driver driver = {
+       .minor_start            = 64,
+       .type                   = TTY_DRIVER_TYPE_SERIAL,
+       .subtype                = 0,
+-      .read_irq               = SSL_IRQ,
+       .read_irq_name          = "ssl",
+-      .write_irq              = SSL_WRITE_IRQ,
+       .write_irq_name         = "ssl-write",
+       .mc  = {
+               .list           = LIST_HEAD_INIT(driver.mc.list),
+diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c
+index e8b762f4d8c2..489d5a746ed3 100644
+--- a/arch/um/drivers/stdio_console.c
++++ b/arch/um/drivers/stdio_console.c
+@@ -53,9 +53,7 @@ static struct line_driver driver = {
+       .minor_start            = 0,
+       .type                   = TTY_DRIVER_TYPE_CONSOLE,
+       .subtype                = SYSTEM_TYPE_CONSOLE,
+-      .read_irq               = CONSOLE_IRQ,
+       .read_irq_name          = "console",
+-      .write_irq              = CONSOLE_WRITE_IRQ,
+       .write_irq_name         = "console-write",
+       .mc  = {
+               .list           = LIST_HEAD_INIT(driver.mc.list),
+diff --git a/arch/um/include/asm/irq.h b/arch/um/include/asm/irq.h
+index e187c789369d..749dfe8512e8 100644
+--- a/arch/um/include/asm/irq.h
++++ b/arch/um/include/asm/irq.h
+@@ -4,19 +4,15 @@
+ #define TIMER_IRQ             0
+ #define UMN_IRQ                       1
+-#define CONSOLE_IRQ           2
+-#define CONSOLE_WRITE_IRQ     3
+-#define UBD_IRQ                       4
+-#define UM_ETH_IRQ            5
+-#define SSL_IRQ                       6
+-#define SSL_WRITE_IRQ         7
+-#define ACCEPT_IRQ            8
+-#define MCONSOLE_IRQ          9
+-#define WINCH_IRQ             10
+-#define SIGIO_WRITE_IRQ       11
+-#define TELNETD_IRQ           12
+-#define XTERM_IRQ             13
+-#define RANDOM_IRQ            14
++#define UBD_IRQ                       2
++#define UM_ETH_IRQ            3
++#define ACCEPT_IRQ            4
++#define MCONSOLE_IRQ          5
++#define WINCH_IRQ             6
++#define SIGIO_WRITE_IRQ       7
++#define TELNETD_IRQ           8
++#define XTERM_IRQ             9
++#define RANDOM_IRQ            10
+ #ifdef CONFIG_UML_NET_VECTOR
+-- 
+2.35.1
+
diff --git a/queue-5.15/usb-dwc2-gadget-don-t-reset-gadget-s-driver-bus.patch b/queue-5.15/usb-dwc2-gadget-don-t-reset-gadget-s-driver-bus.patch
new file mode 100644 (file)
index 0000000..4102ae2
--- /dev/null
@@ -0,0 +1,66 @@
+From 68c341ee7f1dab4753dd9e281c7a18565705ccbb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 5 May 2022 12:46:18 +0200
+Subject: usb: dwc2: gadget: don't reset gadget's driver->bus
+
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+
+[ Upstream commit 3120aac6d0ecd9accf56894aeac0e265f74d3d5a ]
+
+UDC driver should not touch gadget's driver internals, especially it
+should not reset driver->bus. This wasn't harmful so far, but since
+commit fc274c1e9973 ("USB: gadget: Add a new bus for gadgets") gadget
+subsystem got it's own bus and messing with ->bus triggers the
+following NULL pointer dereference:
+
+dwc2 12480000.hsotg: bound driver g_ether
+8<--- cut here ---
+Unable to handle kernel NULL pointer dereference at virtual address 00000000
+[00000000] *pgd=00000000
+Internal error: Oops: 5 [#1] SMP ARM
+Modules linked in: ...
+CPU: 0 PID: 620 Comm: modprobe Not tainted 5.18.0-rc5-next-20220504 #11862
+Hardware name: Samsung Exynos (Flattened Device Tree)
+PC is at module_add_driver+0x44/0xe8
+LR is at sysfs_do_create_link_sd+0x84/0xe0
+...
+Process modprobe (pid: 620, stack limit = 0x(ptrval))
+...
+ module_add_driver from bus_add_driver+0xf4/0x1e4
+ bus_add_driver from driver_register+0x78/0x10c
+ driver_register from usb_gadget_register_driver_owner+0x40/0xb4
+ usb_gadget_register_driver_owner from do_one_initcall+0x44/0x1e0
+ do_one_initcall from do_init_module+0x44/0x1c8
+ do_init_module from load_module+0x19b8/0x1b9c
+ load_module from sys_finit_module+0xdc/0xfc
+ sys_finit_module from ret_fast_syscall+0x0/0x54
+Exception stack(0xf1771fa8 to 0xf1771ff0)
+...
+dwc2 12480000.hsotg: new device is high-speed
+---[ end trace 0000000000000000 ]---
+
+Fix this by removing driver->bus entry reset.
+
+Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
+Link: https://lore.kernel.org/r/20220505104618.22729-1-m.szyprowski@samsung.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/usb/dwc2/gadget.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
+index 0909b088a284..e1cebf581a4a 100644
+--- a/drivers/usb/dwc2/gadget.c
++++ b/drivers/usb/dwc2/gadget.c
+@@ -4544,7 +4544,6 @@ static int dwc2_hsotg_udc_start(struct usb_gadget *gadget,
+       WARN_ON(hsotg->driver);
+-      driver->driver.bus = NULL;
+       hsotg->driver = driver;
+       hsotg->gadget.dev.of_node = hsotg->dev->of_node;
+       hsotg->gadget.speed = USB_SPEED_UNKNOWN;
+-- 
+2.35.1
+
diff --git a/queue-5.15/usb-hcd-pci-fully-suspend-across-freeze-thaw-cycle.patch b/queue-5.15/usb-hcd-pci-fully-suspend-across-freeze-thaw-cycle.patch
new file mode 100644 (file)
index 0000000..0afa5bf
--- /dev/null
@@ -0,0 +1,50 @@
+From 30efb420a01e4ef48190afffefeddf260868e957 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 21 Apr 2022 10:39:27 -0700
+Subject: USB: hcd-pci: Fully suspend across freeze/thaw cycle
+
+From: Evan Green <evgreen@chromium.org>
+
+[ Upstream commit 63acaa8e9c65dc34dc249440216f8e977f5d2748 ]
+
+The documentation for the freeze() method says that it "should quiesce
+the device so that it doesn't generate IRQs or DMA". The unspoken
+consequence of not doing this is that MSIs aimed at non-boot CPUs may
+get fully lost if they're sent during the period where the target CPU is
+offline.
+
+The current callbacks for USB HCD do not fully quiesce interrupts,
+specifically on XHCI. Change to use the full suspend/resume flow for
+freeze/thaw to ensure interrupts are fully quiesced. This fixes issues
+where USB devices fail to thaw during hibernation because XHCI misses
+its interrupt and cannot recover.
+
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Evan Green <evgreen@chromium.org>
+Link: https://lore.kernel.org/r/20220421103751.v3.2.I8226c7fdae88329ef70957b96a39b346c69a914e@changeid
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/usb/core/hcd-pci.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
+index d630cccd2e6e..5af810cd8a58 100644
+--- a/drivers/usb/core/hcd-pci.c
++++ b/drivers/usb/core/hcd-pci.c
+@@ -616,10 +616,10 @@ const struct dev_pm_ops usb_hcd_pci_pm_ops = {
+       .suspend_noirq  = hcd_pci_suspend_noirq,
+       .resume_noirq   = hcd_pci_resume_noirq,
+       .resume         = hcd_pci_resume,
+-      .freeze         = check_root_hub_suspended,
++      .freeze         = hcd_pci_suspend,
+       .freeze_noirq   = check_root_hub_suspended,
+       .thaw_noirq     = NULL,
+-      .thaw           = NULL,
++      .thaw           = hcd_pci_resume,
+       .poweroff       = hcd_pci_suspend,
+       .poweroff_noirq = hcd_pci_suspend_noirq,
+       .restore_noirq  = hcd_pci_resume_noirq,
+-- 
+2.35.1
+
diff --git a/queue-5.15/usb-host-isp116x-check-return-value-after-calling-pl.patch b/queue-5.15/usb-host-isp116x-check-return-value-after-calling-pl.patch
new file mode 100644 (file)
index 0000000..b9ebcb8
--- /dev/null
@@ -0,0 +1,43 @@
+From e9520823efb3344b4d03319bcb2e0d0c3ec0c286 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 2 Mar 2022 11:37:16 +0800
+Subject: USB: host: isp116x: check return value after calling
+ platform_get_resource()
+
+From: Zhen Ni <nizhen@uniontech.com>
+
+[ Upstream commit 134a3408c2d3f7e23eb0e4556e0a2d9f36c2614e ]
+
+It will cause null-ptr-deref if platform_get_resource() returns NULL,
+we need check the return value.
+
+Signed-off-by: Zhen Ni <nizhen@uniontech.com>
+Link: https://lore.kernel.org/r/20220302033716.31272-1-nizhen@uniontech.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/usb/host/isp116x-hcd.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
+index 8835f6bd528e..8c7f0991c21b 100644
+--- a/drivers/usb/host/isp116x-hcd.c
++++ b/drivers/usb/host/isp116x-hcd.c
+@@ -1541,10 +1541,12 @@ static int isp116x_remove(struct platform_device *pdev)
+       iounmap(isp116x->data_reg);
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+-      release_mem_region(res->start, 2);
++      if (res)
++              release_mem_region(res->start, 2);
+       iounmap(isp116x->addr_reg);
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+-      release_mem_region(res->start, 2);
++      if (res)
++              release_mem_region(res->start, 2);
+       usb_put_hcd(hcd);
+       return 0;
+-- 
+2.35.1
+
diff --git a/queue-5.15/watchdog-wdat_wdt-stop-watchdog-when-rebooting-the-s.patch b/queue-5.15/watchdog-wdat_wdt-stop-watchdog-when-rebooting-the-s.patch
new file mode 100644 (file)
index 0000000..f914af0
--- /dev/null
@@ -0,0 +1,48 @@
+From 523fdf978bd7f4d91da052ed233e121b5941b0fb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 26 Apr 2022 22:53:29 +0800
+Subject: watchdog: wdat_wdt: Stop watchdog when rebooting the system
+
+From: Liu Xinpeng <liuxp11@chinatelecom.cn>
+
+[ Upstream commit 27fdf84510a1374748904db43f6755f912736d92 ]
+
+Executing reboot command several times on the machine "Dell
+PowerEdge R740", UEFI security detection stopped machine
+with the following prompt:
+
+UEFI0082: The system was reset due to a timeout from the watchdog
+timer. Check the System Event Log (SEL) or crash dumps from
+Operating Sysstem to identify the source that triggered the
+watchdog timer reset. Update the firmware or driver for the
+identified device.
+
+iDRAC has warning event: "The watchdog timer reset the system".
+
+This patch fixes this issue by adding the reboot notifier.
+
+Signed-off-by: Liu Xinpeng <liuxp11@chinatelecom.cn>
+Reviewed-by: Guenter Roeck <linux@roeck-us.net>
+Link: https://lore.kernel.org/r/1650984810-6247-3-git-send-email-liuxp11@chinatelecom.cn
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/watchdog/wdat_wdt.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c
+index 195c8c004b69..4fac8148a8e6 100644
+--- a/drivers/watchdog/wdat_wdt.c
++++ b/drivers/watchdog/wdat_wdt.c
+@@ -462,6 +462,7 @@ static int wdat_wdt_probe(struct platform_device *pdev)
+               return ret;
+       watchdog_set_nowayout(&wdat->wdd, nowayout);
++      watchdog_stop_on_reboot(&wdat->wdd);
+       return devm_watchdog_register_device(dev, &wdat->wdd);
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/x86-cpu-elide-kcsan-for-cpu_has-and-friends.patch b/queue-5.15/x86-cpu-elide-kcsan-for-cpu_has-and-friends.patch
new file mode 100644 (file)
index 0000000..3c5685b
--- /dev/null
@@ -0,0 +1,50 @@
+From 5a501b0be988b2e0ce7aa7614fbf8475e5bbc6f0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 2 May 2022 12:15:23 +0200
+Subject: x86/cpu: Elide KCSAN for cpu_has() and friends
+
+From: Peter Zijlstra <peterz@infradead.org>
+
+[ Upstream commit a6a5eb269f6f3a2fe392f725a8d9052190c731e2 ]
+
+As x86 uses the <asm-generic/bitops/instrumented-*.h> headers, the
+regular forms of all bitops are instrumented with explicit calls to
+KASAN and KCSAN checks. As these are explicit calls, these are not
+suppressed by the noinstr function attribute.
+
+This can result in calls to those check functions in noinstr code, which
+objtool warns about:
+
+vmlinux.o: warning: objtool: enter_from_user_mode+0x24: call to __kcsan_check_access() leaves .noinstr.text section
+vmlinux.o: warning: objtool: syscall_enter_from_user_mode+0x28: call to __kcsan_check_access() leaves .noinstr.text section
+vmlinux.o: warning: objtool: syscall_enter_from_user_mode_prepare+0x24: call to __kcsan_check_access() leaves .noinstr.text section
+vmlinux.o: warning: objtool: irqentry_enter_from_user_mode+0x24: call to __kcsan_check_access() leaves .noinstr.text section
+
+Prevent this by using the arch_*() bitops, which are the underlying
+bitops without explciit instrumentation.
+
+[null: Changelog]
+Reported-by: kernel test robot <lkp@intel.com>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Link: https://lkml.kernel.org/r/20220502111216.290518605@infradead.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/include/asm/cpufeature.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
+index 16a51e7288d5..b0f206681fde 100644
+--- a/arch/x86/include/asm/cpufeature.h
++++ b/arch/x86/include/asm/cpufeature.h
+@@ -51,7 +51,7 @@ extern const char * const x86_power_flags[32];
+ extern const char * const x86_bug_flags[NBUGINTS*32];
+ #define test_cpu_cap(c, bit)                                          \
+-       test_bit(bit, (unsigned long *)((c)->x86_capability))
++       arch_test_bit(bit, (unsigned long *)((c)->x86_capability))
+ /*
+  * There are 32 bits/features in each mask word.  The high bits
+-- 
+2.35.1
+