From 2eca840fecc892bd54672c122cdd5aae159cd106 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Wed, 29 Dec 2021 21:22:46 -0500 Subject: [PATCH] Fixes for 5.15 Signed-off-by: Sasha Levin --- ...dw-acpi-go-through-hdas-acpi-at-max-.patch | 50 ++++ ...dw-acpi-harden-detection-of-controll.patch | 57 ++++ ...put-i8042-add-deferred-probe-support.patch | 276 ++++++++++++++++++ ...le-deferred-probe-quirk-for-asus-um3.patch | 48 +++ ...block_phys_alloc-section-mismatch-er.patch | 55 ++++ ...-qdisc-control-block-with-tc-control.patch | 229 +++++++++++++++ ...le-iir-value-on-instruction-access-r.patch | 43 +++ ...x-mlxbf-pmc-fix-an-is_err-vs-null-bu.patch | 41 +++ ...pple-gmux-use-resource_size-with-res.patch | 37 +++ queue-5.15/series | 11 + ...eeded-quota-early-in-tomoyo_domain_q.patch | 69 +++++ ...wight16-in-tomoyo_domain_quota_is_ok.patch | 75 +++++ 12 files changed, 991 insertions(+) create mode 100644 queue-5.15/alsa-hda-intel-sdw-acpi-go-through-hdas-acpi-at-max-.patch create mode 100644 queue-5.15/alsa-hda-intel-sdw-acpi-harden-detection-of-controll.patch create mode 100644 queue-5.15/input-i8042-add-deferred-probe-support.patch create mode 100644 queue-5.15/input-i8042-enable-deferred-probe-quirk-for-asus-um3.patch create mode 100644 queue-5.15/memblock-fix-memblock_phys_alloc-section-mismatch-er.patch create mode 100644 queue-5.15/net-sched-extend-qdisc-control-block-with-tc-control.patch create mode 100644 queue-5.15/parisc-clear-stale-iir-value-on-instruction-access-r.patch create mode 100644 queue-5.15/platform-mellanox-mlxbf-pmc-fix-an-is_err-vs-null-bu.patch create mode 100644 queue-5.15/platform-x86-apple-gmux-use-resource_size-with-res.patch create mode 100644 queue-5.15/series create mode 100644 queue-5.15/tomoyo-check-exceeded-quota-early-in-tomoyo_domain_q.patch create mode 100644 queue-5.15/tomoyo-use-hwight16-in-tomoyo_domain_quota_is_ok.patch diff --git a/queue-5.15/alsa-hda-intel-sdw-acpi-go-through-hdas-acpi-at-max-.patch b/queue-5.15/alsa-hda-intel-sdw-acpi-go-through-hdas-acpi-at-max-.patch new file mode 100644 index 00000000000..eccc1b830b7 --- /dev/null +++ b/queue-5.15/alsa-hda-intel-sdw-acpi-go-through-hdas-acpi-at-max-.patch @@ -0,0 +1,50 @@ +From 26b2dad7d88d5692dd76362619a109e6f5e2728f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Dec 2021 09:08:17 +0800 +Subject: ALSA: hda: intel-sdw-acpi: go through HDAS ACPI at max depth of 2 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Libin Yang + +[ Upstream commit 78ea40efb48e978756db2ce45fcfa55bac056b91 ] + +In the HDAS ACPI scope, the SoundWire may not be the direct child of HDAS. +It needs to go through the ACPI table at max depth of 2 to find the +SoundWire device from HDAS. + +Reviewed-by: Péter Ujfalusi +Signed-off-by: Libin Yang +Signed-off-by: Pierre-Louis Bossart +Signed-off-by: Bard Liao +Link: https://lore.kernel.org/r/20211221010817.23636-3-yung-chuan.liao@linux.intel.com +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/hda/intel-sdw-acpi.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/sound/hda/intel-sdw-acpi.c b/sound/hda/intel-sdw-acpi.c +index ba8a872a29010..b7758dbe23714 100644 +--- a/sound/hda/intel-sdw-acpi.c ++++ b/sound/hda/intel-sdw-acpi.c +@@ -165,8 +165,14 @@ int sdw_intel_acpi_scan(acpi_handle *parent_handle, + acpi_status status; + + info->handle = NULL; ++ /* ++ * In the HDAS ACPI scope, 'SNDW' may be either the child of ++ * 'HDAS' or the grandchild of 'HDAS'. So let's go through ++ * the ACPI from 'HDAS' at max depth of 2 to find the 'SNDW' ++ * device. ++ */ + status = acpi_walk_namespace(ACPI_TYPE_DEVICE, +- parent_handle, 1, ++ parent_handle, 2, + sdw_intel_acpi_cb, + NULL, info, NULL); + if (ACPI_FAILURE(status) || info->handle == NULL) +-- +2.34.1 + diff --git a/queue-5.15/alsa-hda-intel-sdw-acpi-harden-detection-of-controll.patch b/queue-5.15/alsa-hda-intel-sdw-acpi-harden-detection-of-controll.patch new file mode 100644 index 00000000000..9429496a9f8 --- /dev/null +++ b/queue-5.15/alsa-hda-intel-sdw-acpi-harden-detection-of-controll.patch @@ -0,0 +1,57 @@ +From 084364cdee17098358357c31542b4fab2cce3190 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Dec 2021 09:08:16 +0800 +Subject: ALSA: hda: intel-sdw-acpi: harden detection of controller +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Libin Yang + +[ Upstream commit 385f287f9853da402d94278e59f594501c1d1dad ] + +The existing code currently sets a pointer to an ACPI handle before +checking that it's actually a SoundWire controller. This can lead to +issues where the graph walk continues and eventually fails, but the +pointer was set already. + +This patch changes the logic so that the information provided to +the caller is set when a controller is found. + +Reviewed-by: Péter Ujfalusi +Signed-off-by: Libin Yang +Signed-off-by: Pierre-Louis Bossart +Signed-off-by: Bard Liao +Link: https://lore.kernel.org/r/20211221010817.23636-2-yung-chuan.liao@linux.intel.com +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/hda/intel-sdw-acpi.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/sound/hda/intel-sdw-acpi.c b/sound/hda/intel-sdw-acpi.c +index c0123bc31c0dd..ba8a872a29010 100644 +--- a/sound/hda/intel-sdw-acpi.c ++++ b/sound/hda/intel-sdw-acpi.c +@@ -132,8 +132,6 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level, + return AE_NOT_FOUND; + } + +- info->handle = handle; +- + /* + * On some Intel platforms, multiple children of the HDAS + * device can be found, but only one of them is the SoundWire +@@ -144,6 +142,9 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level, + if (FIELD_GET(GENMASK(31, 28), adr) != SDW_LINK_TYPE) + return AE_OK; /* keep going */ + ++ /* found the correct SoundWire controller */ ++ info->handle = handle; ++ + /* device found, stop namespace walk */ + return AE_CTRL_TERMINATE; + } +-- +2.34.1 + diff --git a/queue-5.15/input-i8042-add-deferred-probe-support.patch b/queue-5.15/input-i8042-add-deferred-probe-support.patch new file mode 100644 index 00000000000..01f247cdcce --- /dev/null +++ b/queue-5.15/input-i8042-add-deferred-probe-support.patch @@ -0,0 +1,276 @@ +From 4717c279865689fd1cec5700a8f2755b2e96af98 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 28 Nov 2021 23:21:41 -0800 +Subject: Input: i8042 - add deferred probe support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Takashi Iwai + +[ Upstream commit 9222ba68c3f4065f6364b99cc641b6b019ef2d42 ] + +We've got a bug report about the non-working keyboard on ASUS ZenBook +UX425UA. It seems that the PS/2 device isn't ready immediately at +boot but takes some seconds to get ready. Until now, the only +workaround is to defer the probe, but it's available only when the +driver is a module. However, many distros, including openSUSE as in +the original report, build the PS/2 input drivers into kernel, hence +it won't work easily. + +This patch adds the support for the deferred probe for i8042 stuff as +a workaround of the problem above. When the deferred probe mode is +enabled and the device couldn't be probed, it'll be repeated with the +standard deferred probe mechanism. + +The deferred probe mode is enabled either via the new option +i8042.probe_defer or via the quirk table entry. As of this patch, the +quirk table contains only ASUS ZenBook UX425UA. + +The deferred probe part is based on Fabio's initial work. + +BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1190256 +Signed-off-by: Takashi Iwai +Tested-by: Samuel Čavoj +Link: https://lore.kernel.org/r/20211117063757.11380-1-tiwai@suse.de + +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + .../admin-guide/kernel-parameters.txt | 2 + + drivers/input/serio/i8042-x86ia64io.h | 14 +++++ + drivers/input/serio/i8042.c | 54 ++++++++++++------- + 3 files changed, 51 insertions(+), 19 deletions(-) + +diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt +index a454f438bd621..8ff6dafafdf8d 100644 +--- a/Documentation/admin-guide/kernel-parameters.txt ++++ b/Documentation/admin-guide/kernel-parameters.txt +@@ -1690,6 +1690,8 @@ + architectures force reset to be always executed + i8042.unlock [HW] Unlock (ignore) the keylock + i8042.kbdreset [HW] Reset device connected to KBD port ++ i8042.probe_defer ++ [HW] Allow deferred probing upon i8042 probe errors + + i810= [HW,DRM] + +diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h +index aedd055410443..1acc7c8449294 100644 +--- a/drivers/input/serio/i8042-x86ia64io.h ++++ b/drivers/input/serio/i8042-x86ia64io.h +@@ -995,6 +995,17 @@ static const struct dmi_system_id __initconst i8042_dmi_kbdreset_table[] = { + { } + }; + ++static const struct dmi_system_id i8042_dmi_probe_defer_table[] __initconst = { ++ { ++ /* ASUS ZenBook UX425UA */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX425UA"), ++ }, ++ }, ++ { } ++}; ++ + #endif /* CONFIG_X86 */ + + #ifdef CONFIG_PNP +@@ -1315,6 +1326,9 @@ static int __init i8042_platform_init(void) + if (dmi_check_system(i8042_dmi_kbdreset_table)) + i8042_kbdreset = true; + ++ if (dmi_check_system(i8042_dmi_probe_defer_table)) ++ i8042_probe_defer = true; ++ + /* + * A20 was already enabled during early kernel init. But some buggy + * BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to +diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c +index 0b9f1d0a8f8b0..3fc0a89cc785c 100644 +--- a/drivers/input/serio/i8042.c ++++ b/drivers/input/serio/i8042.c +@@ -45,6 +45,10 @@ static bool i8042_unlock; + module_param_named(unlock, i8042_unlock, bool, 0); + MODULE_PARM_DESC(unlock, "Ignore keyboard lock."); + ++static bool i8042_probe_defer; ++module_param_named(probe_defer, i8042_probe_defer, bool, 0); ++MODULE_PARM_DESC(probe_defer, "Allow deferred probing."); ++ + enum i8042_controller_reset_mode { + I8042_RESET_NEVER, + I8042_RESET_ALWAYS, +@@ -711,7 +715,7 @@ static int i8042_set_mux_mode(bool multiplex, unsigned char *mux_version) + * LCS/Telegraphics. + */ + +-static int __init i8042_check_mux(void) ++static int i8042_check_mux(void) + { + unsigned char mux_version; + +@@ -740,10 +744,10 @@ static int __init i8042_check_mux(void) + /* + * The following is used to test AUX IRQ delivery. + */ +-static struct completion i8042_aux_irq_delivered __initdata; +-static bool i8042_irq_being_tested __initdata; ++static struct completion i8042_aux_irq_delivered; ++static bool i8042_irq_being_tested; + +-static irqreturn_t __init i8042_aux_test_irq(int irq, void *dev_id) ++static irqreturn_t i8042_aux_test_irq(int irq, void *dev_id) + { + unsigned long flags; + unsigned char str, data; +@@ -770,7 +774,7 @@ static irqreturn_t __init i8042_aux_test_irq(int irq, void *dev_id) + * verifies success by readinng CTR. Used when testing for presence of AUX + * port. + */ +-static int __init i8042_toggle_aux(bool on) ++static int i8042_toggle_aux(bool on) + { + unsigned char param; + int i; +@@ -798,7 +802,7 @@ static int __init i8042_toggle_aux(bool on) + * the presence of an AUX interface. + */ + +-static int __init i8042_check_aux(void) ++static int i8042_check_aux(void) + { + int retval = -1; + bool irq_registered = false; +@@ -1005,7 +1009,7 @@ static int i8042_controller_init(void) + + if (i8042_command(&ctr[n++ % 2], I8042_CMD_CTL_RCTR)) { + pr_err("Can't read CTR while initializing i8042\n"); +- return -EIO; ++ return i8042_probe_defer ? -EPROBE_DEFER : -EIO; + } + + } while (n < 2 || ctr[0] != ctr[1]); +@@ -1320,7 +1324,7 @@ static void i8042_shutdown(struct platform_device *dev) + i8042_controller_reset(false); + } + +-static int __init i8042_create_kbd_port(void) ++static int i8042_create_kbd_port(void) + { + struct serio *serio; + struct i8042_port *port = &i8042_ports[I8042_KBD_PORT_NO]; +@@ -1349,7 +1353,7 @@ static int __init i8042_create_kbd_port(void) + return 0; + } + +-static int __init i8042_create_aux_port(int idx) ++static int i8042_create_aux_port(int idx) + { + struct serio *serio; + int port_no = idx < 0 ? I8042_AUX_PORT_NO : I8042_MUX_PORT_NO + idx; +@@ -1386,13 +1390,13 @@ static int __init i8042_create_aux_port(int idx) + return 0; + } + +-static void __init i8042_free_kbd_port(void) ++static void i8042_free_kbd_port(void) + { + kfree(i8042_ports[I8042_KBD_PORT_NO].serio); + i8042_ports[I8042_KBD_PORT_NO].serio = NULL; + } + +-static void __init i8042_free_aux_ports(void) ++static void i8042_free_aux_ports(void) + { + int i; + +@@ -1402,7 +1406,7 @@ static void __init i8042_free_aux_ports(void) + } + } + +-static void __init i8042_register_ports(void) ++static void i8042_register_ports(void) + { + int i; + +@@ -1443,7 +1447,7 @@ static void i8042_free_irqs(void) + i8042_aux_irq_registered = i8042_kbd_irq_registered = false; + } + +-static int __init i8042_setup_aux(void) ++static int i8042_setup_aux(void) + { + int (*aux_enable)(void); + int error; +@@ -1485,7 +1489,7 @@ static int __init i8042_setup_aux(void) + return error; + } + +-static int __init i8042_setup_kbd(void) ++static int i8042_setup_kbd(void) + { + int error; + +@@ -1535,7 +1539,7 @@ static int i8042_kbd_bind_notifier(struct notifier_block *nb, + return 0; + } + +-static int __init i8042_probe(struct platform_device *dev) ++static int i8042_probe(struct platform_device *dev) + { + int error; + +@@ -1600,6 +1604,7 @@ static struct platform_driver i8042_driver = { + .pm = &i8042_pm_ops, + #endif + }, ++ .probe = i8042_probe, + .remove = i8042_remove, + .shutdown = i8042_shutdown, + }; +@@ -1610,7 +1615,6 @@ static struct notifier_block i8042_kbd_bind_notifier_block = { + + static int __init i8042_init(void) + { +- struct platform_device *pdev; + int err; + + dbg_init(); +@@ -1626,17 +1630,29 @@ static int __init i8042_init(void) + /* Set this before creating the dev to allow i8042_command to work right away */ + i8042_present = true; + +- pdev = platform_create_bundle(&i8042_driver, i8042_probe, NULL, 0, NULL, 0); +- if (IS_ERR(pdev)) { +- err = PTR_ERR(pdev); ++ err = platform_driver_register(&i8042_driver); ++ if (err) + goto err_platform_exit; ++ ++ i8042_platform_device = platform_device_alloc("i8042", -1); ++ if (!i8042_platform_device) { ++ err = -ENOMEM; ++ goto err_unregister_driver; + } + ++ err = platform_device_add(i8042_platform_device); ++ if (err) ++ goto err_free_device; ++ + bus_register_notifier(&serio_bus, &i8042_kbd_bind_notifier_block); + panic_blink = i8042_panic_blink; + + return 0; + ++err_free_device: ++ platform_device_put(i8042_platform_device); ++err_unregister_driver: ++ platform_driver_unregister(&i8042_driver); + err_platform_exit: + i8042_platform_exit(); + return err; +-- +2.34.1 + diff --git a/queue-5.15/input-i8042-enable-deferred-probe-quirk-for-asus-um3.patch b/queue-5.15/input-i8042-enable-deferred-probe-quirk-for-asus-um3.patch new file mode 100644 index 00000000000..c9d8d15ee2d --- /dev/null +++ b/queue-5.15/input-i8042-enable-deferred-probe-quirk-for-asus-um3.patch @@ -0,0 +1,48 @@ +From a88f4bd1b832c505283a8a2e485766d28ee1dc5a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 4 Dec 2021 13:17:36 -0800 +Subject: Input: i8042 - enable deferred probe quirk for ASUS UM325UA +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Samuel Čavoj + +[ Upstream commit 44ee250aeeabb28b52a10397ac17ffb8bfe94839 ] + +The ASUS UM325UA suffers from the same issue as the ASUS UX425UA, which +is a very similar laptop. The i8042 device is not usable immediately +after boot and fails to initialize, requiring a deferred retry. + +Enable the deferred probe quirk for the UM325UA. + +BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1190256 +Signed-off-by: Samuel Čavoj +Link: https://lore.kernel.org/r/20211204015615.232948-1-samuel@cavoj.net +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/serio/i8042-x86ia64io.h | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h +index 1acc7c8449294..148a7c5fd0e22 100644 +--- a/drivers/input/serio/i8042-x86ia64io.h ++++ b/drivers/input/serio/i8042-x86ia64io.h +@@ -1003,6 +1003,13 @@ static const struct dmi_system_id i8042_dmi_probe_defer_table[] __initconst = { + DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX425UA"), + }, + }, ++ { ++ /* ASUS ZenBook UM325UA */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX325UA_UM325UA"), ++ }, ++ }, + { } + }; + +-- +2.34.1 + diff --git a/queue-5.15/memblock-fix-memblock_phys_alloc-section-mismatch-er.patch b/queue-5.15/memblock-fix-memblock_phys_alloc-section-mismatch-er.patch new file mode 100644 index 00000000000..99209561a8e --- /dev/null +++ b/queue-5.15/memblock-fix-memblock_phys_alloc-section-mismatch-er.patch @@ -0,0 +1,55 @@ +From 111891e79cf1d069a6941fc1e5949252935322c5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 Dec 2021 10:07:54 +0800 +Subject: memblock: fix memblock_phys_alloc() section mismatch error + +From: Jackie Liu + +[ Upstream commit d7f55471db2719629f773c2d6b5742a69595bfd3 ] + +Fix modpost Section mismatch error in memblock_phys_alloc() + +[...] +WARNING: modpost: vmlinux.o(.text.unlikely+0x1dcc): Section mismatch in reference +from the function memblock_phys_alloc() to the function .init.text:memblock_phys_alloc_range() +The function memblock_phys_alloc() references +the function __init memblock_phys_alloc_range(). +This is often because memblock_phys_alloc lacks a __init +annotation or the annotation of memblock_phys_alloc_range is wrong. + +ERROR: modpost: Section mismatches detected. +Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them. +[...] + +memblock_phys_alloc() is a one-line wrapper, make it __always_inline to +avoid these section mismatches. + +Reported-by: k2ci +Suggested-by: Mike Rapoport +Signed-off-by: Jackie Liu +[rppt: slightly massaged changelog ] +Signed-off-by: Mike Rapoport +Link: https://lore.kernel.org/r/20211217020754.2874872-1-liu.yun@linux.dev +Signed-off-by: Sasha Levin +--- + include/linux/memblock.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/linux/memblock.h b/include/linux/memblock.h +index 34de69b3b8bad..5df38332e4139 100644 +--- a/include/linux/memblock.h ++++ b/include/linux/memblock.h +@@ -388,8 +388,8 @@ phys_addr_t memblock_alloc_range_nid(phys_addr_t size, + phys_addr_t end, int nid, bool exact_nid); + phys_addr_t memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid); + +-static inline phys_addr_t memblock_phys_alloc(phys_addr_t size, +- phys_addr_t align) ++static __always_inline phys_addr_t memblock_phys_alloc(phys_addr_t size, ++ phys_addr_t align) + { + return memblock_phys_alloc_range(size, align, 0, + MEMBLOCK_ALLOC_ACCESSIBLE); +-- +2.34.1 + diff --git a/queue-5.15/net-sched-extend-qdisc-control-block-with-tc-control.patch b/queue-5.15/net-sched-extend-qdisc-control-block-with-tc-control.patch new file mode 100644 index 00000000000..b30ca8ef2e0 --- /dev/null +++ b/queue-5.15/net-sched-extend-qdisc-control-block-with-tc-control.patch @@ -0,0 +1,229 @@ +From 6edf31bc8532fd1fe1b3b17c74a845de5fd1a5c2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Dec 2021 19:24:33 +0200 +Subject: net/sched: Extend qdisc control block with tc control block + +From: Paul Blakey + +[ Upstream commit ec624fe740b416fb68d536b37fb8eef46f90b5c2 ] + +BPF layer extends the qdisc control block via struct bpf_skb_data_end +and because of that there is no more room to add variables to the +qdisc layer control block without going over the skb->cb size. + +Extend the qdisc control block with a tc control block, +and move all tc related variables to there as a pre-step for +extending the tc control block with additional members. + +Signed-off-by: Paul Blakey +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + include/net/pkt_sched.h | 15 +++++++++++++++ + include/net/sch_generic.h | 2 -- + net/core/dev.c | 8 ++++---- + net/sched/act_ct.c | 14 +++++++------- + net/sched/cls_api.c | 6 ++++-- + net/sched/cls_flower.c | 3 ++- + net/sched/sch_frag.c | 3 ++- + 7 files changed, 34 insertions(+), 17 deletions(-) + +diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h +index bf79f3a890af2..05f18e81f3e87 100644 +--- a/include/net/pkt_sched.h ++++ b/include/net/pkt_sched.h +@@ -193,4 +193,19 @@ static inline void skb_txtime_consumed(struct sk_buff *skb) + skb->tstamp = ktime_set(0, 0); + } + ++struct tc_skb_cb { ++ struct qdisc_skb_cb qdisc_cb; ++ ++ u16 mru; ++ bool post_ct; ++}; ++ ++static inline struct tc_skb_cb *tc_skb_cb(const struct sk_buff *skb) ++{ ++ struct tc_skb_cb *cb = (struct tc_skb_cb *)skb->cb; ++ ++ BUILD_BUG_ON(sizeof(*cb) > sizeof_field(struct sk_buff, cb)); ++ return cb; ++} ++ + #endif +diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h +index 8c2d611639fca..6e7cd00333577 100644 +--- a/include/net/sch_generic.h ++++ b/include/net/sch_generic.h +@@ -440,8 +440,6 @@ struct qdisc_skb_cb { + }; + #define QDISC_CB_PRIV_LEN 20 + unsigned char data[QDISC_CB_PRIV_LEN]; +- u16 mru; +- bool post_ct; + }; + + typedef void tcf_chain_head_change_t(struct tcf_proto *tp_head, void *priv); +diff --git a/net/core/dev.c b/net/core/dev.c +index 91f53eeb0e79f..e0878a500aa92 100644 +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -3934,8 +3934,8 @@ sch_handle_egress(struct sk_buff *skb, int *ret, struct net_device *dev) + return skb; + + /* qdisc_skb_cb(skb)->pkt_len was already set by the caller. */ +- qdisc_skb_cb(skb)->mru = 0; +- qdisc_skb_cb(skb)->post_ct = false; ++ tc_skb_cb(skb)->mru = 0; ++ tc_skb_cb(skb)->post_ct = false; + mini_qdisc_bstats_cpu_update(miniq, skb); + + switch (tcf_classify(skb, miniq->block, miniq->filter_list, &cl_res, false)) { +@@ -5088,8 +5088,8 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret, + } + + qdisc_skb_cb(skb)->pkt_len = skb->len; +- qdisc_skb_cb(skb)->mru = 0; +- qdisc_skb_cb(skb)->post_ct = false; ++ tc_skb_cb(skb)->mru = 0; ++ tc_skb_cb(skb)->post_ct = false; + skb->tc_at_ingress = 1; + mini_qdisc_bstats_cpu_update(miniq, skb); + +diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c +index 90866ae45573a..98e248b9c0b17 100644 +--- a/net/sched/act_ct.c ++++ b/net/sched/act_ct.c +@@ -690,10 +690,10 @@ static int tcf_ct_handle_fragments(struct net *net, struct sk_buff *skb, + u8 family, u16 zone, bool *defrag) + { + enum ip_conntrack_info ctinfo; +- struct qdisc_skb_cb cb; + struct nf_conn *ct; + int err = 0; + bool frag; ++ u16 mru; + + /* Previously seen (loopback)? Ignore. */ + ct = nf_ct_get(skb, &ctinfo); +@@ -708,7 +708,7 @@ static int tcf_ct_handle_fragments(struct net *net, struct sk_buff *skb, + return err; + + skb_get(skb); +- cb = *qdisc_skb_cb(skb); ++ mru = tc_skb_cb(skb)->mru; + + if (family == NFPROTO_IPV4) { + enum ip_defrag_users user = IP_DEFRAG_CONNTRACK_IN + zone; +@@ -722,7 +722,7 @@ static int tcf_ct_handle_fragments(struct net *net, struct sk_buff *skb, + + if (!err) { + *defrag = true; +- cb.mru = IPCB(skb)->frag_max_size; ++ mru = IPCB(skb)->frag_max_size; + } + } else { /* NFPROTO_IPV6 */ + #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) +@@ -735,7 +735,7 @@ static int tcf_ct_handle_fragments(struct net *net, struct sk_buff *skb, + + if (!err) { + *defrag = true; +- cb.mru = IP6CB(skb)->frag_max_size; ++ mru = IP6CB(skb)->frag_max_size; + } + #else + err = -EOPNOTSUPP; +@@ -744,7 +744,7 @@ static int tcf_ct_handle_fragments(struct net *net, struct sk_buff *skb, + } + + if (err != -EINPROGRESS) +- *qdisc_skb_cb(skb) = cb; ++ tc_skb_cb(skb)->mru = mru; + skb_clear_hash(skb); + skb->ignore_df = 1; + return err; +@@ -963,7 +963,7 @@ static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a, + tcf_action_update_bstats(&c->common, skb); + + if (clear) { +- qdisc_skb_cb(skb)->post_ct = false; ++ tc_skb_cb(skb)->post_ct = false; + ct = nf_ct_get(skb, &ctinfo); + if (ct) { + nf_conntrack_put(&ct->ct_general); +@@ -1048,7 +1048,7 @@ do_nat: + out_push: + skb_push_rcsum(skb, nh_ofs); + +- qdisc_skb_cb(skb)->post_ct = true; ++ tc_skb_cb(skb)->post_ct = true; + out_clear: + if (defrag) + qdisc_skb_cb(skb)->pkt_len = skb->len; +diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c +index e54f0a42270c1..ff8a9383bf1c4 100644 +--- a/net/sched/cls_api.c ++++ b/net/sched/cls_api.c +@@ -1617,12 +1617,14 @@ int tcf_classify(struct sk_buff *skb, + + /* If we missed on some chain */ + if (ret == TC_ACT_UNSPEC && last_executed_chain) { ++ struct tc_skb_cb *cb = tc_skb_cb(skb); ++ + ext = tc_skb_ext_alloc(skb); + if (WARN_ON_ONCE(!ext)) + return TC_ACT_SHOT; + ext->chain = last_executed_chain; +- ext->mru = qdisc_skb_cb(skb)->mru; +- ext->post_ct = qdisc_skb_cb(skb)->post_ct; ++ ext->mru = cb->mru; ++ ext->post_ct = cb->post_ct; + } + + return ret; +diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c +index eb6345a027e13..161bd91c8c6b0 100644 +--- a/net/sched/cls_flower.c ++++ b/net/sched/cls_flower.c +@@ -19,6 +19,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -309,7 +310,7 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp, + struct tcf_result *res) + { + struct cls_fl_head *head = rcu_dereference_bh(tp->root); +- bool post_ct = qdisc_skb_cb(skb)->post_ct; ++ bool post_ct = tc_skb_cb(skb)->post_ct; + struct fl_flow_key skb_key; + struct fl_flow_mask *mask; + struct cls_fl_filter *f; +diff --git a/net/sched/sch_frag.c b/net/sched/sch_frag.c +index 8c06381391d6f..5ded4c8672a64 100644 +--- a/net/sched/sch_frag.c ++++ b/net/sched/sch_frag.c +@@ -1,6 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB + #include + #include ++#include + #include + #include + #include +@@ -137,7 +138,7 @@ err: + + int sch_frag_xmit_hook(struct sk_buff *skb, int (*xmit)(struct sk_buff *skb)) + { +- u16 mru = qdisc_skb_cb(skb)->mru; ++ u16 mru = tc_skb_cb(skb)->mru; + int err; + + if (mru && skb->len > mru + skb->dev->hard_header_len) +-- +2.34.1 + diff --git a/queue-5.15/parisc-clear-stale-iir-value-on-instruction-access-r.patch b/queue-5.15/parisc-clear-stale-iir-value-on-instruction-access-r.patch new file mode 100644 index 00000000000..ecaa0476c43 --- /dev/null +++ b/queue-5.15/parisc-clear-stale-iir-value-on-instruction-access-r.patch @@ -0,0 +1,43 @@ +From ef87424277578b3fa81ce38e87c401af89946f16 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 8 Dec 2021 11:06:52 +0100 +Subject: parisc: Clear stale IIR value on instruction access rights trap + +From: Helge Deller + +[ Upstream commit 484730e5862f6b872dca13840bed40fd7c60fa26 ] + +When a trap 7 (Instruction access rights) occurs, this means the CPU +couldn't execute an instruction due to missing execute permissions on +the memory region. In this case it seems the CPU didn't even fetched +the instruction from memory and thus did not store it in the cr19 (IIR) +register before calling the trap handler. So, the trap handler will find +some random old stale value in cr19. + +This patch simply overwrites the stale IIR value with a constant magic +"bad food" value (0xbaadf00d), in the hope people don't start to try to +understand the various random IIR values in trap 7 dumps. + +Noticed-by: John David Anglin +Signed-off-by: Helge Deller +Signed-off-by: Sasha Levin +--- + arch/parisc/kernel/traps.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c +index 747c328fb8862..197cb8480350c 100644 +--- a/arch/parisc/kernel/traps.c ++++ b/arch/parisc/kernel/traps.c +@@ -729,6 +729,8 @@ void notrace handle_interruption(int code, struct pt_regs *regs) + } + mmap_read_unlock(current->mm); + } ++ /* CPU could not fetch instruction, so clear stale IIR value. */ ++ regs->iir = 0xbaadf00d; + fallthrough; + case 27: + /* Data memory protection ID trap */ +-- +2.34.1 + diff --git a/queue-5.15/platform-mellanox-mlxbf-pmc-fix-an-is_err-vs-null-bu.patch b/queue-5.15/platform-mellanox-mlxbf-pmc-fix-an-is_err-vs-null-bu.patch new file mode 100644 index 00000000000..f4973f9a4ef --- /dev/null +++ b/queue-5.15/platform-mellanox-mlxbf-pmc-fix-an-is_err-vs-null-bu.patch @@ -0,0 +1,41 @@ +From 96cc35e847b9cf9bb306988be44c0546ea2fd911 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 Dec 2021 07:07:53 +0000 +Subject: platform/mellanox: mlxbf-pmc: Fix an IS_ERR() vs NULL bug in + mlxbf_pmc_map_counters + +From: Miaoqian Lin + +[ Upstream commit 804034c4ffc502795cea9b3867acb2ec7fad99ba ] + +The devm_ioremap() function returns NULL on error, it doesn't return +error pointers. Also according to doc of device_property_read_u64_array, +values in info array are properties of device or NULL. + +Signed-off-by: Miaoqian Lin +Link: https://lore.kernel.org/r/20211210070753.10761-1-linmq006@gmail.com +Reviewed-by: Hans de Goede +Signed-off-by: Hans de Goede +Signed-off-by: Sasha Levin +--- + drivers/platform/mellanox/mlxbf-pmc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/platform/mellanox/mlxbf-pmc.c b/drivers/platform/mellanox/mlxbf-pmc.c +index 04bc3b50aa7a4..65b4a819f1bdf 100644 +--- a/drivers/platform/mellanox/mlxbf-pmc.c ++++ b/drivers/platform/mellanox/mlxbf-pmc.c +@@ -1374,8 +1374,8 @@ static int mlxbf_pmc_map_counters(struct device *dev) + pmc->block[i].counters = info[2]; + pmc->block[i].type = info[3]; + +- if (IS_ERR(pmc->block[i].mmio_base)) +- return PTR_ERR(pmc->block[i].mmio_base); ++ if (!pmc->block[i].mmio_base) ++ return -ENOMEM; + + ret = mlxbf_pmc_create_groups(dev, i); + if (ret) +-- +2.34.1 + diff --git a/queue-5.15/platform-x86-apple-gmux-use-resource_size-with-res.patch b/queue-5.15/platform-x86-apple-gmux-use-resource_size-with-res.patch new file mode 100644 index 00000000000..b6bf3bbf8ac --- /dev/null +++ b/queue-5.15/platform-x86-apple-gmux-use-resource_size-with-res.patch @@ -0,0 +1,37 @@ +From 00555948a9e95e2f69640925c15cc05a1109db36 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Dec 2021 04:18:36 -0800 +Subject: platform/x86: apple-gmux: use resource_size() with res + +From: Wang Qing + +[ Upstream commit eb66fb03a727cde0ab9b1a3858de55c26f3007da ] + +This should be (res->end - res->start + 1) here actually, +use resource_size() derectly. + +Signed-off-by: Wang Qing +Link: https://lore.kernel.org/r/1639484316-75873-1-git-send-email-wangqing@vivo.com +Reviewed-by: Hans de Goede +Signed-off-by: Hans de Goede +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/apple-gmux.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c +index 9aae45a452002..57553f9b4d1dc 100644 +--- a/drivers/platform/x86/apple-gmux.c ++++ b/drivers/platform/x86/apple-gmux.c +@@ -625,7 +625,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id) + } + + gmux_data->iostart = res->start; +- gmux_data->iolen = res->end - res->start; ++ gmux_data->iolen = resource_size(res); + + if (gmux_data->iolen < GMUX_MIN_IO_LEN) { + pr_err("gmux I/O region too small (%lu < %u)\n", +-- +2.34.1 + diff --git a/queue-5.15/series b/queue-5.15/series new file mode 100644 index 00000000000..b86278c5496 --- /dev/null +++ b/queue-5.15/series @@ -0,0 +1,11 @@ +input-i8042-add-deferred-probe-support.patch +input-i8042-enable-deferred-probe-quirk-for-asus-um3.patch +tomoyo-check-exceeded-quota-early-in-tomoyo_domain_q.patch +tomoyo-use-hwight16-in-tomoyo_domain_quota_is_ok.patch +net-sched-extend-qdisc-control-block-with-tc-control.patch +parisc-clear-stale-iir-value-on-instruction-access-r.patch +platform-mellanox-mlxbf-pmc-fix-an-is_err-vs-null-bu.patch +platform-x86-apple-gmux-use-resource_size-with-res.patch +memblock-fix-memblock_phys_alloc-section-mismatch-er.patch +alsa-hda-intel-sdw-acpi-harden-detection-of-controll.patch +alsa-hda-intel-sdw-acpi-go-through-hdas-acpi-at-max-.patch diff --git a/queue-5.15/tomoyo-check-exceeded-quota-early-in-tomoyo_domain_q.patch b/queue-5.15/tomoyo-check-exceeded-quota-early-in-tomoyo_domain_q.patch new file mode 100644 index 00000000000..d62db1fd82b --- /dev/null +++ b/queue-5.15/tomoyo-check-exceeded-quota-early-in-tomoyo_domain_q.patch @@ -0,0 +1,69 @@ +From 8c317b75abba79bec54eaaac5b2ec916f43f068c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Dec 2021 10:45:26 +0100 +Subject: tomoyo: Check exceeded quota early in tomoyo_domain_quota_is_ok(). + +From: Dmitry Vyukov + +[ Upstream commit 04e57a2d952bbd34bc45744e72be3eecdc344294 ] + +If tomoyo is used in a testing/fuzzing environment in learning mode, +for lots of domains the quota will be exceeded and stay exceeded +for prolonged periods of time. In such cases it's pointless (and slow) +to walk the whole acl list again and again just to rediscover that +the quota is exceeded. We already have the TOMOYO_DIF_QUOTA_WARNED flag +that notes the overflow condition. Check it early to avoid the slowdown. + +[penguin-kernel] +This patch causes a user visible change that the learning mode will not be +automatically resumed after the quota is increased. To resume the learning +mode, administrator will need to explicitly clear TOMOYO_DIF_QUOTA_WARNED +flag after increasing the quota. But I think that this change is generally +preferable, for administrator likely wants to optimize the acl list for +that domain before increasing the quota, or that domain likely hits the +quota again. Therefore, don't try to care to clear TOMOYO_DIF_QUOTA_WARNED +flag automatically when the quota for that domain changed. + +Signed-off-by: Dmitry Vyukov +Signed-off-by: Tetsuo Handa +Signed-off-by: Sasha Levin +--- + security/tomoyo/util.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/security/tomoyo/util.c b/security/tomoyo/util.c +index 1da2e3722b126..af8cd2af3466d 100644 +--- a/security/tomoyo/util.c ++++ b/security/tomoyo/util.c +@@ -1051,6 +1051,8 @@ bool tomoyo_domain_quota_is_ok(struct tomoyo_request_info *r) + return false; + if (!domain) + return true; ++ if (READ_ONCE(domain->flags[TOMOYO_DIF_QUOTA_WARNED])) ++ return false; + list_for_each_entry_rcu(ptr, &domain->acl_info_list, list, + srcu_read_lock_held(&tomoyo_ss)) { + u16 perm; +@@ -1096,14 +1098,12 @@ bool tomoyo_domain_quota_is_ok(struct tomoyo_request_info *r) + if (count < tomoyo_profile(domain->ns, domain->profile)-> + pref[TOMOYO_PREF_MAX_LEARNING_ENTRY]) + return true; +- if (!domain->flags[TOMOYO_DIF_QUOTA_WARNED]) { +- domain->flags[TOMOYO_DIF_QUOTA_WARNED] = true; +- /* r->granted = false; */ +- tomoyo_write_log(r, "%s", tomoyo_dif[TOMOYO_DIF_QUOTA_WARNED]); ++ WRITE_ONCE(domain->flags[TOMOYO_DIF_QUOTA_WARNED], true); ++ /* r->granted = false; */ ++ tomoyo_write_log(r, "%s", tomoyo_dif[TOMOYO_DIF_QUOTA_WARNED]); + #ifndef CONFIG_SECURITY_TOMOYO_INSECURE_BUILTIN_SETTING +- pr_warn("WARNING: Domain '%s' has too many ACLs to hold. Stopped learning mode.\n", +- domain->domainname->name); ++ pr_warn("WARNING: Domain '%s' has too many ACLs to hold. Stopped learning mode.\n", ++ domain->domainname->name); + #endif +- } + return false; + } +-- +2.34.1 + diff --git a/queue-5.15/tomoyo-use-hwight16-in-tomoyo_domain_quota_is_ok.patch b/queue-5.15/tomoyo-use-hwight16-in-tomoyo_domain_quota_is_ok.patch new file mode 100644 index 00000000000..9ea257da268 --- /dev/null +++ b/queue-5.15/tomoyo-use-hwight16-in-tomoyo_domain_quota_is_ok.patch @@ -0,0 +1,75 @@ +From e6e2c824cde1d967351438138102312e2521c72c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Dec 2021 20:13:55 +0900 +Subject: tomoyo: use hwight16() in tomoyo_domain_quota_is_ok() + +From: Tetsuo Handa + +[ Upstream commit f702e1107601230eec707739038a89018ea3468d ] + +hwight16() is much faster. While we are at it, no need to include +"perm =" part into data_race() macro, for perm is a local variable +that cannot be accessed by other threads. + +Signed-off-by: Tetsuo Handa +Signed-off-by: Sasha Levin +--- + security/tomoyo/util.c | 17 +++++++---------- + 1 file changed, 7 insertions(+), 10 deletions(-) + +diff --git a/security/tomoyo/util.c b/security/tomoyo/util.c +index af8cd2af3466d..6799b1122c9d8 100644 +--- a/security/tomoyo/util.c ++++ b/security/tomoyo/util.c +@@ -1056,7 +1056,6 @@ bool tomoyo_domain_quota_is_ok(struct tomoyo_request_info *r) + list_for_each_entry_rcu(ptr, &domain->acl_info_list, list, + srcu_read_lock_held(&tomoyo_ss)) { + u16 perm; +- u8 i; + + if (ptr->is_deleted) + continue; +@@ -1067,23 +1066,23 @@ bool tomoyo_domain_quota_is_ok(struct tomoyo_request_info *r) + */ + switch (ptr->type) { + case TOMOYO_TYPE_PATH_ACL: +- data_race(perm = container_of(ptr, struct tomoyo_path_acl, head)->perm); ++ perm = data_race(container_of(ptr, struct tomoyo_path_acl, head)->perm); + break; + case TOMOYO_TYPE_PATH2_ACL: +- data_race(perm = container_of(ptr, struct tomoyo_path2_acl, head)->perm); ++ perm = data_race(container_of(ptr, struct tomoyo_path2_acl, head)->perm); + break; + case TOMOYO_TYPE_PATH_NUMBER_ACL: +- data_race(perm = container_of(ptr, struct tomoyo_path_number_acl, head) ++ perm = data_race(container_of(ptr, struct tomoyo_path_number_acl, head) + ->perm); + break; + case TOMOYO_TYPE_MKDEV_ACL: +- data_race(perm = container_of(ptr, struct tomoyo_mkdev_acl, head)->perm); ++ perm = data_race(container_of(ptr, struct tomoyo_mkdev_acl, head)->perm); + break; + case TOMOYO_TYPE_INET_ACL: +- data_race(perm = container_of(ptr, struct tomoyo_inet_acl, head)->perm); ++ perm = data_race(container_of(ptr, struct tomoyo_inet_acl, head)->perm); + break; + case TOMOYO_TYPE_UNIX_ACL: +- data_race(perm = container_of(ptr, struct tomoyo_unix_acl, head)->perm); ++ perm = data_race(container_of(ptr, struct tomoyo_unix_acl, head)->perm); + break; + case TOMOYO_TYPE_MANUAL_TASK_ACL: + perm = 0; +@@ -1091,9 +1090,7 @@ bool tomoyo_domain_quota_is_ok(struct tomoyo_request_info *r) + default: + perm = 1; + } +- for (i = 0; i < 16; i++) +- if (perm & (1 << i)) +- count++; ++ count += hweight16(perm); + } + if (count < tomoyo_profile(domain->ns, domain->profile)-> + pref[TOMOYO_PREF_MAX_LEARNING_ENTRY]) +-- +2.34.1 + -- 2.47.3