]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.4
authorSasha Levin <sashal@kernel.org>
Mon, 13 Feb 2023 06:33:46 +0000 (01:33 -0500)
committerSasha Levin <sashal@kernel.org>
Mon, 13 Feb 2023 06:33:46 +0000 (01:33 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-5.4/pinctrl-aspeed-fix-confusing-types-in-return-value.patch [new file with mode: 0644]
queue-5.4/pinctrl-intel-restore-the-pins-that-used-to-be-in-di.patch [new file with mode: 0644]
queue-5.4/pinctrl-single-fix-potential-null-dereference.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/pinctrl-aspeed-fix-confusing-types-in-return-value.patch b/queue-5.4/pinctrl-aspeed-fix-confusing-types-in-return-value.patch
new file mode 100644 (file)
index 0000000..99c6257
--- /dev/null
@@ -0,0 +1,38 @@
+From 18157423b88aada890784aa89dbc7f1b271bbf6c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 20 Jan 2023 09:48:56 +1030
+Subject: pinctrl: aspeed: Fix confusing types in return value
+
+From: Joel Stanley <joel@jms.id.au>
+
+[ Upstream commit 287a344a11f1ebd31055cf9b22c88d7005f108d7 ]
+
+The function signature is int, but we return a bool. Instead return a
+negative errno as the kerneldoc suggests.
+
+Fixes: 4d3d0e4272d8 ("pinctrl: Add core support for Aspeed SoCs")
+Signed-off-by: Joel Stanley <joel@jms.id.au>
+Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
+Link: https://lore.kernel.org/r/20230119231856.52014-1-joel@jms.id.au
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/aspeed/pinctrl-aspeed.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
+index 22aca6d182c0c..2c1e799b029e7 100644
+--- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c
++++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
+@@ -115,7 +115,7 @@ static int aspeed_disable_sig(struct aspeed_pinmux_data *ctx,
+       int ret = 0;
+       if (!exprs)
+-              return true;
++              return -EINVAL;
+       while (*exprs && !ret) {
+               ret = aspeed_sig_expr_disable(ctx, *exprs);
+-- 
+2.39.0
+
diff --git a/queue-5.4/pinctrl-intel-restore-the-pins-that-used-to-be-in-di.patch b/queue-5.4/pinctrl-intel-restore-the-pins-that-used-to-be-in-di.patch
new file mode 100644 (file)
index 0000000..83d03f0
--- /dev/null
@@ -0,0 +1,69 @@
+From a43aa1d11f0610d6042ecfd3b1d94e557519b14d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 6 Feb 2023 16:15:59 +0200
+Subject: pinctrl: intel: Restore the pins that used to be in Direct IRQ mode
+
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+
+[ Upstream commit a8520be3ffef3d25b53bf171a7ebe17ee0154175 ]
+
+If the firmware mangled the register contents too much,
+check the saved value for the Direct IRQ mode. If it
+matches, we will restore the pin state.
+
+Reported-by: Jim Minter <jimminter@microsoft.com>
+Fixes: 6989ea4881c8 ("pinctrl: intel: Save and restore pins in "direct IRQ" mode")
+Tested-by: Jim Minter <jimminter@microsoft.com>
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Link: https://lore.kernel.org/r/20230206141558.20916-1-andriy.shevchenko@linux.intel.com
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/intel/pinctrl-intel.c | 16 +++++++++++++---
+ 1 file changed, 13 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
+index e0cb76f7e5407..32c6326337f73 100644
+--- a/drivers/pinctrl/intel/pinctrl-intel.c
++++ b/drivers/pinctrl/intel/pinctrl-intel.c
+@@ -1510,6 +1510,12 @@ int intel_pinctrl_probe_by_uid(struct platform_device *pdev)
+ EXPORT_SYMBOL_GPL(intel_pinctrl_probe_by_uid);
+ #ifdef CONFIG_PM_SLEEP
++static bool __intel_gpio_is_direct_irq(u32 value)
++{
++      return (value & PADCFG0_GPIROUTIOXAPIC) && (value & PADCFG0_GPIOTXDIS) &&
++             (__intel_gpio_get_gpio_mode(value) == PADCFG0_PMODE_GPIO);
++}
++
+ static bool intel_pinctrl_should_save(struct intel_pinctrl *pctrl, unsigned int pin)
+ {
+       const struct pin_desc *pd = pin_desc_get(pctrl->pctldev, pin);
+@@ -1543,8 +1549,7 @@ static bool intel_pinctrl_should_save(struct intel_pinctrl *pctrl, unsigned int
+        * See https://bugzilla.kernel.org/show_bug.cgi?id=214749.
+        */
+       value = readl(intel_get_padcfg(pctrl, pin, PADCFG0));
+-      if ((value & PADCFG0_GPIROUTIOXAPIC) && (value & PADCFG0_GPIOTXDIS) &&
+-          (__intel_gpio_get_gpio_mode(value) == PADCFG0_PMODE_GPIO))
++      if (__intel_gpio_is_direct_irq(value))
+               return true;
+       return false;
+@@ -1656,7 +1661,12 @@ int intel_pinctrl_resume_noirq(struct device *dev)
+               void __iomem *padcfg;
+               u32 val;
+-              if (!intel_pinctrl_should_save(pctrl, desc->number))
++              if (!(intel_pinctrl_should_save(pctrl, desc->number) ||
++                    /*
++                     * If the firmware mangled the register contents too much,
++                     * check the saved value for the Direct IRQ mode.
++                     */
++                    __intel_gpio_is_direct_irq(pads[i].padcfg0)))
+                       continue;
+               padcfg = intel_get_padcfg(pctrl, desc->number, PADCFG0);
+-- 
+2.39.0
+
diff --git a/queue-5.4/pinctrl-single-fix-potential-null-dereference.patch b/queue-5.4/pinctrl-single-fix-potential-null-dereference.patch
new file mode 100644 (file)
index 0000000..4627beb
--- /dev/null
@@ -0,0 +1,41 @@
+From 764b4caada001c713c3a42a6f0e816b214b6b44a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 18 Nov 2022 13:43:32 +0300
+Subject: pinctrl: single: fix potential NULL dereference
+
+From: Maxim Korotkov <korotkov.maxim.s@gmail.com>
+
+[ Upstream commit d2d73e6d4822140445ad4a7b1c6091e0f5fe703b ]
+
+Added checking of pointer "function" in pcs_set_mux().
+pinmux_generic_get_function() can return NULL and the pointer
+"function" was dereferenced without checking against NULL.
+
+Found by Linux Verification Center (linuxtesting.org) with SVACE.
+
+Fixes: 571aec4df5b7 ("pinctrl: single: Use generic pinmux helpers for managing functions")
+Signed-off-by: Maxim Korotkov <korotkov.maxim.s@gmail.com>
+Reviewed-by: Tony Lindgren <tony@atomide.com>
+Link: https://lore.kernel.org/r/20221118104332.943-1-korotkov.maxim.s@gmail.com
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/pinctrl-single.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
+index 20c89023d312e..ce5be6f0b7aac 100644
+--- a/drivers/pinctrl/pinctrl-single.c
++++ b/drivers/pinctrl/pinctrl-single.c
+@@ -345,6 +345,8 @@ static int pcs_set_mux(struct pinctrl_dev *pctldev, unsigned fselector,
+       if (!pcs->fmask)
+               return 0;
+       function = pinmux_generic_get_function(pctldev, fselector);
++      if (!function)
++              return -EINVAL;
+       func = function->data;
+       if (!func)
+               return -EINVAL;
+-- 
+2.39.0
+
index 5aabe98da1d249c5db8a5577688ac78d1d09c362..df62223336bfdd3ccb4b484f799b9f1ba20a6ab1 100644 (file)
@@ -74,3 +74,6 @@ ice-do-not-use-wq_mem_reclaim-flag-for-workqueue.patch
 rds-rds_rm_zerocopy_callback-use-list_first_entry.patch
 selftests-forwarding-lib-quote-the-sysctl-values.patch
 alsa-pci-lx6464es-fix-a-debug-loop.patch
+pinctrl-aspeed-fix-confusing-types-in-return-value.patch
+pinctrl-single-fix-potential-null-dereference.patch
+pinctrl-intel-restore-the-pins-that-used-to-be-in-di.patch