From: Greg Kroah-Hartman Date: Wed, 4 Jan 2023 14:47:22 +0000 (+0100) Subject: 5.10-stable patches X-Git-Tag: v6.1.4~43 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f877c0f0808e4327d0b3546b277c95257decfa66;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: asoc-jz4740-i2s-handle-independent-fifo-flush-bits.patch crypto-n2-add-missing-hash-statesize.patch device_cgroup-roll-back-to-original-exceptions-after-copy-failure.patch driver-core-fix-bus_type.match-error-handling-in-__driver_attach.patch drm-connector-send-hotplug-uevent-on-connector-cleanup.patch drm-i915-dsi-fix-vbt-send-packet-port-selection-for-dual-link-dsi.patch drm-ingenic-fix-missing-platform_driver_unregister-call-in-ingenic_drm_init.patch drm-vmwgfx-validate-the-box-size-for-the-snooped-cursor.patch efi-add-imac-pro-2017-to-uefi-skip-cert-quirk.patch ima-fix-a-potential-null-pointer-access-in-ima_restore_measurement_list.patch iommu-amd-fix-ivrs_acpihid-cmdline-parsing-code.patch ipmi-fix-long-wait-in-unload-when-ipmi-disconnect.patch ipmi-fix-use-after-free-in-_ipmi_destroy_user.patch md-bitmap-fix-bitmap-chunk-size-overflow-issues.patch mtd-spi-nor-check-for-zero-erase-size-in-spi_nor_find_best_erase_type.patch parisc-led-fix-potential-null-ptr-deref-in-start_task.patch pci-fix-pci_device_is_present-for-vfs-by-checking-pf.patch pci-sysfs-fix-double-free-in-error-path.patch remoteproc-core-do-pm_relax-when-in-rproc_offline-state.patch wifi-wilc1000-sdio-fix-module-autoloading.patch --- diff --git a/queue-5.10/asoc-jz4740-i2s-handle-independent-fifo-flush-bits.patch b/queue-5.10/asoc-jz4740-i2s-handle-independent-fifo-flush-bits.patch new file mode 100644 index 00000000000..8c73b831086 --- /dev/null +++ b/queue-5.10/asoc-jz4740-i2s-handle-independent-fifo-flush-bits.patch @@ -0,0 +1,112 @@ +From 8b3a9ad86239f80ed569e23c3954a311f66481d6 Mon Sep 17 00:00:00 2001 +From: Aidan MacDonald +Date: Sun, 23 Oct 2022 15:33:20 +0100 +Subject: ASoC: jz4740-i2s: Handle independent FIFO flush bits + +From: Aidan MacDonald + +commit 8b3a9ad86239f80ed569e23c3954a311f66481d6 upstream. + +On the JZ4740, there is a single bit that flushes (empties) both +the transmit and receive FIFO. Later SoCs have independent flush +bits for each FIFO. + +Independent FIFOs can be flushed before the snd_soc_dai_active() +check because it won't disturb other active streams. This ensures +that the FIFO we're about to use is always flushed before starting +up. With shared FIFOs we can't do that because if another substream +is active, flushing its FIFO would cause underrun errors. + +This also fixes a bug: since we were only setting the JZ4740's +flush bit, which corresponds to the TX FIFO flush bit on other +SoCs, other SoCs were not having their RX FIFO flushed at all. + +Fixes: 967beb2e8777 ("ASoC: jz4740: Add jz4780 support") +Reviewed-by: Paul Cercueil +Cc: stable@vger.kernel.org +Signed-off-by: Aidan MacDonald +Link: https://lore.kernel.org/r/20221023143328.160866-2-aidanmacdonald.0x0@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman +--- + sound/soc/jz4740/jz4740-i2s.c | 39 ++++++++++++++++++++++++++++++++++----- + 1 file changed, 34 insertions(+), 5 deletions(-) + +--- a/sound/soc/jz4740/jz4740-i2s.c ++++ b/sound/soc/jz4740/jz4740-i2s.c +@@ -59,7 +59,8 @@ + #define JZ_AIC_CTRL_MONO_TO_STEREO BIT(11) + #define JZ_AIC_CTRL_SWITCH_ENDIANNESS BIT(10) + #define JZ_AIC_CTRL_SIGNED_TO_UNSIGNED BIT(9) +-#define JZ_AIC_CTRL_FLUSH BIT(8) ++#define JZ_AIC_CTRL_TFLUSH BIT(8) ++#define JZ_AIC_CTRL_RFLUSH BIT(7) + #define JZ_AIC_CTRL_ENABLE_ROR_INT BIT(6) + #define JZ_AIC_CTRL_ENABLE_TUR_INT BIT(5) + #define JZ_AIC_CTRL_ENABLE_RFS_INT BIT(4) +@@ -94,6 +95,8 @@ enum jz47xx_i2s_version { + struct i2s_soc_info { + enum jz47xx_i2s_version version; + struct snd_soc_dai_driver *dai; ++ ++ bool shared_fifo_flush; + }; + + struct jz4740_i2s { +@@ -122,19 +125,44 @@ static inline void jz4740_i2s_write(cons + writel(value, i2s->base + reg); + } + ++static inline void jz4740_i2s_set_bits(const struct jz4740_i2s *i2s, ++ unsigned int reg, uint32_t bits) ++{ ++ uint32_t value = jz4740_i2s_read(i2s, reg); ++ value |= bits; ++ jz4740_i2s_write(i2s, reg, value); ++} ++ + static int jz4740_i2s_startup(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) + { + struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); +- uint32_t conf, ctrl; ++ uint32_t conf; + int ret; + ++ /* ++ * When we can flush FIFOs independently, only flush the FIFO ++ * that is starting up. We can do this when the DAI is active ++ * because it does not disturb other active substreams. ++ */ ++ if (!i2s->soc_info->shared_fifo_flush) { ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ++ jz4740_i2s_set_bits(i2s, JZ_REG_AIC_CTRL, JZ_AIC_CTRL_TFLUSH); ++ else ++ jz4740_i2s_set_bits(i2s, JZ_REG_AIC_CTRL, JZ_AIC_CTRL_RFLUSH); ++ } ++ + if (snd_soc_dai_active(dai)) + return 0; + +- ctrl = jz4740_i2s_read(i2s, JZ_REG_AIC_CTRL); +- ctrl |= JZ_AIC_CTRL_FLUSH; +- jz4740_i2s_write(i2s, JZ_REG_AIC_CTRL, ctrl); ++ /* ++ * When there is a shared flush bit for both FIFOs, the TFLUSH ++ * bit flushes both FIFOs. Flushing while the DAI is active would ++ * cause FIFO underruns in other active substreams so we have to ++ * guard this behind the snd_soc_dai_active() check. ++ */ ++ if (i2s->soc_info->shared_fifo_flush) ++ jz4740_i2s_set_bits(i2s, JZ_REG_AIC_CTRL, JZ_AIC_CTRL_TFLUSH); + + ret = clk_prepare_enable(i2s->clk_i2s); + if (ret) +@@ -467,6 +495,7 @@ static struct snd_soc_dai_driver jz4740_ + static const struct i2s_soc_info jz4740_i2s_soc_info = { + .version = JZ_I2S_JZ4740, + .dai = &jz4740_i2s_dai, ++ .shared_fifo_flush = true, + }; + + static const struct i2s_soc_info jz4760_i2s_soc_info = { diff --git a/queue-5.10/crypto-n2-add-missing-hash-statesize.patch b/queue-5.10/crypto-n2-add-missing-hash-statesize.patch new file mode 100644 index 00000000000..8f5a3a7e614 --- /dev/null +++ b/queue-5.10/crypto-n2-add-missing-hash-statesize.patch @@ -0,0 +1,74 @@ +From 76a4e874593543a2dff91d249c95bac728df2774 Mon Sep 17 00:00:00 2001 +From: Corentin Labbe +Date: Thu, 6 Oct 2022 04:34:19 +0000 +Subject: crypto: n2 - add missing hash statesize + +From: Corentin Labbe + +commit 76a4e874593543a2dff91d249c95bac728df2774 upstream. + +Add missing statesize to hash templates. +This is mandatory otherwise no algorithms can be registered as the core +requires statesize to be set. + +CC: stable@kernel.org # 4.3+ +Reported-by: Rolf Eike Beer +Tested-by: Rolf Eike Beer +Fixes: 0a625fd2abaa ("crypto: n2 - Add Niagara2 crypto driver") +Signed-off-by: Corentin Labbe +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman +--- + drivers/crypto/n2_core.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/crypto/n2_core.c ++++ b/drivers/crypto/n2_core.c +@@ -1228,6 +1228,7 @@ struct n2_hash_tmpl { + const u8 *hash_init; + u8 hw_op_hashsz; + u8 digest_size; ++ u8 statesize; + u8 block_size; + u8 auth_type; + u8 hmac_type; +@@ -1259,6 +1260,7 @@ static const struct n2_hash_tmpl hash_tm + .hmac_type = AUTH_TYPE_HMAC_MD5, + .hw_op_hashsz = MD5_DIGEST_SIZE, + .digest_size = MD5_DIGEST_SIZE, ++ .statesize = sizeof(struct md5_state), + .block_size = MD5_HMAC_BLOCK_SIZE }, + { .name = "sha1", + .hash_zero = sha1_zero_message_hash, +@@ -1267,6 +1269,7 @@ static const struct n2_hash_tmpl hash_tm + .hmac_type = AUTH_TYPE_HMAC_SHA1, + .hw_op_hashsz = SHA1_DIGEST_SIZE, + .digest_size = SHA1_DIGEST_SIZE, ++ .statesize = sizeof(struct sha1_state), + .block_size = SHA1_BLOCK_SIZE }, + { .name = "sha256", + .hash_zero = sha256_zero_message_hash, +@@ -1275,6 +1278,7 @@ static const struct n2_hash_tmpl hash_tm + .hmac_type = AUTH_TYPE_HMAC_SHA256, + .hw_op_hashsz = SHA256_DIGEST_SIZE, + .digest_size = SHA256_DIGEST_SIZE, ++ .statesize = sizeof(struct sha256_state), + .block_size = SHA256_BLOCK_SIZE }, + { .name = "sha224", + .hash_zero = sha224_zero_message_hash, +@@ -1283,6 +1287,7 @@ static const struct n2_hash_tmpl hash_tm + .hmac_type = AUTH_TYPE_RESERVED, + .hw_op_hashsz = SHA256_DIGEST_SIZE, + .digest_size = SHA224_DIGEST_SIZE, ++ .statesize = sizeof(struct sha256_state), + .block_size = SHA224_BLOCK_SIZE }, + }; + #define NUM_HASH_TMPLS ARRAY_SIZE(hash_tmpls) +@@ -1423,6 +1428,7 @@ static int __n2_register_one_ahash(const + + halg = &ahash->halg; + halg->digestsize = tmpl->digest_size; ++ halg->statesize = tmpl->statesize; + + base = &halg->base; + snprintf(base->cra_name, CRYPTO_MAX_ALG_NAME, "%s", tmpl->name); diff --git a/queue-5.10/device_cgroup-roll-back-to-original-exceptions-after-copy-failure.patch b/queue-5.10/device_cgroup-roll-back-to-original-exceptions-after-copy-failure.patch new file mode 100644 index 00000000000..5b4000781b9 --- /dev/null +++ b/queue-5.10/device_cgroup-roll-back-to-original-exceptions-after-copy-failure.patch @@ -0,0 +1,95 @@ +From e68bfbd3b3c3a0ec3cf8c230996ad8cabe90322f Mon Sep 17 00:00:00 2001 +From: Wang Weiyang +Date: Tue, 25 Oct 2022 19:31:01 +0800 +Subject: device_cgroup: Roll back to original exceptions after copy failure + +From: Wang Weiyang + +commit e68bfbd3b3c3a0ec3cf8c230996ad8cabe90322f upstream. + +When add the 'a *:* rwm' entry to devcgroup A's whitelist, at first A's +exceptions will be cleaned and A's behavior is changed to +DEVCG_DEFAULT_ALLOW. Then parent's exceptions will be copyed to A's +whitelist. If copy failure occurs, just return leaving A to grant +permissions to all devices. And A may grant more permissions than +parent. + +Backup A's whitelist and recover original exceptions after copy +failure. + +Cc: stable@vger.kernel.org +Fixes: 4cef7299b478 ("device_cgroup: add proper checking when changing default behavior") +Signed-off-by: Wang Weiyang +Reviewed-by: Aristeu Rozanski +Signed-off-by: Paul Moore +Signed-off-by: Greg Kroah-Hartman +--- + security/device_cgroup.c | 33 +++++++++++++++++++++++++++++---- + 1 file changed, 29 insertions(+), 4 deletions(-) + +--- a/security/device_cgroup.c ++++ b/security/device_cgroup.c +@@ -81,6 +81,17 @@ free_and_exit: + return -ENOMEM; + } + ++static void dev_exceptions_move(struct list_head *dest, struct list_head *orig) ++{ ++ struct dev_exception_item *ex, *tmp; ++ ++ lockdep_assert_held(&devcgroup_mutex); ++ ++ list_for_each_entry_safe(ex, tmp, orig, list) { ++ list_move_tail(&ex->list, dest); ++ } ++} ++ + /* + * called under devcgroup_mutex + */ +@@ -603,11 +614,13 @@ static int devcgroup_update_access(struc + int count, rc = 0; + struct dev_exception_item ex; + struct dev_cgroup *parent = css_to_devcgroup(devcgroup->css.parent); ++ struct dev_cgroup tmp_devcgrp; + + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + + memset(&ex, 0, sizeof(ex)); ++ memset(&tmp_devcgrp, 0, sizeof(tmp_devcgrp)); + b = buffer; + + switch (*b) { +@@ -619,15 +632,27 @@ static int devcgroup_update_access(struc + + if (!may_allow_all(parent)) + return -EPERM; +- dev_exception_clean(devcgroup); +- devcgroup->behavior = DEVCG_DEFAULT_ALLOW; +- if (!parent) ++ if (!parent) { ++ devcgroup->behavior = DEVCG_DEFAULT_ALLOW; ++ dev_exception_clean(devcgroup); + break; ++ } + ++ INIT_LIST_HEAD(&tmp_devcgrp.exceptions); ++ rc = dev_exceptions_copy(&tmp_devcgrp.exceptions, ++ &devcgroup->exceptions); ++ if (rc) ++ return rc; ++ dev_exception_clean(devcgroup); + rc = dev_exceptions_copy(&devcgroup->exceptions, + &parent->exceptions); +- if (rc) ++ if (rc) { ++ dev_exceptions_move(&devcgroup->exceptions, ++ &tmp_devcgrp.exceptions); + return rc; ++ } ++ devcgroup->behavior = DEVCG_DEFAULT_ALLOW; ++ dev_exception_clean(&tmp_devcgrp); + break; + case DEVCG_DENY: + if (css_has_online_children(&devcgroup->css)) diff --git a/queue-5.10/driver-core-fix-bus_type.match-error-handling-in-__driver_attach.patch b/queue-5.10/driver-core-fix-bus_type.match-error-handling-in-__driver_attach.patch new file mode 100644 index 00000000000..c66d33a6714 --- /dev/null +++ b/queue-5.10/driver-core-fix-bus_type.match-error-handling-in-__driver_attach.patch @@ -0,0 +1,46 @@ +From 27c0d217340e47ec995557f61423ef415afba987 Mon Sep 17 00:00:00 2001 +From: "Isaac J. Manjarres" +Date: Tue, 20 Sep 2022 17:14:13 -0700 +Subject: driver core: Fix bus_type.match() error handling in __driver_attach() + +From: Isaac J. Manjarres + +commit 27c0d217340e47ec995557f61423ef415afba987 upstream. + +When a driver registers with a bus, it will attempt to match with every +device on the bus through the __driver_attach() function. Currently, if +the bus_type.match() function encounters an error that is not +-EPROBE_DEFER, __driver_attach() will return a negative error code, which +causes the driver registration logic to stop trying to match with the +remaining devices on the bus. + +This behavior is not correct; a failure while matching a driver to a +device does not mean that the driver won't be able to match and bind +with other devices on the bus. Update the logic in __driver_attach() +to reflect this. + +Fixes: 656b8035b0ee ("ARM: 8524/1: driver cohandle -EPROBE_DEFER from bus_type.match()") +Cc: stable@vger.kernel.org +Cc: Saravana Kannan +Signed-off-by: Isaac J. Manjarres +Link: https://lore.kernel.org/r/20220921001414.4046492-1-isaacmanjarres@google.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/base/dd.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/base/dd.c ++++ b/drivers/base/dd.c +@@ -1088,7 +1088,11 @@ static int __driver_attach(struct device + return 0; + } else if (ret < 0) { + dev_dbg(dev, "Bus failed to match device: %d\n", ret); +- return ret; ++ /* ++ * Driver could not match with device, but may match with ++ * another device on the bus. ++ */ ++ return 0; + } /* ret > 0 means positive match */ + + if (driver_allows_async_probing(drv)) { diff --git a/queue-5.10/drm-connector-send-hotplug-uevent-on-connector-cleanup.patch b/queue-5.10/drm-connector-send-hotplug-uevent-on-connector-cleanup.patch new file mode 100644 index 00000000000..edbd72d93ec --- /dev/null +++ b/queue-5.10/drm-connector-send-hotplug-uevent-on-connector-cleanup.patch @@ -0,0 +1,59 @@ +From 6fdc2d490ea1369d17afd7e6eb66fecc5b7209bc Mon Sep 17 00:00:00 2001 +From: Simon Ser +Date: Mon, 17 Oct 2022 15:32:01 +0000 +Subject: drm/connector: send hotplug uevent on connector cleanup +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Simon Ser + +commit 6fdc2d490ea1369d17afd7e6eb66fecc5b7209bc upstream. + +A typical DP-MST unplug removes a KMS connector. However care must +be taken to properly synchronize with user-space. The expected +sequence of events is the following: + +1. The kernel notices that the DP-MST port is gone. +2. The kernel marks the connector as disconnected, then sends a + uevent to make user-space re-scan the connector list. +3. User-space notices the connector goes from connected to disconnected, + disables it. +4. Kernel handles the IOCTL disabling the connector. On success, + the very last reference to the struct drm_connector is dropped and + drm_connector_cleanup() is called. +5. The connector is removed from the list, and a uevent is sent to tell + user-space that the connector disappeared. + +The very last step was missing. As a result, user-space thought the +connector still existed and could try to disable it again. Since the +kernel no longer knows about the connector, that would end up with +EINVAL and confused user-space. + +Fix this by sending a hotplug uevent from drm_connector_cleanup(). + +Signed-off-by: Simon Ser +Cc: stable@vger.kernel.org +Cc: Daniel Vetter +Cc: Lyude Paul +Cc: Jonas Ådahl +Tested-by: Jonas Ådahl +Reviewed-by: Lyude Paul +Link: https://patchwork.freedesktop.org/patch/msgid/20221017153150.60675-2-contact@emersion.fr +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/drm_connector.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/gpu/drm/drm_connector.c ++++ b/drivers/gpu/drm/drm_connector.c +@@ -484,6 +484,9 @@ void drm_connector_cleanup(struct drm_co + mutex_destroy(&connector->mutex); + + memset(connector, 0, sizeof(*connector)); ++ ++ if (dev->registered) ++ drm_sysfs_hotplug_event(dev); + } + EXPORT_SYMBOL(drm_connector_cleanup); + diff --git a/queue-5.10/drm-i915-dsi-fix-vbt-send-packet-port-selection-for-dual-link-dsi.patch b/queue-5.10/drm-i915-dsi-fix-vbt-send-packet-port-selection-for-dual-link-dsi.patch new file mode 100644 index 00000000000..78eba9c1c33 --- /dev/null +++ b/queue-5.10/drm-i915-dsi-fix-vbt-send-packet-port-selection-for-dual-link-dsi.patch @@ -0,0 +1,40 @@ +From f9cdf4130671d767071607d0a7568c9bd36a68d0 Mon Sep 17 00:00:00 2001 +From: Mikko Kovanen +Date: Sat, 26 Nov 2022 13:27:13 +0000 +Subject: drm/i915/dsi: fix VBT send packet port selection for dual link DSI + +From: Mikko Kovanen + +commit f9cdf4130671d767071607d0a7568c9bd36a68d0 upstream. + +intel_dsi->ports contains bitmask of enabled ports and correspondingly +logic for selecting port for VBT packet sending must use port specific +bitmask when deciding appropriate port. + +Fixes: 08c59dde71b7 ("drm/i915/dsi: fix VBT send packet port selection for ICL+") +Cc: stable@vger.kernel.org +Signed-off-by: Mikko Kovanen +Reviewed-by: Jani Nikula +Signed-off-by: Jani Nikula +Link: https://patchwork.freedesktop.org/patch/msgid/DBBPR09MB466592B16885D99ABBF2393A91119@DBBPR09MB4665.eurprd09.prod.outlook.com +(cherry picked from commit 8d58bb7991c45f6b60710cc04c9498c6ea96db90) +Signed-off-by: Rodrigo Vivi +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c ++++ b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c +@@ -133,9 +133,9 @@ static enum port intel_dsi_seq_port_to_p + return ffs(intel_dsi->ports) - 1; + + if (seq_port) { +- if (intel_dsi->ports & PORT_B) ++ if (intel_dsi->ports & BIT(PORT_B)) + return PORT_B; +- else if (intel_dsi->ports & PORT_C) ++ else if (intel_dsi->ports & BIT(PORT_C)) + return PORT_C; + } + diff --git a/queue-5.10/drm-ingenic-fix-missing-platform_driver_unregister-call-in-ingenic_drm_init.patch b/queue-5.10/drm-ingenic-fix-missing-platform_driver_unregister-call-in-ingenic_drm_init.patch new file mode 100644 index 00000000000..ab64006cf6e --- /dev/null +++ b/queue-5.10/drm-ingenic-fix-missing-platform_driver_unregister-call-in-ingenic_drm_init.patch @@ -0,0 +1,58 @@ +From 47078311b8efebdefd5b3b2f87e2b02b14f49c66 Mon Sep 17 00:00:00 2001 +From: Yuan Can +Date: Fri, 4 Nov 2022 06:45:12 +0000 +Subject: drm/ingenic: Fix missing platform_driver_unregister() call in ingenic_drm_init() + +From: Yuan Can + +commit 47078311b8efebdefd5b3b2f87e2b02b14f49c66 upstream. + +A problem about modprobe ingenic-drm failed is triggered with the following +log given: + + [ 303.561088] Error: Driver 'ingenic-ipu' is already registered, aborting... + modprobe: ERROR: could not insert 'ingenic_drm': Device or resource busy + +The reason is that ingenic_drm_init() returns platform_driver_register() +directly without checking its return value, if platform_driver_register() +failed, it returns without unregistering ingenic_ipu_driver_ptr, resulting +the ingenic-drm can never be installed later. +A simple call graph is shown as below: + + ingenic_drm_init() + platform_driver_register() # ingenic_ipu_driver_ptr are registered + platform_driver_register() + driver_register() + bus_add_driver() + priv = kzalloc(...) # OOM happened + # return without unregister ingenic_ipu_driver_ptr + +Fixing this problem by checking the return value of +platform_driver_register() and do platform_unregister_drivers() if +error happened. + +Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU") +Signed-off-by: Yuan Can +Cc: stable@vger.kernel.org +Signed-off-by: Paul Cercueil +Link: https://patchwork.freedesktop.org/patch/msgid/20221104064512.8569-1-yuancan@huawei.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c ++++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +@@ -1120,7 +1120,11 @@ static int ingenic_drm_init(void) + return err; + } + +- return platform_driver_register(&ingenic_drm_driver); ++ err = platform_driver_register(&ingenic_drm_driver); ++ if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU) && err) ++ platform_driver_unregister(ingenic_ipu_driver_ptr); ++ ++ return err; + } + module_init(ingenic_drm_init); + diff --git a/queue-5.10/drm-vmwgfx-validate-the-box-size-for-the-snooped-cursor.patch b/queue-5.10/drm-vmwgfx-validate-the-box-size-for-the-snooped-cursor.patch new file mode 100644 index 00000000000..cd038eb3440 --- /dev/null +++ b/queue-5.10/drm-vmwgfx-validate-the-box-size-for-the-snooped-cursor.patch @@ -0,0 +1,37 @@ +From 4cf949c7fafe21e085a4ee386bb2dade9067316e Mon Sep 17 00:00:00 2001 +From: Zack Rusin +Date: Tue, 25 Oct 2022 23:19:35 -0400 +Subject: drm/vmwgfx: Validate the box size for the snooped cursor + +From: Zack Rusin + +commit 4cf949c7fafe21e085a4ee386bb2dade9067316e upstream. + +Invalid userspace dma surface copies could potentially overflow +the memcpy from the surface to the snooped image leading to crashes. +To fix it the dimensions of the copybox have to be validated +against the expected size of the snooped cursor. + +Signed-off-by: Zack Rusin +Fixes: 2ac863719e51 ("vmwgfx: Snoop DMA transfers with non-covering sizes") +Cc: # v3.2+ +Reviewed-by: Michael Banack +Reviewed-by: Martin Krastev +Link: https://patchwork.freedesktop.org/patch/msgid/20221026031936.1004280-1-zack@kde.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +@@ -182,7 +182,8 @@ void vmw_kms_cursor_snoop(struct vmw_sur + if (cmd->dma.guest.ptr.offset % PAGE_SIZE || + box->x != 0 || box->y != 0 || box->z != 0 || + box->srcx != 0 || box->srcy != 0 || box->srcz != 0 || +- box->d != 1 || box_count != 1) { ++ box->d != 1 || box_count != 1 || ++ box->w > 64 || box->h > 64) { + /* TODO handle none page aligned offsets */ + /* TODO handle more dst & src != 0 */ + /* TODO handle more then one copy */ diff --git a/queue-5.10/efi-add-imac-pro-2017-to-uefi-skip-cert-quirk.patch b/queue-5.10/efi-add-imac-pro-2017-to-uefi-skip-cert-quirk.patch new file mode 100644 index 00000000000..44ea5140620 --- /dev/null +++ b/queue-5.10/efi-add-imac-pro-2017-to-uefi-skip-cert-quirk.patch @@ -0,0 +1,32 @@ +From 0be56a116220f9e5731a6609e66a11accfe8d8e2 Mon Sep 17 00:00:00 2001 +From: Aditya Garg +Date: Thu, 27 Oct 2022 10:01:43 +0000 +Subject: efi: Add iMac Pro 2017 to uefi skip cert quirk + +From: Aditya Garg + +commit 0be56a116220f9e5731a6609e66a11accfe8d8e2 upstream. + +The iMac Pro 2017 is also a T2 Mac. Thus add it to the list of uefi skip +cert. + +Cc: stable@vger.kernel.org +Fixes: 155ca952c7ca ("efi: Do not import certificates from UEFI Secure Boot for T2 Macs") +Link: https://lore.kernel.org/linux-integrity/9D46D92F-1381-4F10-989C-1A12CD2FFDD8@live.com/ +Signed-off-by: Aditya Garg +Signed-off-by: Mimi Zohar +Signed-off-by: Greg Kroah-Hartman +--- + security/integrity/platform_certs/load_uefi.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/security/integrity/platform_certs/load_uefi.c ++++ b/security/integrity/platform_certs/load_uefi.c +@@ -34,6 +34,7 @@ static const struct dmi_system_id uefi_s + { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacPro7,1") }, + { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "iMac20,1") }, + { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "iMac20,2") }, ++ { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "iMacPro1,1") }, + { } + }; + diff --git a/queue-5.10/ima-fix-a-potential-null-pointer-access-in-ima_restore_measurement_list.patch b/queue-5.10/ima-fix-a-potential-null-pointer-access-in-ima_restore_measurement_list.patch new file mode 100644 index 00000000000..4c0b866694d --- /dev/null +++ b/queue-5.10/ima-fix-a-potential-null-pointer-access-in-ima_restore_measurement_list.patch @@ -0,0 +1,39 @@ +From 11220db412edae8dba58853238f53258268bdb88 Mon Sep 17 00:00:00 2001 +From: Huaxin Lu +Date: Thu, 3 Nov 2022 00:09:49 +0800 +Subject: ima: Fix a potential NULL pointer access in ima_restore_measurement_list + +From: Huaxin Lu + +commit 11220db412edae8dba58853238f53258268bdb88 upstream. + +In restore_template_fmt, when kstrdup fails, a non-NULL value will still be +returned, which causes a NULL pointer access in template_desc_init_fields. + +Fixes: c7d09367702e ("ima: support restoring multiple template formats") +Cc: stable@kernel.org +Co-developed-by: Jiaming Li +Signed-off-by: Jiaming Li +Signed-off-by: Huaxin Lu +Reviewed-by: Stefan Berger +Signed-off-by: Mimi Zohar +Signed-off-by: Greg Kroah-Hartman +--- + security/integrity/ima/ima_template.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/security/integrity/ima/ima_template.c ++++ b/security/integrity/ima/ima_template.c +@@ -290,8 +290,11 @@ static struct ima_template_desc *restore + + template_desc->name = ""; + template_desc->fmt = kstrdup(template_name, GFP_KERNEL); +- if (!template_desc->fmt) ++ if (!template_desc->fmt) { ++ kfree(template_desc); ++ template_desc = NULL; + goto out; ++ } + + spin_lock(&template_list); + list_add_tail_rcu(&template_desc->list, &defined_templates); diff --git a/queue-5.10/iommu-amd-fix-ivrs_acpihid-cmdline-parsing-code.patch b/queue-5.10/iommu-amd-fix-ivrs_acpihid-cmdline-parsing-code.patch new file mode 100644 index 00000000000..55dd87f72ce --- /dev/null +++ b/queue-5.10/iommu-amd-fix-ivrs_acpihid-cmdline-parsing-code.patch @@ -0,0 +1,45 @@ +From 5f18e9f8868c6d4eae71678e7ebd4977b7d8c8cf Mon Sep 17 00:00:00 2001 +From: Kim Phillips +Date: Mon, 19 Sep 2022 10:56:37 -0500 +Subject: iommu/amd: Fix ivrs_acpihid cmdline parsing code + +From: Kim Phillips + +commit 5f18e9f8868c6d4eae71678e7ebd4977b7d8c8cf upstream. + +The second (UID) strcmp in acpi_dev_hid_uid_match considers +"0" and "00" different, which can prevent device registration. + +Have the AMD IOMMU driver's ivrs_acpihid parsing code remove +any leading zeroes to make the UID strcmp succeed. Now users +can safely specify "AMDxxxxx:00" or "AMDxxxxx:0" and expect +the same behaviour. + +Fixes: ca3bf5d47cec ("iommu/amd: Introduces ivrs_acpihid kernel parameter") +Signed-off-by: Kim Phillips +Cc: stable@vger.kernel.org +Cc: Suravee Suthikulpanit +Cc: Joerg Roedel +Link: https://lore.kernel.org/r/20220919155638.391481-1-kim.phillips@amd.com +Signed-off-by: Joerg Roedel +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iommu/amd/init.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/iommu/amd/init.c ++++ b/drivers/iommu/amd/init.c +@@ -3126,6 +3126,13 @@ static int __init parse_ivrs_acpihid(cha + return 1; + } + ++ /* ++ * Ignore leading zeroes after ':', so e.g., AMDI0095:00 ++ * will match AMDI0095:0 in the second strcmp in acpi_dev_hid_uid_match ++ */ ++ while (*uid == '0' && *(uid + 1)) ++ uid++; ++ + i = early_acpihid_map_size++; + memcpy(early_acpihid_map[i].hid, hid, strlen(hid)); + memcpy(early_acpihid_map[i].uid, uid, strlen(uid)); diff --git a/queue-5.10/ipmi-fix-long-wait-in-unload-when-ipmi-disconnect.patch b/queue-5.10/ipmi-fix-long-wait-in-unload-when-ipmi-disconnect.patch new file mode 100644 index 00000000000..81127023784 --- /dev/null +++ b/queue-5.10/ipmi-fix-long-wait-in-unload-when-ipmi-disconnect.patch @@ -0,0 +1,94 @@ +From f6f1234d98cce69578bfac79df147a1f6660596c Mon Sep 17 00:00:00 2001 +From: Zhang Yuchen +Date: Fri, 7 Oct 2022 17:26:16 +0800 +Subject: ipmi: fix long wait in unload when IPMI disconnect + +From: Zhang Yuchen + +commit f6f1234d98cce69578bfac79df147a1f6660596c upstream. + +When fixing the problem mentioned in PATCH1, we also found +the following problem: + +If the IPMI is disconnected and in the sending process, the +uninstallation driver will be stuck for a long time. + +The main problem is that uninstalling the driver waits for curr_msg to +be sent or HOSED. After stopping tasklet, the only place to trigger the +timeout mechanism is the circular poll in shutdown_smi. + +The poll function delays 10us and calls smi_event_handler(smi_info,10). +Smi_event_handler deducts 10us from kcs->ibf_timeout. + +But the poll func is followed by schedule_timeout_uninterruptible(1). +The time consumed here is not counted in kcs->ibf_timeout. + +So when 10us is deducted from kcs->ibf_timeout, at least 1 jiffies has +actually passed. The waiting time has increased by more than a +hundredfold. + +Now instead of calling poll(). call smi_event_handler() directly and +calculate the elapsed time. + +For verification, you can directly use ebpf to check the kcs-> +ibf_timeout for each call to kcs_event() when IPMI is disconnected. +Decrement at normal rate before unloading. The decrement rate becomes +very slow after unloading. + + $ bpftrace -e 'kprobe:kcs_event {printf("kcs->ibftimeout : %d\n", + *(arg0+584));}' + +Signed-off-by: Zhang Yuchen +Message-Id: <20221007092617.87597-3-zhangyuchen.lcr@bytedance.com> +Signed-off-by: Corey Minyard +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/char/ipmi/ipmi_si_intf.c | 27 +++++++++++++++++++-------- + 1 file changed, 19 insertions(+), 8 deletions(-) + +--- a/drivers/char/ipmi/ipmi_si_intf.c ++++ b/drivers/char/ipmi/ipmi_si_intf.c +@@ -2160,6 +2160,20 @@ skip_fallback_noirq: + } + module_init(init_ipmi_si); + ++static void wait_msg_processed(struct smi_info *smi_info) ++{ ++ unsigned long jiffies_now; ++ long time_diff; ++ ++ while (smi_info->curr_msg || (smi_info->si_state != SI_NORMAL)) { ++ jiffies_now = jiffies; ++ time_diff = (((long)jiffies_now - (long)smi_info->last_timeout_jiffies) ++ * SI_USEC_PER_JIFFY); ++ smi_event_handler(smi_info, time_diff); ++ schedule_timeout_uninterruptible(1); ++ } ++} ++ + static void shutdown_smi(void *send_info) + { + struct smi_info *smi_info = send_info; +@@ -2194,16 +2208,13 @@ static void shutdown_smi(void *send_info + * in the BMC. Note that timers and CPU interrupts are off, + * so no need for locks. + */ +- while (smi_info->curr_msg || (smi_info->si_state != SI_NORMAL)) { +- poll(smi_info); +- schedule_timeout_uninterruptible(1); +- } ++ wait_msg_processed(smi_info); ++ + if (smi_info->handlers) + disable_si_irq(smi_info); +- while (smi_info->curr_msg || (smi_info->si_state != SI_NORMAL)) { +- poll(smi_info); +- schedule_timeout_uninterruptible(1); +- } ++ ++ wait_msg_processed(smi_info); ++ + if (smi_info->handlers) + smi_info->handlers->cleanup(smi_info->si_sm); + diff --git a/queue-5.10/ipmi-fix-use-after-free-in-_ipmi_destroy_user.patch b/queue-5.10/ipmi-fix-use-after-free-in-_ipmi_destroy_user.patch new file mode 100644 index 00000000000..5e4c42c56cb --- /dev/null +++ b/queue-5.10/ipmi-fix-use-after-free-in-_ipmi_destroy_user.patch @@ -0,0 +1,43 @@ +From a92ce570c81dc0feaeb12a429b4bc65686d17967 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Tue, 15 Nov 2022 16:17:43 +0300 +Subject: ipmi: fix use after free in _ipmi_destroy_user() + +From: Dan Carpenter + +commit a92ce570c81dc0feaeb12a429b4bc65686d17967 upstream. + +The intf_free() function frees the "intf" pointer so we cannot +dereference it again on the next line. + +Fixes: cbb79863fc31 ("ipmi: Don't allow device module unload when in use") +Signed-off-by: Dan Carpenter +Message-Id: +Cc: # 5.5+ +Signed-off-by: Corey Minyard +Signed-off-by: Greg Kroah-Hartman +--- + drivers/char/ipmi/ipmi_msghandler.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/char/ipmi/ipmi_msghandler.c ++++ b/drivers/char/ipmi/ipmi_msghandler.c +@@ -1284,6 +1284,7 @@ static void _ipmi_destroy_user(struct ip + unsigned long flags; + struct cmd_rcvr *rcvr; + struct cmd_rcvr *rcvrs = NULL; ++ struct module *owner; + + if (!acquire_ipmi_user(user, &i)) { + /* +@@ -1345,8 +1346,9 @@ static void _ipmi_destroy_user(struct ip + kfree(rcvr); + } + ++ owner = intf->owner; + kref_put(&intf->refcount, intf_free); +- module_put(intf->owner); ++ module_put(owner); + } + + int ipmi_destroy_user(struct ipmi_user *user) diff --git a/queue-5.10/md-bitmap-fix-bitmap-chunk-size-overflow-issues.patch b/queue-5.10/md-bitmap-fix-bitmap-chunk-size-overflow-issues.patch new file mode 100644 index 00000000000..cc1036ffa20 --- /dev/null +++ b/queue-5.10/md-bitmap-fix-bitmap-chunk-size-overflow-issues.patch @@ -0,0 +1,99 @@ +From 4555211190798b6b6fa2c37667d175bf67945c78 Mon Sep 17 00:00:00 2001 +From: Florian-Ewald Mueller +Date: Tue, 25 Oct 2022 09:37:05 +0200 +Subject: md/bitmap: Fix bitmap chunk size overflow issues + +From: Florian-Ewald Mueller + +commit 4555211190798b6b6fa2c37667d175bf67945c78 upstream. + +- limit bitmap chunk size internal u64 variable to values not overflowing + the u32 bitmap superblock structure variable stored on persistent media +- assign bitmap chunk size internal u64 variable from unsigned values to + avoid possible sign extension artifacts when assigning from a s32 value + +The bug has been there since at least kernel 4.0. +Steps to reproduce it: +1: mdadm -C /dev/mdx -l 1 --bitmap=internal --bitmap-chunk=256M -e 1.2 +-n2 /dev/rnbd1 /dev/rnbd2 +2 resize member device rnbd1 and rnbd2 to 8 TB +3 mdadm --grow /dev/mdx --size=max + +The bitmap_chunksize will overflow without patch. + +Cc: stable@vger.kernel.org + +Signed-off-by: Florian-Ewald Mueller +Signed-off-by: Jack Wang +Signed-off-by: Song Liu +Signed-off-by: Greg Kroah-Hartman +--- + drivers/md/md-bitmap.c | 20 ++++++++++++-------- + 1 file changed, 12 insertions(+), 8 deletions(-) + +--- a/drivers/md/md-bitmap.c ++++ b/drivers/md/md-bitmap.c +@@ -486,7 +486,7 @@ void md_bitmap_print_sb(struct bitmap *b + sb = kmap_atomic(bitmap->storage.sb_page); + pr_debug("%s: bitmap file superblock:\n", bmname(bitmap)); + pr_debug(" magic: %08x\n", le32_to_cpu(sb->magic)); +- pr_debug(" version: %d\n", le32_to_cpu(sb->version)); ++ pr_debug(" version: %u\n", le32_to_cpu(sb->version)); + pr_debug(" uuid: %08x.%08x.%08x.%08x\n", + le32_to_cpu(*(__le32 *)(sb->uuid+0)), + le32_to_cpu(*(__le32 *)(sb->uuid+4)), +@@ -497,11 +497,11 @@ void md_bitmap_print_sb(struct bitmap *b + pr_debug("events cleared: %llu\n", + (unsigned long long) le64_to_cpu(sb->events_cleared)); + pr_debug(" state: %08x\n", le32_to_cpu(sb->state)); +- pr_debug(" chunksize: %d B\n", le32_to_cpu(sb->chunksize)); +- pr_debug(" daemon sleep: %ds\n", le32_to_cpu(sb->daemon_sleep)); ++ pr_debug(" chunksize: %u B\n", le32_to_cpu(sb->chunksize)); ++ pr_debug(" daemon sleep: %us\n", le32_to_cpu(sb->daemon_sleep)); + pr_debug(" sync size: %llu KB\n", + (unsigned long long)le64_to_cpu(sb->sync_size)/2); +- pr_debug("max write behind: %d\n", le32_to_cpu(sb->write_behind)); ++ pr_debug("max write behind: %u\n", le32_to_cpu(sb->write_behind)); + kunmap_atomic(sb); + } + +@@ -2106,7 +2106,8 @@ int md_bitmap_resize(struct bitmap *bitm + bytes = DIV_ROUND_UP(chunks, 8); + if (!bitmap->mddev->bitmap_info.external) + bytes += sizeof(bitmap_super_t); +- } while (bytes > (space << 9)); ++ } while (bytes > (space << 9) && (chunkshift + BITMAP_BLOCK_SHIFT) < ++ (BITS_PER_BYTE * sizeof(((bitmap_super_t *)0)->chunksize) - 1)); + } else + chunkshift = ffz(~chunksize) - BITMAP_BLOCK_SHIFT; + +@@ -2151,7 +2152,7 @@ int md_bitmap_resize(struct bitmap *bitm + bitmap->counts.missing_pages = pages; + bitmap->counts.chunkshift = chunkshift; + bitmap->counts.chunks = chunks; +- bitmap->mddev->bitmap_info.chunksize = 1 << (chunkshift + ++ bitmap->mddev->bitmap_info.chunksize = 1UL << (chunkshift + + BITMAP_BLOCK_SHIFT); + + blocks = min(old_counts.chunks << old_counts.chunkshift, +@@ -2177,8 +2178,8 @@ int md_bitmap_resize(struct bitmap *bitm + bitmap->counts.missing_pages = old_counts.pages; + bitmap->counts.chunkshift = old_counts.chunkshift; + bitmap->counts.chunks = old_counts.chunks; +- bitmap->mddev->bitmap_info.chunksize = 1 << (old_counts.chunkshift + +- BITMAP_BLOCK_SHIFT); ++ bitmap->mddev->bitmap_info.chunksize = ++ 1UL << (old_counts.chunkshift + BITMAP_BLOCK_SHIFT); + blocks = old_counts.chunks << old_counts.chunkshift; + pr_warn("Could not pre-allocate in-memory bitmap for cluster raid\n"); + break; +@@ -2519,6 +2520,9 @@ chunksize_store(struct mddev *mddev, con + if (csize < 512 || + !is_power_of_2(csize)) + return -EINVAL; ++ if (BITS_PER_LONG > 32 && csize >= (1ULL << (BITS_PER_BYTE * ++ sizeof(((bitmap_super_t *)0)->chunksize)))) ++ return -EOVERFLOW; + mddev->bitmap_info.chunksize = csize; + return len; + } diff --git a/queue-5.10/mtd-spi-nor-check-for-zero-erase-size-in-spi_nor_find_best_erase_type.patch b/queue-5.10/mtd-spi-nor-check-for-zero-erase-size-in-spi_nor_find_best_erase_type.patch new file mode 100644 index 00000000000..fb1c6a87eb6 --- /dev/null +++ b/queue-5.10/mtd-spi-nor-check-for-zero-erase-size-in-spi_nor_find_best_erase_type.patch @@ -0,0 +1,35 @@ +From 2ebc336be08160debfe27f87660cf550d710f3e9 Mon Sep 17 00:00:00 2001 +From: Alexander Sverdlin +Date: Fri, 19 Nov 2021 09:14:12 +0100 +Subject: mtd: spi-nor: Check for zero erase size in spi_nor_find_best_erase_type() + +From: Alexander Sverdlin + +commit 2ebc336be08160debfe27f87660cf550d710f3e9 upstream. + +Erase can be zeroed in spi_nor_parse_4bait() or +spi_nor_init_non_uniform_erase_map(). In practice it happened with +mt25qu256a, which supports 4K, 32K, 64K erases with 3b address commands, +but only 4K and 64K erase with 4b address commands. + +Fixes: dc92843159a7 ("mtd: spi-nor: fix erase_type array to indicate current map conf") +Signed-off-by: Alexander Sverdlin +Signed-off-by: Tudor Ambarus +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20211119081412.29732-1-alexander.sverdlin@nokia.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mtd/spi-nor/core.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/mtd/spi-nor/core.c ++++ b/drivers/mtd/spi-nor/core.c +@@ -1220,6 +1220,8 @@ spi_nor_find_best_erase_type(const struc + continue; + + erase = &map->erase_type[i]; ++ if (!erase->size) ++ continue; + + /* Alignment is not mandatory for overlaid regions */ + if (region->offset & SNOR_OVERLAID_REGION && diff --git a/queue-5.10/parisc-led-fix-potential-null-ptr-deref-in-start_task.patch b/queue-5.10/parisc-led-fix-potential-null-ptr-deref-in-start_task.patch new file mode 100644 index 00000000000..1c7ff41b29f --- /dev/null +++ b/queue-5.10/parisc-led-fix-potential-null-ptr-deref-in-start_task.patch @@ -0,0 +1,42 @@ +From 41f563ab3c33698bdfc3403c7c2e6c94e73681e4 Mon Sep 17 00:00:00 2001 +From: Shang XiaoJing +Date: Thu, 17 Nov 2022 10:45:14 +0800 +Subject: parisc: led: Fix potential null-ptr-deref in start_task() + +From: Shang XiaoJing + +commit 41f563ab3c33698bdfc3403c7c2e6c94e73681e4 upstream. + +start_task() calls create_singlethread_workqueue() and not checked the +ret value, which may return NULL. And a null-ptr-deref may happen: + +start_task() + create_singlethread_workqueue() # failed, led_wq is NULL + queue_delayed_work() + queue_delayed_work_on() + __queue_delayed_work() # warning here, but continue + __queue_work() # access wq->flags, null-ptr-deref + +Check the ret value and return -ENOMEM if it is NULL. + +Fixes: 3499495205a6 ("[PARISC] Use work queue in LED/LCD driver instead of tasklet.") +Signed-off-by: Shang XiaoJing +Signed-off-by: Helge Deller +Cc: +Signed-off-by: Greg Kroah-Hartman +--- + drivers/parisc/led.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/parisc/led.c ++++ b/drivers/parisc/led.c +@@ -137,6 +137,9 @@ static int start_task(void) + + /* Create the work queue and queue the LED task */ + led_wq = create_singlethread_workqueue("led_wq"); ++ if (!led_wq) ++ return -ENOMEM; ++ + queue_delayed_work(led_wq, &led_task, 0); + + return 0; diff --git a/queue-5.10/pci-fix-pci_device_is_present-for-vfs-by-checking-pf.patch b/queue-5.10/pci-fix-pci_device_is_present-for-vfs-by-checking-pf.patch new file mode 100644 index 00000000000..e3f12f99a65 --- /dev/null +++ b/queue-5.10/pci-fix-pci_device_is_present-for-vfs-by-checking-pf.patch @@ -0,0 +1,59 @@ +From 98b04dd0b4577894520493d96bc4623387767445 Mon Sep 17 00:00:00 2001 +From: "Michael S. Tsirkin" +Date: Wed, 26 Oct 2022 02:11:21 -0400 +Subject: PCI: Fix pci_device_is_present() for VFs by checking PF + +From: Michael S. Tsirkin + +commit 98b04dd0b4577894520493d96bc4623387767445 upstream. + +pci_device_is_present() previously didn't work for VFs because it reads the +Vendor and Device ID, which are 0xffff for VFs, which looks like they +aren't present. Check the PF instead. + +Wei Gong reported that if virtio I/O is in progress when the driver is +unbound or "0" is written to /sys/.../sriov_numvfs, the virtio I/O +operation hangs, which may result in output like this: + + task:bash state:D stack: 0 pid: 1773 ppid: 1241 flags:0x00004002 + Call Trace: + schedule+0x4f/0xc0 + blk_mq_freeze_queue_wait+0x69/0xa0 + blk_mq_freeze_queue+0x1b/0x20 + blk_cleanup_queue+0x3d/0xd0 + virtblk_remove+0x3c/0xb0 [virtio_blk] + virtio_dev_remove+0x4b/0x80 + ... + device_unregister+0x1b/0x60 + unregister_virtio_device+0x18/0x30 + virtio_pci_remove+0x41/0x80 + pci_device_remove+0x3e/0xb0 + +This happened because pci_device_is_present(VF) returned "false" in +virtio_pci_remove(), so it called virtio_break_device(). The broken vq +meant that vring_interrupt() skipped the vq.callback() that would have +completed the virtio I/O operation via virtblk_done(). + +[bhelgaas: commit log, simplify to always use pci_physfn(), add stable tag] +Link: https://lore.kernel.org/r/20221026060912.173250-1-mst@redhat.com +Reported-by: Wei Gong +Tested-by: Wei Gong +Signed-off-by: Michael S. Tsirkin +Signed-off-by: Bjorn Helgaas +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/pci.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/pci/pci.c ++++ b/drivers/pci/pci.c +@@ -6152,6 +6152,8 @@ bool pci_device_is_present(struct pci_de + { + u32 v; + ++ /* Check PF if pdev is a VF, since VF Vendor/Device IDs are 0xffff */ ++ pdev = pci_physfn(pdev); + if (pci_dev_is_disconnected(pdev)) + return false; + return pci_bus_read_dev_vendor_id(pdev->bus, pdev->devfn, &v, 0); diff --git a/queue-5.10/pci-sysfs-fix-double-free-in-error-path.patch b/queue-5.10/pci-sysfs-fix-double-free-in-error-path.patch new file mode 100644 index 00000000000..60857ab3bd8 --- /dev/null +++ b/queue-5.10/pci-sysfs-fix-double-free-in-error-path.patch @@ -0,0 +1,58 @@ +From aa382ffa705bea9931ec92b6f3c70e1fdb372195 Mon Sep 17 00:00:00 2001 +From: Sascha Hauer +Date: Tue, 8 Nov 2022 17:05:59 -0600 +Subject: PCI/sysfs: Fix double free in error path + +From: Sascha Hauer + +commit aa382ffa705bea9931ec92b6f3c70e1fdb372195 upstream. + +When pci_create_attr() fails, pci_remove_resource_files() is called which +will iterate over the res_attr[_wc] arrays and frees every non NULL entry. +To avoid a double free here set the array entry only after it's clear we +successfully initialized it. + +Fixes: b562ec8f74e4 ("PCI: Don't leak memory if sysfs_create_bin_file() fails") +Link: https://lore.kernel.org/r/20221007070735.GX986@pengutronix.de/ +Signed-off-by: Sascha Hauer +Signed-off-by: Bjorn Helgaas +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/pci-sysfs.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +--- a/drivers/pci/pci-sysfs.c ++++ b/drivers/pci/pci-sysfs.c +@@ -1141,11 +1141,9 @@ static int pci_create_attr(struct pci_de + + sysfs_bin_attr_init(res_attr); + if (write_combine) { +- pdev->res_attr_wc[num] = res_attr; + sprintf(res_attr_name, "resource%d_wc", num); + res_attr->mmap = pci_mmap_resource_wc; + } else { +- pdev->res_attr[num] = res_attr; + sprintf(res_attr_name, "resource%d", num); + if (pci_resource_flags(pdev, num) & IORESOURCE_IO) { + res_attr->read = pci_read_resource_io; +@@ -1161,10 +1159,17 @@ static int pci_create_attr(struct pci_de + res_attr->size = pci_resource_len(pdev, num); + res_attr->private = (void *)(unsigned long)num; + retval = sysfs_create_bin_file(&pdev->dev.kobj, res_attr); +- if (retval) ++ if (retval) { + kfree(res_attr); ++ return retval; ++ } ++ ++ if (write_combine) ++ pdev->res_attr_wc[num] = res_attr; ++ else ++ pdev->res_attr[num] = res_attr; + +- return retval; ++ return 0; + } + + /** diff --git a/queue-5.10/remoteproc-core-do-pm_relax-when-in-rproc_offline-state.patch b/queue-5.10/remoteproc-core-do-pm_relax-when-in-rproc_offline-state.patch new file mode 100644 index 00000000000..540a8675a99 --- /dev/null +++ b/queue-5.10/remoteproc-core-do-pm_relax-when-in-rproc_offline-state.patch @@ -0,0 +1,52 @@ +From 11c7f9e3131ad14b27a957496088fa488b153a48 Mon Sep 17 00:00:00 2001 +From: Maria Yu +Date: Tue, 6 Dec 2022 09:59:57 +0800 +Subject: remoteproc: core: Do pm_relax when in RPROC_OFFLINE state + +From: Maria Yu + +commit 11c7f9e3131ad14b27a957496088fa488b153a48 upstream. + +Make sure that pm_relax() happens even when the remoteproc +is stopped before the crash handler work is scheduled. + +Signed-off-by: Maria Yu +Cc: stable +Fixes: a781e5aa5911 ("remoteproc: core: Prevent system suspend during remoteproc recovery") +Link: https://lore.kernel.org/r/20221206015957.2616-2-quic_aiquny@quicinc.com +Signed-off-by: Mathieu Poirier +Signed-off-by: Greg Kroah-Hartman +--- + drivers/remoteproc/remoteproc_core.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +--- a/drivers/remoteproc/remoteproc_core.c ++++ b/drivers/remoteproc/remoteproc_core.c +@@ -1741,12 +1741,18 @@ static void rproc_crash_handler_work(str + + mutex_lock(&rproc->lock); + +- if (rproc->state == RPROC_CRASHED || rproc->state == RPROC_OFFLINE) { ++ if (rproc->state == RPROC_CRASHED) { + /* handle only the first crash detected */ + mutex_unlock(&rproc->lock); + return; + } + ++ if (rproc->state == RPROC_OFFLINE) { ++ /* Don't recover if the remote processor was stopped */ ++ mutex_unlock(&rproc->lock); ++ goto out; ++ } ++ + rproc->state = RPROC_CRASHED; + dev_err(dev, "handling crash #%u in %s\n", ++rproc->crash_cnt, + rproc->name); +@@ -1756,6 +1762,7 @@ static void rproc_crash_handler_work(str + if (!rproc->recovery_disabled) + rproc_trigger_recovery(rproc); + ++out: + pm_relax(rproc->dev.parent); + } + diff --git a/queue-5.10/series b/queue-5.10/series index 99637263a1d..0498b02dfff 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -646,3 +646,23 @@ media-dvb-core-fix-uaf-due-to-refcount-races-at-releasing.patch cifs-fix-confusing-debug-message.patch cifs-fix-missing-display-of-three-mount-options.patch rtc-ds1347-fix-value-written-to-century-register.patch +md-bitmap-fix-bitmap-chunk-size-overflow-issues.patch +efi-add-imac-pro-2017-to-uefi-skip-cert-quirk.patch +wifi-wilc1000-sdio-fix-module-autoloading.patch +asoc-jz4740-i2s-handle-independent-fifo-flush-bits.patch +ipmi-fix-long-wait-in-unload-when-ipmi-disconnect.patch +mtd-spi-nor-check-for-zero-erase-size-in-spi_nor_find_best_erase_type.patch +ima-fix-a-potential-null-pointer-access-in-ima_restore_measurement_list.patch +ipmi-fix-use-after-free-in-_ipmi_destroy_user.patch +pci-fix-pci_device_is_present-for-vfs-by-checking-pf.patch +pci-sysfs-fix-double-free-in-error-path.patch +crypto-n2-add-missing-hash-statesize.patch +driver-core-fix-bus_type.match-error-handling-in-__driver_attach.patch +iommu-amd-fix-ivrs_acpihid-cmdline-parsing-code.patch +remoteproc-core-do-pm_relax-when-in-rproc_offline-state.patch +parisc-led-fix-potential-null-ptr-deref-in-start_task.patch +device_cgroup-roll-back-to-original-exceptions-after-copy-failure.patch +drm-connector-send-hotplug-uevent-on-connector-cleanup.patch +drm-vmwgfx-validate-the-box-size-for-the-snooped-cursor.patch +drm-i915-dsi-fix-vbt-send-packet-port-selection-for-dual-link-dsi.patch +drm-ingenic-fix-missing-platform_driver_unregister-call-in-ingenic_drm_init.patch diff --git a/queue-5.10/wifi-wilc1000-sdio-fix-module-autoloading.patch b/queue-5.10/wifi-wilc1000-sdio-fix-module-autoloading.patch new file mode 100644 index 00000000000..5d9667755e0 --- /dev/null +++ b/queue-5.10/wifi-wilc1000-sdio-fix-module-autoloading.patch @@ -0,0 +1,31 @@ +From 57d545b5a3d6ce3a8fb6b093f02bfcbb908973f3 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Thu, 27 Oct 2022 19:12:21 +0200 +Subject: wifi: wilc1000: sdio: fix module autoloading + +From: Michael Walle + +commit 57d545b5a3d6ce3a8fb6b093f02bfcbb908973f3 upstream. + +There are no SDIO module aliases included in the driver, therefore, +module autoloading isn't working. Add the proper MODULE_DEVICE_TABLE(). + +Cc: stable@vger.kernel.org +Signed-off-by: Michael Walle +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20221027171221.491937-1-michael@walle.cc +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wireless/microchip/wilc1000/sdio.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/microchip/wilc1000/sdio.c ++++ b/drivers/net/wireless/microchip/wilc1000/sdio.c +@@ -20,6 +20,7 @@ static const struct sdio_device_id wilc_ + { SDIO_DEVICE(SDIO_VENDOR_ID_MICROCHIP_WILC, SDIO_DEVICE_ID_MICROCHIP_WILC1000) }, + { }, + }; ++MODULE_DEVICE_TABLE(sdio, wilc_sdio_ids); + + #define WILC_SDIO_BLOCK_SIZE 512 +