]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 May 2024 15:56:04 +0000 (17:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 May 2024 15:56:04 +0000 (17:56 +0200)
added patches:
mfd-stpmic1-fix-swapped-mask-unmask-in-irq-chip.patch
nfsd-don-t-allow-nfsd-threads-to-be-signalled.patch
pinctrl-core-handle-radix_tree_insert-errors-in-pinctrl_register_one_pin.patch

queue-6.1/mfd-stpmic1-fix-swapped-mask-unmask-in-irq-chip.patch [new file with mode: 0644]
queue-6.1/nfsd-don-t-allow-nfsd-threads-to-be-signalled.patch [new file with mode: 0644]
queue-6.1/pinctrl-core-handle-radix_tree_insert-errors-in-pinctrl_register_one_pin.patch [new file with mode: 0644]
queue-6.1/series

diff --git a/queue-6.1/mfd-stpmic1-fix-swapped-mask-unmask-in-irq-chip.patch b/queue-6.1/mfd-stpmic1-fix-swapped-mask-unmask-in-irq-chip.patch
new file mode 100644 (file)
index 0000000..cedba93
--- /dev/null
@@ -0,0 +1,55 @@
+From c79e387389d5add7cb967d2f7622c3bf5550927b Mon Sep 17 00:00:00 2001
+From: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
+Date: Sat, 12 Nov 2022 15:18:32 +0000
+Subject: mfd: stpmic1: Fix swapped mask/unmask in irq chip
+
+From: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
+
+commit c79e387389d5add7cb967d2f7622c3bf5550927b upstream.
+
+The usual behavior of mask registers is writing a '1' bit to
+disable (mask) an interrupt; similarly, writing a '1' bit to
+an unmask register enables (unmasks) an interrupt.
+
+Due to a longstanding issue in regmap-irq, mask and unmask
+registers were inverted when both kinds of registers were
+present on the same chip, ie. regmap-irq actually wrote '1's
+to the mask register to enable an IRQ and '1's to the unmask
+register to disable an IRQ.
+
+This was fixed by commit e8ffb12e7f06 ("regmap-irq: Fix
+inverted handling of unmask registers") but the fix is opt-in
+via mask_unmask_non_inverted = true because it requires manual
+changes for each affected driver. The new behavior will become
+the default once all drivers have been updated.
+
+The STPMIC1 has a normal mask register with separate set and
+clear registers. The driver intends to use the set & clear
+registers with regmap-irq and has compensated for regmap-irq's
+inverted behavior, and should currently be working properly.
+Thus, swap mask_base and unmask_base, and opt in to the new
+non-inverted behavior.
+
+Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
+Signed-off-by: Lee Jones <lee@kernel.org>
+Link: https://lore.kernel.org/r/20221112151835.39059-16-aidanmacdonald.0x0@gmail.com
+Cc: Yoann Congal <yoann.congal@smile.fr>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mfd/stpmic1.c |    5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/mfd/stpmic1.c
++++ b/drivers/mfd/stpmic1.c
+@@ -108,8 +108,9 @@ static const struct regmap_irq stpmic1_i
+ static const struct regmap_irq_chip stpmic1_regmap_irq_chip = {
+       .name = "pmic_irq",
+       .status_base = INT_PENDING_R1,
+-      .mask_base = INT_CLEAR_MASK_R1,
+-      .unmask_base = INT_SET_MASK_R1,
++      .mask_base = INT_SET_MASK_R1,
++      .unmask_base = INT_CLEAR_MASK_R1,
++      .mask_unmask_non_inverted = true,
+       .ack_base = INT_CLEAR_R1,
+       .num_regs = STPMIC1_PMIC_NUM_IRQ_REGS,
+       .irqs = stpmic1_irqs,
diff --git a/queue-6.1/nfsd-don-t-allow-nfsd-threads-to-be-signalled.patch b/queue-6.1/nfsd-don-t-allow-nfsd-threads-to-be-signalled.patch
new file mode 100644 (file)
index 0000000..d26c0f6
--- /dev/null
@@ -0,0 +1,165 @@
+From 3903902401451b1cd9d797a8c79769eb26ac7fe5 Mon Sep 17 00:00:00 2001
+From: NeilBrown <neilb@suse.de>
+Date: Tue, 18 Jul 2023 16:38:08 +1000
+Subject: nfsd: don't allow nfsd threads to be signalled.
+
+From: NeilBrown <neilb@suse.de>
+
+commit 3903902401451b1cd9d797a8c79769eb26ac7fe5 upstream.
+
+The original implementation of nfsd used signals to stop threads during
+shutdown.
+In Linux 2.3.46pre5 nfsd gained the ability to shutdown threads
+internally it if was asked to run "0" threads.  After this user-space
+transitioned to using "rpc.nfsd 0" to stop nfsd and sending signals to
+threads was no longer an important part of the API.
+
+In commit 3ebdbe5203a8 ("SUNRPC: discard svo_setup and rename
+svc_set_num_threads_sync()") (v5.17-rc1~75^2~41) we finally removed the
+use of signals for stopping threads, using kthread_stop() instead.
+
+This patch makes the "obvious" next step and removes the ability to
+signal nfsd threads - or any svc threads.  nfsd stops allowing signals
+and we don't check for their delivery any more.
+
+This will allow for some simplification in later patches.
+
+A change worth noting is in nfsd4_ssc_setup_dul().  There was previously
+a signal_pending() check which would only succeed when the thread was
+being shut down.  It should really have tested kthread_should_stop() as
+well.  Now it just does the latter, not the former.
+
+Signed-off-by: NeilBrown <neilb@suse.de>
+Reviewed-by: Jeff Layton <jlayton@kernel.org>
+Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/nfs/callback.c     |    9 +--------
+ fs/nfsd/nfs4proc.c    |    5 ++---
+ fs/nfsd/nfssvc.c      |   12 ------------
+ net/sunrpc/svc_xprt.c |   16 ++++++----------
+ 4 files changed, 9 insertions(+), 33 deletions(-)
+
+--- a/fs/nfs/callback.c
++++ b/fs/nfs/callback.c
+@@ -80,9 +80,6 @@ nfs4_callback_svc(void *vrqstp)
+       set_freezable();
+       while (!kthread_freezable_should_stop(NULL)) {
+-
+-              if (signal_pending(current))
+-                      flush_signals(current);
+               /*
+                * Listen for a request on the socket
+                */
+@@ -112,11 +109,7 @@ nfs41_callback_svc(void *vrqstp)
+       set_freezable();
+       while (!kthread_freezable_should_stop(NULL)) {
+-
+-              if (signal_pending(current))
+-                      flush_signals(current);
+-
+-              prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_INTERRUPTIBLE);
++              prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_IDLE);
+               spin_lock_bh(&serv->sv_cb_lock);
+               if (!list_empty(&serv->sv_cb_list)) {
+                       req = list_first_entry(&serv->sv_cb_list,
+--- a/fs/nfsd/nfs4proc.c
++++ b/fs/nfsd/nfs4proc.c
+@@ -1313,12 +1313,11 @@ try_again:
+               /* found a match */
+               if (ni->nsui_busy) {
+                       /*  wait - and try again */
+-                      prepare_to_wait(&nn->nfsd_ssc_waitq, &wait,
+-                              TASK_INTERRUPTIBLE);
++                      prepare_to_wait(&nn->nfsd_ssc_waitq, &wait, TASK_IDLE);
+                       spin_unlock(&nn->nfsd_ssc_lock);
+                       /* allow 20secs for mount/unmount for now - revisit */
+-                      if (signal_pending(current) ||
++                      if (kthread_should_stop() ||
+                                       (schedule_timeout(20*HZ) == 0)) {
+                               finish_wait(&nn->nfsd_ssc_waitq, &wait);
+                               kfree(work);
+--- a/fs/nfsd/nfssvc.c
++++ b/fs/nfsd/nfssvc.c
+@@ -952,15 +952,6 @@ nfsd(void *vrqstp)
+       current->fs->umask = 0;
+-      /*
+-       * thread is spawned with all signals set to SIG_IGN, re-enable
+-       * the ones that will bring down the thread
+-       */
+-      allow_signal(SIGKILL);
+-      allow_signal(SIGHUP);
+-      allow_signal(SIGINT);
+-      allow_signal(SIGQUIT);
+-
+       atomic_inc(&nfsdstats.th_cnt);
+       set_freezable();
+@@ -985,9 +976,6 @@ nfsd(void *vrqstp)
+               validate_process_creds();
+       }
+-      /* Clear signals before calling svc_exit_thread() */
+-      flush_signals(current);
+-
+       atomic_dec(&nfsdstats.th_cnt);
+ out:
+--- a/net/sunrpc/svc_xprt.c
++++ b/net/sunrpc/svc_xprt.c
+@@ -696,8 +696,8 @@ static int svc_alloc_arg(struct svc_rqst
+                       /* Made progress, don't sleep yet */
+                       continue;
+-              set_current_state(TASK_INTERRUPTIBLE);
+-              if (signalled() || kthread_should_stop()) {
++              set_current_state(TASK_IDLE);
++              if (kthread_should_stop()) {
+                       set_current_state(TASK_RUNNING);
+                       return -EINTR;
+               }
+@@ -733,7 +733,7 @@ rqst_should_sleep(struct svc_rqst *rqstp
+               return false;
+       /* are we shutting down? */
+-      if (signalled() || kthread_should_stop())
++      if (kthread_should_stop())
+               return false;
+       /* are we freezing? */
+@@ -755,11 +755,7 @@ static struct svc_xprt *svc_get_next_xpr
+       if (rqstp->rq_xprt)
+               goto out_found;
+-      /*
+-       * We have to be able to interrupt this wait
+-       * to bring down the daemons ...
+-       */
+-      set_current_state(TASK_INTERRUPTIBLE);
++      set_current_state(TASK_IDLE);
+       smp_mb__before_atomic();
+       clear_bit(SP_CONGESTED, &pool->sp_flags);
+       clear_bit(RQ_BUSY, &rqstp->rq_flags);
+@@ -781,7 +777,7 @@ static struct svc_xprt *svc_get_next_xpr
+       if (!time_left)
+               atomic_long_inc(&pool->sp_stats.threads_timedout);
+-      if (signalled() || kthread_should_stop())
++      if (kthread_should_stop())
+               return ERR_PTR(-EINTR);
+       return ERR_PTR(-EAGAIN);
+ out_found:
+@@ -879,7 +875,7 @@ int svc_recv(struct svc_rqst *rqstp, lon
+       try_to_freeze();
+       cond_resched();
+       err = -EINTR;
+-      if (signalled() || kthread_should_stop())
++      if (kthread_should_stop())
+               goto out;
+       xprt = svc_get_next_xprt(rqstp, timeout);
diff --git a/queue-6.1/pinctrl-core-handle-radix_tree_insert-errors-in-pinctrl_register_one_pin.patch b/queue-6.1/pinctrl-core-handle-radix_tree_insert-errors-in-pinctrl_register_one_pin.patch
new file mode 100644 (file)
index 0000000..915f249
--- /dev/null
@@ -0,0 +1,66 @@
+From ecfe9a015d3e1e46504d5b3de7eef1f2d186194a Mon Sep 17 00:00:00 2001
+From: Sergey Shtylyov <s.shtylyov@omp.ru>
+Date: Wed, 19 Jul 2023 23:22:52 +0300
+Subject: pinctrl: core: handle radix_tree_insert() errors in pinctrl_register_one_pin()
+
+From: Sergey Shtylyov <s.shtylyov@omp.ru>
+
+commit ecfe9a015d3e1e46504d5b3de7eef1f2d186194a upstream.
+
+pinctrl_register_one_pin() doesn't check the result of radix_tree_insert()
+despite they both may return a negative error code.  Linus Walleij said he
+has copied the radix tree code from kernel/irq/ where the functions calling
+radix_tree_insert() are *void* themselves; I think it makes more sense to
+propagate the errors from radix_tree_insert() upstream if we can do that...
+
+Found by Linux Verification Center (linuxtesting.org) with the Svace static
+analysis tool.
+
+Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
+Link: https://lore.kernel.org/r/20230719202253.13469-3-s.shtylyov@omp.ru
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Cc: "Hemdan, Hagar Gamal Halim" <hagarhem@amazon.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/pinctrl/core.c |   14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+--- a/drivers/pinctrl/core.c
++++ b/drivers/pinctrl/core.c
+@@ -205,6 +205,7 @@ static int pinctrl_register_one_pin(stru
+                                   const struct pinctrl_pin_desc *pin)
+ {
+       struct pin_desc *pindesc;
++      int error;
+       pindesc = pin_desc_get(pctldev, pin->number);
+       if (pindesc) {
+@@ -226,18 +227,25 @@ static int pinctrl_register_one_pin(stru
+       } else {
+               pindesc->name = kasprintf(GFP_KERNEL, "PIN%u", pin->number);
+               if (!pindesc->name) {
+-                      kfree(pindesc);
+-                      return -ENOMEM;
++                      error = -ENOMEM;
++                      goto failed;
+               }
+               pindesc->dynamic_name = true;
+       }
+       pindesc->drv_data = pin->drv_data;
+-      radix_tree_insert(&pctldev->pin_desc_tree, pin->number, pindesc);
++      error = radix_tree_insert(&pctldev->pin_desc_tree, pin->number, pindesc);
++      if (error)
++              goto failed;
++
+       pr_debug("registered pin %d (%s) on %s\n",
+                pin->number, pindesc->name, pctldev->desc->name);
+       return 0;
++
++failed:
++      kfree(pindesc);
++      return error;
+ }
+ static int pinctrl_register_pins(struct pinctrl_dev *pctldev,
index 124fb1ef0b627c1c1c65ec2601b9cc8e98a01923..18d55dd23b0a4ff8997493a0dfdf888c26dc1942 100644 (file)
@@ -2,3 +2,6 @@ drm-amd-display-fix-division-by-zero-in-setup_dsc_config.patch
 net-ks8851-fix-another-tx-stall-caused-by-wrong-isr-flag-handling.patch
 ice-pass-vsi-pointer-into-ice_vc_isvalid_q_id.patch
 ice-remove-unnecessary-duplicate-checks-for-vf-vsi-id.patch
+pinctrl-core-handle-radix_tree_insert-errors-in-pinctrl_register_one_pin.patch
+mfd-stpmic1-fix-swapped-mask-unmask-in-irq-chip.patch
+nfsd-don-t-allow-nfsd-threads-to-be-signalled.patch