From: Greg Kroah-Hartman Date: Mon, 6 Jan 2025 10:55:55 +0000 (+0100) Subject: 6.6-stable patches X-Git-Tag: v5.4.289~29 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a23cae812b5b18f9c803bba4757a17b6c4b452c0;p=thirdparty%2Fkernel%2Fstable-queue.git 6.6-stable patches added patches: drm-adv7511-drop-dsi-single-lane-support.patch drm-adv7511-fix-use-after-free-in-adv7533_attach_dsi.patch dt-bindings-display-adi-adv7533-drop-single-lane-support.patch fs-proc-task_mmu-fix-pagemap-flags-with-pmd-thp-entries-on-32bit.patch kcov-mark-in_softirq_really-as-__always_inline.patch net-sctp-prevent-autoclose-integer-overflow-in-sctp_association_init.patch ocfs2-fix-slab-use-after-free-due-to-dangling-pointer-dqi_priv.patch pinctrl-mcp23s08-fix-sleeping-in-atomic-context-due-to-regmap-locking.patch rdma-uverbs-prevent-integer-overflow-issue.patch scripts-sorttable-fix-orc_sort_cmp-to-maintain-symmetry-and-transitivity.patch sky2-add-device-id-11ab-4373-for-marvell-88e8075.patch --- diff --git a/queue-6.6/drm-adv7511-drop-dsi-single-lane-support.patch b/queue-6.6/drm-adv7511-drop-dsi-single-lane-support.patch new file mode 100644 index 00000000000..ee0a01a69cf --- /dev/null +++ b/queue-6.6/drm-adv7511-drop-dsi-single-lane-support.patch @@ -0,0 +1,39 @@ +From 79d67c499c3f886202a40c5cb27e747e4fa4d738 Mon Sep 17 00:00:00 2001 +From: Biju Das +Date: Tue, 19 Nov 2024 19:20:31 +0000 +Subject: drm: adv7511: Drop dsi single lane support + +From: Biju Das + +commit 79d67c499c3f886202a40c5cb27e747e4fa4d738 upstream. + +As per [1] and [2], ADV7535/7533 supports only 2-, 3-, or 4-lane. Drop +unsupported 1-lane. + +[1] https://www.analog.com/media/en/technical-documentation/data-sheets/ADV7535.pdf +[2] https://www.analog.com/media/en/technical-documentation/data-sheets/ADV7533.pdf + +Fixes: 1e4d58cd7f88 ("drm/bridge: adv7533: Create a MIPI DSI device") +Reported-by: Hien Huynh +Cc: stable@vger.kernel.org +Reviewed-by: Laurent Pinchart +Reviewed-by: Adam Ford +Signed-off-by: Biju Das +Link: https://patchwork.freedesktop.org/patch/msgid/20241119192040.152657-4-biju.das.jz@bp.renesas.com +Signed-off-by: Dmitry Baryshkov +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/bridge/adv7511/adv7533.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/bridge/adv7511/adv7533.c ++++ b/drivers/gpu/drm/bridge/adv7511/adv7533.c +@@ -175,7 +175,7 @@ int adv7533_parse_dt(struct device_node + + of_property_read_u32(np, "adi,dsi-lanes", &num_lanes); + +- if (num_lanes < 1 || num_lanes > 4) ++ if (num_lanes < 2 || num_lanes > 4) + return -EINVAL; + + adv->num_dsi_lanes = num_lanes; diff --git a/queue-6.6/drm-adv7511-fix-use-after-free-in-adv7533_attach_dsi.patch b/queue-6.6/drm-adv7511-fix-use-after-free-in-adv7533_attach_dsi.patch new file mode 100644 index 00000000000..ae65637b86e --- /dev/null +++ b/queue-6.6/drm-adv7511-fix-use-after-free-in-adv7533_attach_dsi.patch @@ -0,0 +1,73 @@ +From 81adbd3ff21c1182e06aa02c6be0bfd9ea02d8e8 Mon Sep 17 00:00:00 2001 +From: Biju Das +Date: Tue, 19 Nov 2024 19:20:29 +0000 +Subject: drm: adv7511: Fix use-after-free in adv7533_attach_dsi() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Biju Das + +commit 81adbd3ff21c1182e06aa02c6be0bfd9ea02d8e8 upstream. + +The host_node pointer was assigned and freed in adv7533_parse_dt(), and +later, adv7533_attach_dsi() uses the same. Fix this use-after-free issue +by dropping of_node_put() in adv7533_parse_dt() and calling of_node_put() +in error path of probe() and also in the remove(). + +Fixes: 1e4d58cd7f88 ("drm/bridge: adv7533: Create a MIPI DSI device") +Cc: stable@vger.kernel.org +Reviewed-by: Laurent Pinchart +Signed-off-by: Biju Das +Link: https://patchwork.freedesktop.org/patch/msgid/20241119192040.152657-2-biju.das.jz@bp.renesas.com +Signed-off-by: Dmitry Baryshkov +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 10 ++++++++-- + drivers/gpu/drm/bridge/adv7511/adv7533.c | 2 -- + 2 files changed, 8 insertions(+), 4 deletions(-) + +--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c ++++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +@@ -1225,8 +1225,10 @@ static int adv7511_probe(struct i2c_clie + return ret; + + ret = adv7511_init_regulators(adv7511); +- if (ret) +- return dev_err_probe(dev, ret, "failed to init regulators\n"); ++ if (ret) { ++ dev_err_probe(dev, ret, "failed to init regulators\n"); ++ goto err_of_node_put; ++ } + + /* + * The power down GPIO is optional. If present, toggle it from active to +@@ -1346,6 +1348,8 @@ err_i2c_unregister_edid: + i2c_unregister_device(adv7511->i2c_edid); + uninit_regulators: + adv7511_uninit_regulators(adv7511); ++err_of_node_put: ++ of_node_put(adv7511->host_node); + + return ret; + } +@@ -1354,6 +1358,8 @@ static void adv7511_remove(struct i2c_cl + { + struct adv7511 *adv7511 = i2c_get_clientdata(i2c); + ++ of_node_put(adv7511->host_node); ++ + adv7511_uninit_regulators(adv7511); + + drm_bridge_remove(&adv7511->bridge); +--- a/drivers/gpu/drm/bridge/adv7511/adv7533.c ++++ b/drivers/gpu/drm/bridge/adv7511/adv7533.c +@@ -184,8 +184,6 @@ int adv7533_parse_dt(struct device_node + if (!adv->host_node) + return -ENODEV; + +- of_node_put(adv->host_node); +- + adv->use_timing_gen = !of_property_read_bool(np, + "adi,disable-timing-generator"); + diff --git a/queue-6.6/dt-bindings-display-adi-adv7533-drop-single-lane-support.patch b/queue-6.6/dt-bindings-display-adi-adv7533-drop-single-lane-support.patch new file mode 100644 index 00000000000..898f82d836b --- /dev/null +++ b/queue-6.6/dt-bindings-display-adi-adv7533-drop-single-lane-support.patch @@ -0,0 +1,39 @@ +From ee8f9ed57a397605434caeef351bafa3ec4dfdd4 Mon Sep 17 00:00:00 2001 +From: Biju Das +Date: Tue, 19 Nov 2024 19:20:30 +0000 +Subject: dt-bindings: display: adi,adv7533: Drop single lane support + +From: Biju Das + +commit ee8f9ed57a397605434caeef351bafa3ec4dfdd4 upstream. + +As per [1] and [2], ADV7535/7533 supports only 2-, 3-, or 4-lane. Drop +unsupported 1-lane from bindings. + +[1] https://www.analog.com/media/en/technical-documentation/data-sheets/ADV7535.pdf +[2] https://www.analog.com/media/en/technical-documentation/data-sheets/ADV7533.pdf + +Fixes: 1e4d58cd7f88 ("drm/bridge: adv7533: Create a MIPI DSI device") +Cc: stable@vger.kernel.org +Acked-by: Krzysztof Kozlowski +Reviewed-by: Geert Uytterhoeven +Reviewed-by: Laurent Pinchart +Signed-off-by: Biju Das +Link: https://patchwork.freedesktop.org/patch/msgid/20241119192040.152657-3-biju.das.jz@bp.renesas.com +Signed-off-by: Dmitry Baryshkov +Signed-off-by: Greg Kroah-Hartman +--- + Documentation/devicetree/bindings/display/bridge/adi,adv7533.yaml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/Documentation/devicetree/bindings/display/bridge/adi,adv7533.yaml ++++ b/Documentation/devicetree/bindings/display/bridge/adi,adv7533.yaml +@@ -87,7 +87,7 @@ properties: + adi,dsi-lanes: + description: Number of DSI data lanes connected to the DSI host. + $ref: /schemas/types.yaml#/definitions/uint32 +- enum: [ 1, 2, 3, 4 ] ++ enum: [ 2, 3, 4 ] + + ports: + description: diff --git a/queue-6.6/fs-proc-task_mmu-fix-pagemap-flags-with-pmd-thp-entries-on-32bit.patch b/queue-6.6/fs-proc-task_mmu-fix-pagemap-flags-with-pmd-thp-entries-on-32bit.patch new file mode 100644 index 00000000000..45b1c555881 --- /dev/null +++ b/queue-6.6/fs-proc-task_mmu-fix-pagemap-flags-with-pmd-thp-entries-on-32bit.patch @@ -0,0 +1,39 @@ +From 3754137d263f52f4b507cf9ae913f8f0497d1b0e Mon Sep 17 00:00:00 2001 +From: David Hildenbrand +Date: Tue, 17 Dec 2024 20:50:00 +0100 +Subject: fs/proc/task_mmu: fix pagemap flags with PMD THP entries on 32bit + +From: David Hildenbrand + +commit 3754137d263f52f4b507cf9ae913f8f0497d1b0e upstream. + +Entries (including flags) are u64, even on 32bit. So right now we are +cutting of the flags on 32bit. This way, for example the cow selftest +complains about: + + # ./cow + ... + Bail Out! read and ioctl return unmatched results for populated: 0 1 + +Link: https://lkml.kernel.org/r/20241217195000.1734039-1-david@redhat.com +Fixes: 2c1f057e5be6 ("fs/proc/task_mmu: properly detect PM_MMAP_EXCLUSIVE per page of PMD-mapped THPs") +Signed-off-by: David Hildenbrand +Cc: Oscar Salvador +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + fs/proc/task_mmu.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/proc/task_mmu.c ++++ b/fs/proc/task_mmu.c +@@ -1516,7 +1516,7 @@ static int pagemap_pmd_range(pmd_t *pmdp + flags |= PM_FILE; + + for (; addr != end; addr += PAGE_SIZE, idx++) { +- unsigned long cur_flags = flags; ++ u64 cur_flags = flags; + pagemap_entry_t pme; + + if (page && (flags & PM_PRESENT) && diff --git a/queue-6.6/kcov-mark-in_softirq_really-as-__always_inline.patch b/queue-6.6/kcov-mark-in_softirq_really-as-__always_inline.patch new file mode 100644 index 00000000000..778efc09602 --- /dev/null +++ b/queue-6.6/kcov-mark-in_softirq_really-as-__always_inline.patch @@ -0,0 +1,44 @@ +From cb0ca08b326aa03f87fe94bb91872ce8d2ef1ed8 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Tue, 17 Dec 2024 08:18:10 +0100 +Subject: kcov: mark in_softirq_really() as __always_inline + +From: Arnd Bergmann + +commit cb0ca08b326aa03f87fe94bb91872ce8d2ef1ed8 upstream. + +If gcc decides not to inline in_softirq_really(), objtool warns about a +function call with UACCESS enabled: + +kernel/kcov.o: warning: objtool: __sanitizer_cov_trace_pc+0x1e: call to in_softirq_really() with UACCESS enabled +kernel/kcov.o: warning: objtool: check_kcov_mode+0x11: call to in_softirq_really() with UACCESS enabled + +Mark this as __always_inline to avoid the problem. + +Link: https://lkml.kernel.org/r/20241217071814.2261620-1-arnd@kernel.org +Fixes: 7d4df2dad312 ("kcov: properly check for softirq context") +Signed-off-by: Arnd Bergmann +Reviewed-by: Marco Elver +Cc: Aleksandr Nogikh +Cc: Andrey Konovalov +Cc: Dmitry Vyukov +Cc: Josh Poimboeuf +Cc: Peter Zijlstra +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + kernel/kcov.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/kernel/kcov.c ++++ b/kernel/kcov.c +@@ -165,7 +165,7 @@ static void kcov_remote_area_put(struct + * Unlike in_serving_softirq(), this function returns false when called during + * a hardirq or an NMI that happened in the softirq context. + */ +-static inline bool in_softirq_really(void) ++static __always_inline bool in_softirq_really(void) + { + return in_serving_softirq() && !in_hardirq() && !in_nmi(); + } diff --git a/queue-6.6/net-sctp-prevent-autoclose-integer-overflow-in-sctp_association_init.patch b/queue-6.6/net-sctp-prevent-autoclose-integer-overflow-in-sctp_association_init.patch new file mode 100644 index 00000000000..f73118b6ea6 --- /dev/null +++ b/queue-6.6/net-sctp-prevent-autoclose-integer-overflow-in-sctp_association_init.patch @@ -0,0 +1,36 @@ +From 4e86729d1ff329815a6e8a920cb554a1d4cb5b8d Mon Sep 17 00:00:00 2001 +From: Nikolay Kuratov +Date: Thu, 19 Dec 2024 19:21:14 +0300 +Subject: net/sctp: Prevent autoclose integer overflow in sctp_association_init() + +From: Nikolay Kuratov + +commit 4e86729d1ff329815a6e8a920cb554a1d4cb5b8d upstream. + +While by default max_autoclose equals to INT_MAX / HZ, one may set +net.sctp.max_autoclose to UINT_MAX. There is code in +sctp_association_init() that can consequently trigger overflow. + +Cc: stable@vger.kernel.org +Fixes: 9f70f46bd4c7 ("sctp: properly latch and use autoclose value from sock to association") +Signed-off-by: Nikolay Kuratov +Acked-by: Xin Long +Link: https://patch.msgid.link/20241219162114.2863827-1-kniv@yandex-team.ru +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + net/sctp/associola.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/net/sctp/associola.c ++++ b/net/sctp/associola.c +@@ -137,7 +137,8 @@ static struct sctp_association *sctp_ass + = 5 * asoc->rto_max; + + asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay; +- asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = sp->autoclose * HZ; ++ asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = ++ (unsigned long)sp->autoclose * HZ; + + /* Initializes the timers */ + for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i) diff --git a/queue-6.6/ocfs2-fix-slab-use-after-free-due-to-dangling-pointer-dqi_priv.patch b/queue-6.6/ocfs2-fix-slab-use-after-free-due-to-dangling-pointer-dqi_priv.patch new file mode 100644 index 00000000000..2e239f4820e --- /dev/null +++ b/queue-6.6/ocfs2-fix-slab-use-after-free-due-to-dangling-pointer-dqi_priv.patch @@ -0,0 +1,66 @@ +From 5f3fd772d152229d94602bca243fbb658068a597 Mon Sep 17 00:00:00 2001 +From: Dennis Lam +Date: Tue, 17 Dec 2024 21:39:25 -0500 +Subject: ocfs2: fix slab-use-after-free due to dangling pointer dqi_priv + +From: Dennis Lam + +commit 5f3fd772d152229d94602bca243fbb658068a597 upstream. + +When mounting ocfs2 and then remounting it as read-only, a +slab-use-after-free occurs after the user uses a syscall to +quota_getnextquota. Specifically, sb_dqinfo(sb, type)->dqi_priv is the +dangling pointer. + +During the remounting process, the pointer dqi_priv is freed but is never +set as null leaving it to be accessed. Additionally, the read-only option +for remounting sets the DQUOT_SUSPENDED flag instead of setting the +DQUOT_USAGE_ENABLED flags. Moreover, later in the process of getting the +next quota, the function ocfs2_get_next_id is called and only checks the +quota usage flags and not the quota suspended flags. + +To fix this, I set dqi_priv to null when it is freed after remounting with +read-only and put a check for DQUOT_SUSPENDED in ocfs2_get_next_id. + +[akpm@linux-foundation.org: coding-style cleanups] +Link: https://lkml.kernel.org/r/20241218023924.22821-2-dennis.lamerice@gmail.com +Fixes: 8f9e8f5fcc05 ("ocfs2: Fix Q_GETNEXTQUOTA for filesystem without quotas") +Signed-off-by: Dennis Lam +Reported-by: syzbot+d173bf8a5a7faeede34c@syzkaller.appspotmail.com +Tested-by: syzbot+d173bf8a5a7faeede34c@syzkaller.appspotmail.com +Closes: https://lore.kernel.org/all/6731d26f.050a0220.1fb99c.014b.GAE@google.com/T/ +Reviewed-by: Joseph Qi +Cc: Mark Fasheh +Cc: Joel Becker +Cc: Junxiao Bi +Cc: Changwei Ge +Cc: Jun Piao +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + fs/ocfs2/quota_global.c | 2 +- + fs/ocfs2/quota_local.c | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +--- a/fs/ocfs2/quota_global.c ++++ b/fs/ocfs2/quota_global.c +@@ -881,7 +881,7 @@ static int ocfs2_get_next_id(struct supe + int status = 0; + + trace_ocfs2_get_next_id(from_kqid(&init_user_ns, *qid), type); +- if (!sb_has_quota_loaded(sb, type)) { ++ if (!sb_has_quota_active(sb, type)) { + status = -ESRCH; + goto out; + } +--- a/fs/ocfs2/quota_local.c ++++ b/fs/ocfs2/quota_local.c +@@ -864,6 +864,7 @@ out: + brelse(oinfo->dqi_libh); + brelse(oinfo->dqi_lqi_bh); + kfree(oinfo); ++ info->dqi_priv = NULL; + return status; + } + diff --git a/queue-6.6/pinctrl-mcp23s08-fix-sleeping-in-atomic-context-due-to-regmap-locking.patch b/queue-6.6/pinctrl-mcp23s08-fix-sleeping-in-atomic-context-due-to-regmap-locking.patch new file mode 100644 index 00000000000..c7174925011 --- /dev/null +++ b/queue-6.6/pinctrl-mcp23s08-fix-sleeping-in-atomic-context-due-to-regmap-locking.patch @@ -0,0 +1,111 @@ +From a37eecb705f33726f1fb7cd2a67e514a15dfe693 Mon Sep 17 00:00:00 2001 +From: Evgenii Shatokhin +Date: Mon, 9 Dec 2024 10:46:59 +0300 +Subject: pinctrl: mcp23s08: Fix sleeping in atomic context due to regmap locking + +From: Evgenii Shatokhin + +commit a37eecb705f33726f1fb7cd2a67e514a15dfe693 upstream. + +If a device uses MCP23xxx IO expander to receive IRQs, the following +bug can happen: + + BUG: sleeping function called from invalid context + at kernel/locking/mutex.c:283 + in_atomic(): 1, irqs_disabled(): 1, non_block: 0, ... + preempt_count: 1, expected: 0 + ... + Call Trace: + ... + __might_resched+0x104/0x10e + __might_sleep+0x3e/0x62 + mutex_lock+0x20/0x4c + regmap_lock_mutex+0x10/0x18 + regmap_update_bits_base+0x2c/0x66 + mcp23s08_irq_set_type+0x1ae/0x1d6 + __irq_set_trigger+0x56/0x172 + __setup_irq+0x1e6/0x646 + request_threaded_irq+0xb6/0x160 + ... + +We observed the problem while experimenting with a touchscreen driver which +used MCP23017 IO expander (I2C). + +The regmap in the pinctrl-mcp23s08 driver uses a mutex for protection from +concurrent accesses, which is the default for regmaps without .fast_io, +.disable_locking, etc. + +mcp23s08_irq_set_type() calls regmap_update_bits_base(), and the latter +locks the mutex. + +However, __setup_irq() locks desc->lock spinlock before calling these +functions. As a result, the system tries to lock the mutex whole holding +the spinlock. + +It seems, the internal regmap locks are not needed in this driver at all. +mcp->lock seems to protect the regmap from concurrent accesses already, +except, probably, in mcp_pinconf_get/set. + +mcp23s08_irq_set_type() and mcp23s08_irq_mask/unmask() are called under +chip_bus_lock(), which calls mcp23s08_irq_bus_lock(). The latter takes +mcp->lock and enables regmap caching, so that the potentially slow I2C +accesses are deferred until chip_bus_unlock(). + +The accesses to the regmap from mcp23s08_probe_one() do not need additional +locking. + +In all remaining places where the regmap is accessed, except +mcp_pinconf_get/set(), the driver already takes mcp->lock. + +This patch adds locking in mcp_pinconf_get/set() and disables internal +locking in the regmap config. Among other things, it fixes the sleeping +in atomic context described above. + +Fixes: 8f38910ba4f6 ("pinctrl: mcp23s08: switch to regmap caching") +Cc: stable@vger.kernel.org +Signed-off-by: Evgenii Shatokhin +Link: https://lore.kernel.org/20241209074659.1442898-1-e.shatokhin@yadro.com +Signed-off-by: Linus Walleij +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pinctrl/pinctrl-mcp23s08.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/pinctrl/pinctrl-mcp23s08.c ++++ b/drivers/pinctrl/pinctrl-mcp23s08.c +@@ -86,6 +86,7 @@ const struct regmap_config mcp23x08_regm + .num_reg_defaults = ARRAY_SIZE(mcp23x08_defaults), + .cache_type = REGCACHE_FLAT, + .max_register = MCP_OLAT, ++ .disable_locking = true, /* mcp->lock protects the regmap */ + }; + EXPORT_SYMBOL_GPL(mcp23x08_regmap); + +@@ -132,6 +133,7 @@ const struct regmap_config mcp23x17_regm + .num_reg_defaults = ARRAY_SIZE(mcp23x17_defaults), + .cache_type = REGCACHE_FLAT, + .val_format_endian = REGMAP_ENDIAN_LITTLE, ++ .disable_locking = true, /* mcp->lock protects the regmap */ + }; + EXPORT_SYMBOL_GPL(mcp23x17_regmap); + +@@ -228,7 +230,9 @@ static int mcp_pinconf_get(struct pinctr + + switch (param) { + case PIN_CONFIG_BIAS_PULL_UP: ++ mutex_lock(&mcp->lock); + ret = mcp_read(mcp, MCP_GPPU, &data); ++ mutex_unlock(&mcp->lock); + if (ret < 0) + return ret; + status = (data & BIT(pin)) ? 1 : 0; +@@ -257,7 +261,9 @@ static int mcp_pinconf_set(struct pinctr + + switch (param) { + case PIN_CONFIG_BIAS_PULL_UP: ++ mutex_lock(&mcp->lock); + ret = mcp_set_bit(mcp, MCP_GPPU, pin, arg); ++ mutex_unlock(&mcp->lock); + break; + default: + dev_dbg(mcp->dev, "Invalid config param %04x\n", param); diff --git a/queue-6.6/rdma-uverbs-prevent-integer-overflow-issue.patch b/queue-6.6/rdma-uverbs-prevent-integer-overflow-issue.patch new file mode 100644 index 00000000000..9399378bd43 --- /dev/null +++ b/queue-6.6/rdma-uverbs-prevent-integer-overflow-issue.patch @@ -0,0 +1,74 @@ +From d0257e089d1bbd35c69b6c97ff73e3690ab149a9 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Sat, 30 Nov 2024 13:06:41 +0300 +Subject: RDMA/uverbs: Prevent integer overflow issue + +From: Dan Carpenter + +commit d0257e089d1bbd35c69b6c97ff73e3690ab149a9 upstream. + +In the expression "cmd.wqe_size * cmd.wr_count", both variables are u32 +values that come from the user so the multiplication can lead to integer +wrapping. Then we pass the result to uverbs_request_next_ptr() which also +could potentially wrap. The "cmd.sge_count * sizeof(struct ib_uverbs_sge)" +multiplication can also overflow on 32bit systems although it's fine on +64bit systems. + +This patch does two things. First, I've re-arranged the condition in +uverbs_request_next_ptr() so that the use controlled variable "len" is on +one side of the comparison by itself without any math. Then I've modified +all the callers to use size_mul() for the multiplications. + +Fixes: 67cdb40ca444 ("[IB] uverbs: Implement more commands") +Cc: stable@vger.kernel.org +Signed-off-by: Dan Carpenter +Link: https://patch.msgid.link/b8765ab3-c2da-4611-aae0-ddd6ba173d23@stanley.mountain +Signed-off-by: Leon Romanovsky +Signed-off-by: Greg Kroah-Hartman +--- + drivers/infiniband/core/uverbs_cmd.c | 16 +++++++++------- + 1 file changed, 9 insertions(+), 7 deletions(-) + +--- a/drivers/infiniband/core/uverbs_cmd.c ++++ b/drivers/infiniband/core/uverbs_cmd.c +@@ -161,7 +161,7 @@ static const void __user *uverbs_request + { + const void __user *res = iter->cur; + +- if (iter->cur + len > iter->end) ++ if (len > iter->end - iter->cur) + return (void __force __user *)ERR_PTR(-ENOSPC); + iter->cur += len; + return res; +@@ -2009,11 +2009,13 @@ static int ib_uverbs_post_send(struct uv + ret = uverbs_request_start(attrs, &iter, &cmd, sizeof(cmd)); + if (ret) + return ret; +- wqes = uverbs_request_next_ptr(&iter, cmd.wqe_size * cmd.wr_count); ++ wqes = uverbs_request_next_ptr(&iter, size_mul(cmd.wqe_size, ++ cmd.wr_count)); + if (IS_ERR(wqes)) + return PTR_ERR(wqes); +- sgls = uverbs_request_next_ptr( +- &iter, cmd.sge_count * sizeof(struct ib_uverbs_sge)); ++ sgls = uverbs_request_next_ptr(&iter, ++ size_mul(cmd.sge_count, ++ sizeof(struct ib_uverbs_sge))); + if (IS_ERR(sgls)) + return PTR_ERR(sgls); + ret = uverbs_request_finish(&iter); +@@ -2199,11 +2201,11 @@ ib_uverbs_unmarshall_recv(struct uverbs_ + if (wqe_size < sizeof(struct ib_uverbs_recv_wr)) + return ERR_PTR(-EINVAL); + +- wqes = uverbs_request_next_ptr(iter, wqe_size * wr_count); ++ wqes = uverbs_request_next_ptr(iter, size_mul(wqe_size, wr_count)); + if (IS_ERR(wqes)) + return ERR_CAST(wqes); +- sgls = uverbs_request_next_ptr( +- iter, sge_count * sizeof(struct ib_uverbs_sge)); ++ sgls = uverbs_request_next_ptr(iter, size_mul(sge_count, ++ sizeof(struct ib_uverbs_sge))); + if (IS_ERR(sgls)) + return ERR_CAST(sgls); + ret = uverbs_request_finish(iter); diff --git a/queue-6.6/scripts-sorttable-fix-orc_sort_cmp-to-maintain-symmetry-and-transitivity.patch b/queue-6.6/scripts-sorttable-fix-orc_sort_cmp-to-maintain-symmetry-and-transitivity.patch new file mode 100644 index 00000000000..c86c6866eb4 --- /dev/null +++ b/queue-6.6/scripts-sorttable-fix-orc_sort_cmp-to-maintain-symmetry-and-transitivity.patch @@ -0,0 +1,62 @@ +From 0210d251162f4033350a94a43f95b1c39ec84a90 Mon Sep 17 00:00:00 2001 +From: Kuan-Wei Chiu +Date: Thu, 26 Dec 2024 22:03:32 +0800 +Subject: scripts/sorttable: fix orc_sort_cmp() to maintain symmetry and transitivity + +From: Kuan-Wei Chiu + +commit 0210d251162f4033350a94a43f95b1c39ec84a90 upstream. + +The orc_sort_cmp() function, used with qsort(), previously violated the +symmetry and transitivity rules required by the C standard. Specifically, +when both entries are ORC_TYPE_UNDEFINED, it could result in both a < b +and b < a, which breaks the required symmetry and transitivity. This can +lead to undefined behavior and incorrect sorting results, potentially +causing memory corruption in glibc implementations [1]. + +Symmetry: If x < y, then y > x. +Transitivity: If x < y and y < z, then x < z. + +Fix the comparison logic to return 0 when both entries are +ORC_TYPE_UNDEFINED, ensuring compliance with qsort() requirements. + +Link: https://www.qualys.com/2024/01/30/qsort.txt [1] +Link: https://lkml.kernel.org/r/20241226140332.2670689-1-visitorckw@gmail.com +Fixes: 57fa18994285 ("scripts/sorttable: Implement build-time ORC unwind table sorting") +Fixes: fb799447ae29 ("x86,objtool: Split UNWIND_HINT_EMPTY in two") +Signed-off-by: Kuan-Wei Chiu +Cc: Ching-Chun (Jim) Huang +Cc: +Cc: Ingo Molnar +Cc: Josh Poimboeuf +Cc: Peter Zijlstra +Cc: Shile Zhang +Cc: Steven Rostedt +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + scripts/sorttable.h | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/scripts/sorttable.h ++++ b/scripts/sorttable.h +@@ -110,7 +110,7 @@ static inline unsigned long orc_ip(const + + static int orc_sort_cmp(const void *_a, const void *_b) + { +- struct orc_entry *orc_a; ++ struct orc_entry *orc_a, *orc_b; + const int *a = g_orc_ip_table + *(int *)_a; + const int *b = g_orc_ip_table + *(int *)_b; + unsigned long a_val = orc_ip(a); +@@ -128,6 +128,9 @@ static int orc_sort_cmp(const void *_a, + * whitelisted .o files which didn't get objtool generation. + */ + orc_a = g_orc_table + (a - g_orc_ip_table); ++ orc_b = g_orc_table + (b - g_orc_ip_table); ++ if (orc_a->type == ORC_TYPE_UNDEFINED && orc_b->type == ORC_TYPE_UNDEFINED) ++ return 0; + return orc_a->type == ORC_TYPE_UNDEFINED ? -1 : 1; + } + diff --git a/queue-6.6/series b/queue-6.6/series index 5a0e1461b55..298e25b138a 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -201,3 +201,14 @@ revert-bpf-support-non-r10-register-spill-fill-to-from-stack-in-precision-tracki alsa-seq-check-ump-support-for-midi_version-change.patch alsa-hda-realtek-add-quirk-for-framework-f111-000c.patch alsa-seq-oss-fix-races-at-processing-sysex-messages.patch +ocfs2-fix-slab-use-after-free-due-to-dangling-pointer-dqi_priv.patch +kcov-mark-in_softirq_really-as-__always_inline.patch +scripts-sorttable-fix-orc_sort_cmp-to-maintain-symmetry-and-transitivity.patch +rdma-uverbs-prevent-integer-overflow-issue.patch +pinctrl-mcp23s08-fix-sleeping-in-atomic-context-due-to-regmap-locking.patch +sky2-add-device-id-11ab-4373-for-marvell-88e8075.patch +net-sctp-prevent-autoclose-integer-overflow-in-sctp_association_init.patch +drm-adv7511-drop-dsi-single-lane-support.patch +dt-bindings-display-adi-adv7533-drop-single-lane-support.patch +drm-adv7511-fix-use-after-free-in-adv7533_attach_dsi.patch +fs-proc-task_mmu-fix-pagemap-flags-with-pmd-thp-entries-on-32bit.patch diff --git a/queue-6.6/sky2-add-device-id-11ab-4373-for-marvell-88e8075.patch b/queue-6.6/sky2-add-device-id-11ab-4373-for-marvell-88e8075.patch new file mode 100644 index 00000000000..c7cc5dfe5f0 --- /dev/null +++ b/queue-6.6/sky2-add-device-id-11ab-4373-for-marvell-88e8075.patch @@ -0,0 +1,31 @@ +From 03c8d0af2e409e15c16130b185e12b5efba0a6b9 Mon Sep 17 00:00:00 2001 +From: Pascal Hambourg +Date: Mon, 23 Dec 2024 17:44:01 +0100 +Subject: sky2: Add device ID 11ab:4373 for Marvell 88E8075 + +From: Pascal Hambourg + +commit 03c8d0af2e409e15c16130b185e12b5efba0a6b9 upstream. + +A Marvell 88E8075 ethernet controller has this device ID instead of +11ab:4370 and works fine with the sky2 driver. + +Signed-off-by: Pascal Hambourg +Cc: stable@vger.kernel.org +Link: https://patch.msgid.link/10165a62-99fb-4be6-8c64-84afd6234085@plouf.fr.eu.org +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/marvell/sky2.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/ethernet/marvell/sky2.c ++++ b/drivers/net/ethernet/marvell/sky2.c +@@ -129,6 +129,7 @@ static const struct pci_device_id sky2_i + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436C) }, /* 88E8072 */ + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436D) }, /* 88E8055 */ + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4370) }, /* 88E8075 */ ++ { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4373) }, /* 88E8075 */ + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4380) }, /* 88E8057 */ + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4381) }, /* 88E8059 */ + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4382) }, /* 88E8079 */