From: Greg Kroah-Hartman Date: Mon, 14 Oct 2024 12:31:57 +0000 (+0200) Subject: 5.15-stable patches X-Git-Tag: v5.10.227~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cf8b1b8e97b07a6ff273a8b5b4eb744d816a0d67;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: drm-v3d-stop-the-active-perfmon-before-being-destroyed.patch kthread-unpark-only-parked-kthread.patch mptcp-pm-do-not-remove-closing-subflows.patch net-dsa-lan9303-ensure-chip-reset-and-wait-for-ready-status.patch net-explicitly-clear-the-sk-pointer-when-pf-create-fails.patch net-fix-an-unsafe-loop-on-the-list.patch nouveau-dmem-fix-vulnerability-in-migrate_to_ram-upon-copy-error.patch --- diff --git a/queue-5.15/drm-v3d-stop-the-active-perfmon-before-being-destroyed.patch b/queue-5.15/drm-v3d-stop-the-active-perfmon-before-being-destroyed.patch new file mode 100644 index 00000000000..88ca7b0959f --- /dev/null +++ b/queue-5.15/drm-v3d-stop-the-active-perfmon-before-being-destroyed.patch @@ -0,0 +1,113 @@ +From 7d1fd3638ee3a9f9bca4785fffb638ca19120718 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ma=C3=ADra=20Canal?= +Date: Fri, 4 Oct 2024 10:02:29 -0300 +Subject: drm/v3d: Stop the active perfmon before being destroyed +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Maíra Canal + +commit 7d1fd3638ee3a9f9bca4785fffb638ca19120718 upstream. + +When running `kmscube` with one or more performance monitors enabled +via `GALLIUM_HUD`, the following kernel panic can occur: + +[ 55.008324] Unable to handle kernel paging request at virtual address 00000000052004a4 +[ 55.008368] Mem abort info: +[ 55.008377] ESR = 0x0000000096000005 +[ 55.008387] EC = 0x25: DABT (current EL), IL = 32 bits +[ 55.008402] SET = 0, FnV = 0 +[ 55.008412] EA = 0, S1PTW = 0 +[ 55.008421] FSC = 0x05: level 1 translation fault +[ 55.008434] Data abort info: +[ 55.008442] ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000 +[ 55.008455] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 +[ 55.008467] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 +[ 55.008481] user pgtable: 4k pages, 39-bit VAs, pgdp=00000001046c6000 +[ 55.008497] [00000000052004a4] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000 +[ 55.008525] Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP +[ 55.008542] Modules linked in: rfcomm [...] vc4 v3d snd_soc_hdmi_codec drm_display_helper +gpu_sched drm_shmem_helper cec drm_dma_helper drm_kms_helper i2c_brcmstb +drm drm_panel_orientation_quirks snd_soc_core snd_compress snd_pcm_dmaengine snd_pcm snd_timer snd backlight +[ 55.008799] CPU: 2 PID: 166 Comm: v3d_bin Tainted: G C 6.6.47+rpt-rpi-v8 #1 Debian 1:6.6.47-1+rpt1 +[ 55.008824] Hardware name: Raspberry Pi 4 Model B Rev 1.5 (DT) +[ 55.008838] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) +[ 55.008855] pc : __mutex_lock.constprop.0+0x90/0x608 +[ 55.008879] lr : __mutex_lock.constprop.0+0x58/0x608 +[ 55.008895] sp : ffffffc080673cf0 +[ 55.008904] x29: ffffffc080673cf0 x28: 0000000000000000 x27: ffffff8106188a28 +[ 55.008926] x26: ffffff8101e78040 x25: ffffff8101baa6c0 x24: ffffffd9d989f148 +[ 55.008947] x23: ffffffda1c2a4008 x22: 0000000000000002 x21: ffffffc080673d38 +[ 55.008968] x20: ffffff8101238000 x19: ffffff8104f83188 x18: 0000000000000000 +[ 55.008988] x17: 0000000000000000 x16: ffffffda1bd04d18 x15: 00000055bb08bc90 +[ 55.009715] x14: 0000000000000000 x13: 0000000000000000 x12: ffffffda1bd4cbb0 +[ 55.010433] x11: 00000000fa83b2da x10: 0000000000001a40 x9 : ffffffda1bd04d04 +[ 55.011162] x8 : ffffff8102097b80 x7 : 0000000000000000 x6 : 00000000030a5857 +[ 55.011880] x5 : 00ffffffffffffff x4 : 0300000005200470 x3 : 0300000005200470 +[ 55.012598] x2 : ffffff8101238000 x1 : 0000000000000021 x0 : 0300000005200470 +[ 55.013292] Call trace: +[ 55.013959] __mutex_lock.constprop.0+0x90/0x608 +[ 55.014646] __mutex_lock_slowpath+0x1c/0x30 +[ 55.015317] mutex_lock+0x50/0x68 +[ 55.015961] v3d_perfmon_stop+0x40/0xe0 [v3d] +[ 55.016627] v3d_bin_job_run+0x10c/0x2d8 [v3d] +[ 55.017282] drm_sched_main+0x178/0x3f8 [gpu_sched] +[ 55.017921] kthread+0x11c/0x128 +[ 55.018554] ret_from_fork+0x10/0x20 +[ 55.019168] Code: f9400260 f1001c1f 54001ea9 927df000 (b9403401) +[ 55.019776] ---[ end trace 0000000000000000 ]--- +[ 55.020411] note: v3d_bin[166] exited with preempt_count 1 + +This issue arises because, upon closing the file descriptor (which happens +when we interrupt `kmscube`), the active performance monitor is not +stopped. Although all perfmons are destroyed in `v3d_perfmon_close_file()`, +the active performance monitor's pointer (`v3d->active_perfmon`) is still +retained. + +If `kmscube` is run again, the driver will attempt to stop the active +performance monitor using the stale pointer in `v3d->active_perfmon`. +However, this pointer is no longer valid because the previous process has +already terminated, and all performance monitors associated with it have +been destroyed and freed. + +To fix this, when the active performance monitor belongs to a given +process, explicitly stop it before destroying and freeing it. + +Cc: stable@vger.kernel.org # v5.15+ +Closes: https://github.com/raspberrypi/linux/issues/6389 +Fixes: 26a4dc29b74a ("drm/v3d: Expose performance counters to userspace") +Signed-off-by: Maíra Canal +Reviewed-by: Juan A. Suarez +Link: https://patchwork.freedesktop.org/patch/msgid/20241004130625.918580-2-mcanal@igalia.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/v3d/v3d_perfmon.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/v3d/v3d_perfmon.c ++++ b/drivers/gpu/drm/v3d/v3d_perfmon.c +@@ -101,6 +101,11 @@ void v3d_perfmon_open_file(struct v3d_fi + static int v3d_perfmon_idr_del(int id, void *elem, void *data) + { + struct v3d_perfmon *perfmon = elem; ++ struct v3d_dev *v3d = (struct v3d_dev *)data; ++ ++ /* If the active perfmon is being destroyed, stop it first */ ++ if (perfmon == v3d->active_perfmon) ++ v3d_perfmon_stop(v3d, perfmon, false); + + v3d_perfmon_put(perfmon); + +@@ -109,8 +114,10 @@ static int v3d_perfmon_idr_del(int id, v + + void v3d_perfmon_close_file(struct v3d_file_priv *v3d_priv) + { ++ struct v3d_dev *v3d = v3d_priv->v3d; ++ + mutex_lock(&v3d_priv->perfmon.lock); +- idr_for_each(&v3d_priv->perfmon.idr, v3d_perfmon_idr_del, NULL); ++ idr_for_each(&v3d_priv->perfmon.idr, v3d_perfmon_idr_del, v3d); + idr_destroy(&v3d_priv->perfmon.idr); + mutex_unlock(&v3d_priv->perfmon.lock); + } diff --git a/queue-5.15/kthread-unpark-only-parked-kthread.patch b/queue-5.15/kthread-unpark-only-parked-kthread.patch new file mode 100644 index 00000000000..bc6e902e9a6 --- /dev/null +++ b/queue-5.15/kthread-unpark-only-parked-kthread.patch @@ -0,0 +1,65 @@ +From 214e01ad4ed7158cab66498810094fac5d09b218 Mon Sep 17 00:00:00 2001 +From: Frederic Weisbecker +Date: Fri, 13 Sep 2024 23:46:34 +0200 +Subject: kthread: unpark only parked kthread + +From: Frederic Weisbecker + +commit 214e01ad4ed7158cab66498810094fac5d09b218 upstream. + +Calling into kthread unparking unconditionally is mostly harmless when +the kthread is already unparked. The wake up is then simply ignored +because the target is not in TASK_PARKED state. + +However if the kthread is per CPU, the wake up is preceded by a call +to kthread_bind() which expects the task to be inactive and in +TASK_PARKED state, which obviously isn't the case if it is unparked. + +As a result, calling kthread_stop() on an unparked per-cpu kthread +triggers such a warning: + + WARNING: CPU: 0 PID: 11 at kernel/kthread.c:525 __kthread_bind_mask kernel/kthread.c:525 + + kthread_stop+0x17a/0x630 kernel/kthread.c:707 + destroy_workqueue+0x136/0xc40 kernel/workqueue.c:5810 + wg_destruct+0x1e2/0x2e0 drivers/net/wireguard/device.c:257 + netdev_run_todo+0xe1a/0x1000 net/core/dev.c:10693 + default_device_exit_batch+0xa14/0xa90 net/core/dev.c:11769 + ops_exit_list net/core/net_namespace.c:178 [inline] + cleanup_net+0x89d/0xcc0 net/core/net_namespace.c:640 + process_one_work kernel/workqueue.c:3231 [inline] + process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312 + worker_thread+0x86d/0xd70 kernel/workqueue.c:3393 + kthread+0x2f0/0x390 kernel/kthread.c:389 + ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 + ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 + + +Fix this with skipping unecessary unparking while stopping a kthread. + +Link: https://lkml.kernel.org/r/20240913214634.12557-1-frederic@kernel.org +Fixes: 5c25b5ff89f0 ("workqueue: Tag bound workers with KTHREAD_IS_PER_CPU") +Signed-off-by: Frederic Weisbecker +Reported-by: syzbot+943d34fa3cf2191e3068@syzkaller.appspotmail.com +Tested-by: syzbot+943d34fa3cf2191e3068@syzkaller.appspotmail.com +Suggested-by: Thomas Gleixner +Cc: Hillf Danton +Cc: Tejun Heo +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + kernel/kthread.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/kernel/kthread.c ++++ b/kernel/kthread.c +@@ -578,6 +578,8 @@ void kthread_unpark(struct task_struct * + { + struct kthread *kthread = to_kthread(k); + ++ if (!test_bit(KTHREAD_SHOULD_PARK, &kthread->flags)) ++ return; + /* + * Newly created kthread was parked when the CPU was offline. + * The binding was lost and we need to set it again. diff --git a/queue-5.15/mptcp-pm-do-not-remove-closing-subflows.patch b/queue-5.15/mptcp-pm-do-not-remove-closing-subflows.patch new file mode 100644 index 00000000000..ea93e6f957c --- /dev/null +++ b/queue-5.15/mptcp-pm-do-not-remove-closing-subflows.patch @@ -0,0 +1,41 @@ +From db0a37b7ac27d8ca27d3dc676a16d081c16ec7b9 Mon Sep 17 00:00:00 2001 +From: "Matthieu Baerts (NGI0)" +Date: Tue, 8 Oct 2024 13:04:55 +0200 +Subject: mptcp: pm: do not remove closing subflows + +From: Matthieu Baerts (NGI0) + +commit db0a37b7ac27d8ca27d3dc676a16d081c16ec7b9 upstream. + +In a previous fix, the in-kernel path-manager has been modified not to +retrigger the removal of a subflow if it was already closed, e.g. when +the initial subflow is removed, but kept in the subflows list. + +To be complete, this fix should also skip the subflows that are in any +closing state: mptcp_close_ssk() will initiate the closure, but the +switch to the TCP_CLOSE state depends on the other peer. + +Fixes: 58e1b66b4e4b ("mptcp: pm: do not remove already closed subflows") +Cc: stable@vger.kernel.org +Suggested-by: Paolo Abeni +Acked-by: Paolo Abeni +Signed-off-by: Matthieu Baerts (NGI0) +Link: https://patch.msgid.link/20241008-net-mptcp-fallback-fixes-v1-4-c6fb8e93e551@kernel.org +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + net/mptcp/pm_netlink.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/net/mptcp/pm_netlink.c ++++ b/net/mptcp/pm_netlink.c +@@ -778,7 +778,8 @@ static void mptcp_pm_nl_rm_addr_or_subfl + int how = RCV_SHUTDOWN | SEND_SHUTDOWN; + u8 id = subflow->local_id; + +- if (inet_sk_state_load(ssk) == TCP_CLOSE) ++ if ((1 << inet_sk_state_load(ssk)) & ++ (TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 | TCPF_CLOSING | TCPF_CLOSE)) + continue; + + if (rm_type == MPTCP_MIB_RMADDR) diff --git a/queue-5.15/net-dsa-lan9303-ensure-chip-reset-and-wait-for-ready-status.patch b/queue-5.15/net-dsa-lan9303-ensure-chip-reset-and-wait-for-ready-status.patch new file mode 100644 index 00000000000..2b094f01a0d --- /dev/null +++ b/queue-5.15/net-dsa-lan9303-ensure-chip-reset-and-wait-for-ready-status.patch @@ -0,0 +1,83 @@ +From 5c14e51d2d7df49fe0d4e64a12c58d2542f452ff Mon Sep 17 00:00:00 2001 +From: Anatolij Gustschin +Date: Fri, 4 Oct 2024 13:36:54 +0200 +Subject: net: dsa: lan9303: ensure chip reset and wait for READY status + +From: Anatolij Gustschin + +commit 5c14e51d2d7df49fe0d4e64a12c58d2542f452ff upstream. + +Accessing device registers seems to be not reliable, the chip +revision is sometimes detected wrongly (0 instead of expected 1). + +Ensure that the chip reset is performed via reset GPIO and then +wait for 'Device Ready' status in HW_CFG register before doing +any register initializations. + +Cc: stable@vger.kernel.org +Fixes: a1292595e006 ("net: dsa: add new DSA switch driver for the SMSC-LAN9303") +Signed-off-by: Anatolij Gustschin +[alex: reworked using read_poll_timeout()] +Signed-off-by: Alexander Sverdlin +Reviewed-by: Vladimir Oltean +Link: https://patch.msgid.link/20241004113655.3436296-1-alexander.sverdlin@siemens.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/dsa/lan9303-core.c | 29 +++++++++++++++++++++++++++++ + 1 file changed, 29 insertions(+) + +--- a/drivers/net/dsa/lan9303-core.c ++++ b/drivers/net/dsa/lan9303-core.c +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -820,6 +821,8 @@ static void lan9303_handle_reset(struct + if (!chip->reset_gpio) + return; + ++ gpiod_set_value_cansleep(chip->reset_gpio, 1); ++ + if (chip->reset_duration != 0) + msleep(chip->reset_duration); + +@@ -845,8 +848,34 @@ static int lan9303_disable_processing(st + static int lan9303_check_device(struct lan9303 *chip) + { + int ret; ++ int err; + u32 reg; + ++ /* In I2C-managed configurations this polling loop will clash with ++ * switch's reading of EEPROM right after reset and this behaviour is ++ * not configurable. While lan9303_read() already has quite long retry ++ * timeout, seems not all cases are being detected as arbitration error. ++ * ++ * According to datasheet, EEPROM loader has 30ms timeout (in case of ++ * missing EEPROM). ++ * ++ * Loading of the largest supported EEPROM is expected to take at least ++ * 5.9s. ++ */ ++ err = read_poll_timeout(lan9303_read, ret, ++ !ret && reg & LAN9303_HW_CFG_READY, ++ 20000, 6000000, false, ++ chip->regmap, LAN9303_HW_CFG, ®); ++ if (ret) { ++ dev_err(chip->dev, "failed to read HW_CFG reg: %pe\n", ++ ERR_PTR(ret)); ++ return ret; ++ } ++ if (err) { ++ dev_err(chip->dev, "HW_CFG not ready: 0x%08x\n", reg); ++ return err; ++ } ++ + ret = lan9303_read(chip->regmap, LAN9303_CHIP_REV, ®); + if (ret) { + dev_err(chip->dev, "failed to read chip revision register: %d\n", diff --git a/queue-5.15/net-explicitly-clear-the-sk-pointer-when-pf-create-fails.patch b/queue-5.15/net-explicitly-clear-the-sk-pointer-when-pf-create-fails.patch new file mode 100644 index 00000000000..876f7df785f --- /dev/null +++ b/queue-5.15/net-explicitly-clear-the-sk-pointer-when-pf-create-fails.patch @@ -0,0 +1,56 @@ +From 631083143315d1b192bd7d915b967b37819e88ea Mon Sep 17 00:00:00 2001 +From: Ignat Korchagin +Date: Thu, 3 Oct 2024 18:01:51 +0100 +Subject: net: explicitly clear the sk pointer, when pf->create fails + +From: Ignat Korchagin + +commit 631083143315d1b192bd7d915b967b37819e88ea upstream. + +We have recently noticed the exact same KASAN splat as in commit +6cd4a78d962b ("net: do not leave a dangling sk pointer, when socket +creation fails"). The problem is that commit did not fully address the +problem, as some pf->create implementations do not use sk_common_release +in their error paths. + +For example, we can use the same reproducer as in the above commit, but +changing ping to arping. arping uses AF_PACKET socket and if packet_create +fails, it will just sk_free the allocated sk object. + +While we could chase all the pf->create implementations and make sure they +NULL the freed sk object on error from the socket, we can't guarantee +future protocols will not make the same mistake. + +So it is easier to just explicitly NULL the sk pointer upon return from +pf->create in __sock_create. We do know that pf->create always releases the +allocated sk object on error, so if the pointer is not NULL, it is +definitely dangling. + +Fixes: 6cd4a78d962b ("net: do not leave a dangling sk pointer, when socket creation fails") +Signed-off-by: Ignat Korchagin +Cc: stable@vger.kernel.org +Reviewed-by: Eric Dumazet +Link: https://patch.msgid.link/20241003170151.69445-1-ignat@cloudflare.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + net/socket.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/net/socket.c ++++ b/net/socket.c +@@ -1484,8 +1484,13 @@ int __sock_create(struct net *net, int f + rcu_read_unlock(); + + err = pf->create(net, sock, protocol, kern); +- if (err < 0) ++ if (err < 0) { ++ /* ->create should release the allocated sock->sk object on error ++ * but it may leave the dangling pointer ++ */ ++ sock->sk = NULL; + goto out_module_put; ++ } + + /* + * Now to bump the refcnt of the [loadable] module that owns this diff --git a/queue-5.15/net-fix-an-unsafe-loop-on-the-list.patch b/queue-5.15/net-fix-an-unsafe-loop-on-the-list.patch new file mode 100644 index 00000000000..7f61e719f69 --- /dev/null +++ b/queue-5.15/net-fix-an-unsafe-loop-on-the-list.patch @@ -0,0 +1,60 @@ +From 1dae9f1187189bc09ff6d25ca97ead711f7e26f9 Mon Sep 17 00:00:00 2001 +From: Anastasia Kovaleva +Date: Thu, 3 Oct 2024 13:44:31 +0300 +Subject: net: Fix an unsafe loop on the list + +From: Anastasia Kovaleva + +commit 1dae9f1187189bc09ff6d25ca97ead711f7e26f9 upstream. + +The kernel may crash when deleting a genetlink family if there are still +listeners for that family: + +Oops: Kernel access of bad area, sig: 11 [#1] + ... + NIP [c000000000c080bc] netlink_update_socket_mc+0x3c/0xc0 + LR [c000000000c0f764] __netlink_clear_multicast_users+0x74/0xc0 + Call Trace: +__netlink_clear_multicast_users+0x74/0xc0 +genl_unregister_family+0xd4/0x2d0 + +Change the unsafe loop on the list to a safe one, because inside the +loop there is an element removal from this list. + +Fixes: b8273570f802 ("genetlink: fix netns vs. netlink table locking (2)") +Cc: stable@vger.kernel.org +Signed-off-by: Anastasia Kovaleva +Reviewed-by: Dmitry Bogdanov +Reviewed-by: Kuniyuki Iwashima +Link: https://patch.msgid.link/20241003104431.12391-1-a.kovaleva@yadro.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + include/net/sock.h | 2 ++ + net/netlink/af_netlink.c | 3 ++- + 2 files changed, 4 insertions(+), 1 deletion(-) + +--- a/include/net/sock.h ++++ b/include/net/sock.h +@@ -850,6 +850,8 @@ static inline void sk_add_bind_node(stru + hlist_for_each_entry_safe(__sk, tmp, list, sk_node) + #define sk_for_each_bound(__sk, list) \ + hlist_for_each_entry(__sk, list, sk_bind_node) ++#define sk_for_each_bound_safe(__sk, tmp, list) \ ++ hlist_for_each_entry_safe(__sk, tmp, list, sk_bind_node) + + /** + * sk_for_each_entry_offset_rcu - iterate over a list at a given struct offset +--- a/net/netlink/af_netlink.c ++++ b/net/netlink/af_netlink.c +@@ -2159,8 +2159,9 @@ void __netlink_clear_multicast_users(str + { + struct sock *sk; + struct netlink_table *tbl = &nl_table[ksk->sk_protocol]; ++ struct hlist_node *tmp; + +- sk_for_each_bound(sk, &tbl->mc_list) ++ sk_for_each_bound_safe(sk, tmp, &tbl->mc_list) + netlink_update_socket_mc(nlk_sk(sk), group, 0); + } + diff --git a/queue-5.15/nouveau-dmem-fix-vulnerability-in-migrate_to_ram-upon-copy-error.patch b/queue-5.15/nouveau-dmem-fix-vulnerability-in-migrate_to_ram-upon-copy-error.patch new file mode 100644 index 00000000000..555ce95336f --- /dev/null +++ b/queue-5.15/nouveau-dmem-fix-vulnerability-in-migrate_to_ram-upon-copy-error.patch @@ -0,0 +1,48 @@ +From 835745a377a4519decd1a36d6b926e369b3033e2 Mon Sep 17 00:00:00 2001 +From: Yonatan Maman +Date: Tue, 8 Oct 2024 14:59:43 +0300 +Subject: nouveau/dmem: Fix vulnerability in migrate_to_ram upon copy error + +From: Yonatan Maman + +commit 835745a377a4519decd1a36d6b926e369b3033e2 upstream. + +The `nouveau_dmem_copy_one` function ensures that the copy push command is +sent to the device firmware but does not track whether it was executed +successfully. + +In the case of a copy error (e.g., firmware or hardware failure), the +copy push command will be sent via the firmware channel, and +`nouveau_dmem_copy_one` will likely report success, leading to the +`migrate_to_ram` function returning a dirty HIGH_USER page to the user. + +This can result in a security vulnerability, as a HIGH_USER page that may +contain sensitive or corrupted data could be returned to the user. + +To prevent this vulnerability, we allocate a zero page. Thus, in case of +an error, a non-dirty (zero) page will be returned to the user. + +Fixes: 5be73b690875 ("drm/nouveau/dmem: device memory helpers for SVM") +Signed-off-by: Yonatan Maman +Co-developed-by: Gal Shalom +Signed-off-by: Gal Shalom +Reviewed-by: Ben Skeggs +Cc: stable@vger.kernel.org +Signed-off-by: Danilo Krummrich +Link: https://patchwork.freedesktop.org/patch/msgid/20241008115943.990286-3-ymaman@nvidia.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/nouveau/nouveau_dmem.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/nouveau/nouveau_dmem.c ++++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c +@@ -149,7 +149,7 @@ static vm_fault_t nouveau_dmem_fault_cop + if (!spage || !(args->src[0] & MIGRATE_PFN_MIGRATE)) + return 0; + +- dpage = alloc_page_vma(GFP_HIGHUSER, vmf->vma, vmf->address); ++ dpage = alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vmf->vma, vmf->address); + if (!dpage) + return VM_FAULT_SIGBUS; + lock_page(dpage); diff --git a/queue-5.15/series b/queue-5.15/series index 3d46c030c4a..a1ae9879344 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -676,3 +676,10 @@ usb-dwc3-core-stop-processing-of-pending-events-if-controller-is-halted.patch usb-xhci-fix-problem-with-xhci-resume-from-suspend.patch usb-storage-ignore-bogus-device-raised-by-jieli-br21-usb-sound-chip.patch hid-intel-ish-hid-fix-uninitialized-variable-rv-in-ish_fw_xfer_direct_dma.patch +drm-v3d-stop-the-active-perfmon-before-being-destroyed.patch +net-explicitly-clear-the-sk-pointer-when-pf-create-fails.patch +net-fix-an-unsafe-loop-on-the-list.patch +net-dsa-lan9303-ensure-chip-reset-and-wait-for-ready-status.patch +mptcp-pm-do-not-remove-closing-subflows.patch +nouveau-dmem-fix-vulnerability-in-migrate_to_ram-upon-copy-error.patch +kthread-unpark-only-parked-kthread.patch