]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.4
authorSasha Levin <sashal@kernel.org>
Mon, 26 Jun 2023 13:00:42 +0000 (09:00 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 26 Jun 2023 13:00:42 +0000 (09:00 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-5.4/i2c-imx-lpi2c-fix-type-char-overflow-issue-when-calc.patch [new file with mode: 0644]
queue-5.4/series
queue-5.4/x86-apic-fix-kernel-panic-when-booting-with-intremap.patch [new file with mode: 0644]

diff --git a/queue-5.4/i2c-imx-lpi2c-fix-type-char-overflow-issue-when-calc.patch b/queue-5.4/i2c-imx-lpi2c-fix-type-char-overflow-issue-when-calc.patch
new file mode 100644 (file)
index 0000000..2c9db05
--- /dev/null
@@ -0,0 +1,41 @@
+From 0c79dc49844ff9af0a67bdce05ba31da5b214f44 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 29 May 2023 16:02:51 +0800
+Subject: i2c: imx-lpi2c: fix type char overflow issue when calculating the
+ clock cycle
+
+From: Clark Wang <xiaoning.wang@nxp.com>
+
+[ Upstream commit e69b9bc170c6d93ee375a5cbfd15f74c0fb59bdd ]
+
+Claim clkhi and clklo as integer type to avoid possible calculation
+errors caused by data overflow.
+
+Fixes: a55fa9d0e42e ("i2c: imx-lpi2c: add low power i2c bus driver")
+Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
+Signed-off-by: Carlos Song <carlos.song@nxp.com>
+Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
+Signed-off-by: Wolfram Sang <wsa@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/i2c/busses/i2c-imx-lpi2c.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
+index 4fac2591b6618..89faef6f013b4 100644
+--- a/drivers/i2c/busses/i2c-imx-lpi2c.c
++++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
+@@ -206,8 +206,8 @@ static void lpi2c_imx_stop(struct lpi2c_imx_struct *lpi2c_imx)
+ /* CLKLO = I2C_CLK_RATIO * CLKHI, SETHOLD = CLKHI, DATAVD = CLKHI/2 */
+ static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx)
+ {
+-      u8 prescale, filt, sethold, clkhi, clklo, datavd;
+-      unsigned int clk_rate, clk_cycle;
++      u8 prescale, filt, sethold, datavd;
++      unsigned int clk_rate, clk_cycle, clkhi, clklo;
+       enum lpi2c_imx_pincfg pincfg;
+       unsigned int temp;
+-- 
+2.39.2
+
index 5d4d86b92c02d8c0cd2f94303648d0ca375854af..b2f306348804f86f7362510ced3c483e07f6a0a0 100644 (file)
@@ -53,3 +53,5 @@ arm-dts-fix-erroneous-ads-touchscreen-polarities.patch
 drm-exynos-vidi-fix-a-wrong-error-return.patch
 drm-exynos-fix-race-condition-uaf-in-exynos_g2d_exec.patch
 drm-radeon-fix-race-condition-uaf-in-radeon_gem_set_.patch
+x86-apic-fix-kernel-panic-when-booting-with-intremap.patch
+i2c-imx-lpi2c-fix-type-char-overflow-issue-when-calc.patch
diff --git a/queue-5.4/x86-apic-fix-kernel-panic-when-booting-with-intremap.patch b/queue-5.4/x86-apic-fix-kernel-panic-when-booting-with-intremap.patch
new file mode 100644 (file)
index 0000000..2ec3863
--- /dev/null
@@ -0,0 +1,80 @@
+From 0bbbd6355f7642ddd1c710b1f7adc89d7b590f6a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 17 Jun 2023 02:52:36 +0530
+Subject: x86/apic: Fix kernel panic when booting with intremap=off and
+ x2apic_phys
+
+From: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
+
+[ Upstream commit 85d38d5810e285d5aec7fb5283107d1da70c12a9 ]
+
+When booting with "intremap=off" and "x2apic_phys" on the kernel command
+line, the physical x2APIC driver ends up being used even when x2APIC
+mode is disabled ("intremap=off" disables x2APIC mode). This happens
+because the first compound condition check in x2apic_phys_probe() is
+false due to x2apic_mode == 0 and so the following one returns true
+after default_acpi_madt_oem_check() having already selected the physical
+x2APIC driver.
+
+This results in the following panic:
+
+   kernel BUG at arch/x86/kernel/apic/io_apic.c:2409!
+   invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
+   CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.4.0-rc2-ver4.1rc2 #2
+   Hardware name: Dell Inc. PowerEdge R6515/07PXPY, BIOS 2.3.6 07/06/2021
+   RIP: 0010:setup_IO_APIC+0x9c/0xaf0
+   Call Trace:
+    <TASK>
+    ? native_read_msr
+    apic_intr_mode_init
+    x86_late_time_init
+    start_kernel
+    x86_64_start_reservations
+    x86_64_start_kernel
+    secondary_startup_64_no_verify
+    </TASK>
+
+which is:
+
+setup_IO_APIC:
+  apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n");
+  for_each_ioapic(ioapic)
+       BUG_ON(mp_irqdomain_create(ioapic));
+
+Return 0 to denote that x2APIC has not been enabled when probing the
+physical x2APIC driver.
+
+  [ bp: Massage commit message heavily. ]
+
+Fixes: 9ebd680bd029 ("x86, apic: Use probe routines to simplify apic selection")
+Signed-off-by: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
+Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
+Reviewed-by: Kishon Vijay Abraham I <kvijayab@amd.com>
+Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
+Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>
+Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
+Link: https://lore.kernel.org/r/20230616212236.1389-1-dheerajkumar.srivastava@amd.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/kernel/apic/x2apic_phys.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c
+index 032a00e5d9fa6..76c80e191a1b1 100644
+--- a/arch/x86/kernel/apic/x2apic_phys.c
++++ b/arch/x86/kernel/apic/x2apic_phys.c
+@@ -97,7 +97,10 @@ static void init_x2apic_ldr(void)
+ static int x2apic_phys_probe(void)
+ {
+-      if (x2apic_mode && (x2apic_phys || x2apic_fadt_phys()))
++      if (!x2apic_mode)
++              return 0;
++
++      if (x2apic_phys || x2apic_fadt_phys())
+               return 1;
+       return apic == &apic_x2apic_phys;
+-- 
+2.39.2
+