From: Greg Kroah-Hartman Date: Mon, 14 Nov 2022 11:51:42 +0000 (+0100) Subject: 5.15-stable patches X-Git-Tag: v5.10.155~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=79495a12c061d1c3079a989a92bf56404b2f525b;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: drm-amdkfd-migrate-in-cpu-page-fault-use-current-mm.patch marvell-octeontx2-build-error-unknown-type-name-u64.patch net-tun-call-napi_schedule_prep-to-ensure-we-own-a-napi.patch --- diff --git a/queue-5.15/drm-amdkfd-migrate-in-cpu-page-fault-use-current-mm.patch b/queue-5.15/drm-amdkfd-migrate-in-cpu-page-fault-use-current-mm.patch new file mode 100644 index 00000000000..6662c9a422d --- /dev/null +++ b/queue-5.15/drm-amdkfd-migrate-in-cpu-page-fault-use-current-mm.patch @@ -0,0 +1,44 @@ +From 3a876060892ba52dd67d197c78b955e62657d906 Mon Sep 17 00:00:00 2001 +From: Philip Yang +Date: Thu, 8 Sep 2022 17:56:09 -0400 +Subject: drm/amdkfd: Migrate in CPU page fault use current mm + +From: Philip Yang + +commit 3a876060892ba52dd67d197c78b955e62657d906 upstream. + +migrate_vma_setup shows below warning because we don't hold another +process mm mmap_lock. We should use current vmf->vma->vm_mm instead, the +caller already hold current mmap lock inside CPU page fault handler. + + WARNING: CPU: 10 PID: 3054 at include/linux/mmap_lock.h:155 find_vma + Call Trace: + walk_page_range+0x76/0x150 + migrate_vma_setup+0x18a/0x640 + svm_migrate_vram_to_ram+0x245/0xa10 [amdgpu] + svm_migrate_to_ram+0x36f/0x470 [amdgpu] + do_swap_page+0xcfe/0xec0 + __handle_mm_fault+0x96b/0x15e0 + handle_mm_fault+0x13f/0x3e0 + do_user_addr_fault+0x1e7/0x690 + +Fixes: e1f84eef313f ("drm/amdkfd: handle CPU fault on COW mapping") +Signed-off-by: Philip Yang +Reviewed-by: Felix Kuehling +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +@@ -845,7 +845,7 @@ static vm_fault_t svm_migrate_to_ram(str + goto out_unlock_prange; + } + +- r = svm_migrate_vram_to_ram(prange, mm); ++ r = svm_migrate_vram_to_ram(prange, vmf->vma->vm_mm); + if (r) + pr_debug("failed %d migrate svms 0x%p range 0x%p [0x%lx 0x%lx]\n", + r, prange->svms, prange, prange->start, prange->last); diff --git a/queue-5.15/marvell-octeontx2-build-error-unknown-type-name-u64.patch b/queue-5.15/marvell-octeontx2-build-error-unknown-type-name-u64.patch new file mode 100644 index 00000000000..60ffb7fc1e9 --- /dev/null +++ b/queue-5.15/marvell-octeontx2-build-error-unknown-type-name-u64.patch @@ -0,0 +1,39 @@ +From 6312d52838b21f5c4a5afa1269a00df4364fd354 Mon Sep 17 00:00:00 2001 +From: Anders Roxell +Date: Wed, 13 Oct 2021 15:57:43 +0200 +Subject: marvell: octeontx2: build error: unknown type name 'u64' + +From: Anders Roxell + +commit 6312d52838b21f5c4a5afa1269a00df4364fd354 upstream. + +Building an allmodconfig kernel arm64 kernel, the following build error +shows up: + +In file included from drivers/crypto/marvell/octeontx2/cn10k_cpt.c:4: +include/linux/soc/marvell/octeontx2/asm.h:38:15: error: unknown type name 'u64' + 38 | static inline u64 otx2_atomic64_fetch_add(u64 incr, u64 *ptr) + | ^~~ + +Include linux/types.h in asm.h so the compiler knows what the type +'u64' are. + +Fixes: af3826db74d1 ("octeontx2-pf: Use hardware register for CQE count") +Signed-off-by: Anders Roxell +Link: https://lore.kernel.org/r/20211013135743.3826594-1-anders.roxell@linaro.org +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/soc/marvell/octeontx2/asm.h | 1 + + 1 file changed, 1 insertion(+) + +--- a/include/linux/soc/marvell/octeontx2/asm.h ++++ b/include/linux/soc/marvell/octeontx2/asm.h +@@ -5,6 +5,7 @@ + #ifndef __SOC_OTX2_ASM_H + #define __SOC_OTX2_ASM_H + ++#include + #if defined(CONFIG_ARM64) + /* + * otx2_lmt_flush is used for LMT store operation. diff --git a/queue-5.15/net-tun-call-napi_schedule_prep-to-ensure-we-own-a-napi.patch b/queue-5.15/net-tun-call-napi_schedule_prep-to-ensure-we-own-a-napi.patch new file mode 100644 index 00000000000..3ddae6488c4 --- /dev/null +++ b/queue-5.15/net-tun-call-napi_schedule_prep-to-ensure-we-own-a-napi.patch @@ -0,0 +1,93 @@ +From 07d120aa33cc9d9115753d159f64d20c94458781 Mon Sep 17 00:00:00 2001 +From: Eric Dumazet +Date: Mon, 7 Nov 2022 18:00:11 +0000 +Subject: net: tun: call napi_schedule_prep() to ensure we own a napi + +From: Eric Dumazet + +commit 07d120aa33cc9d9115753d159f64d20c94458781 upstream. + +A recent patch exposed another issue in napi_get_frags() +caught by syzbot [1] + +Before feeding packets to GRO, and calling napi_complete() +we must first grab NAPI_STATE_SCHED. + +[1] +WARNING: CPU: 0 PID: 3612 at net/core/dev.c:6076 napi_complete_done+0x45b/0x880 net/core/dev.c:6076 +Modules linked in: +CPU: 0 PID: 3612 Comm: syz-executor408 Not tainted 6.1.0-rc3-syzkaller-00175-g1118b2049d77 #0 +Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 +RIP: 0010:napi_complete_done+0x45b/0x880 net/core/dev.c:6076 +Code: c1 ea 03 0f b6 14 02 4c 89 f0 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 24 04 00 00 41 89 5d 1c e9 73 fc ff ff e8 b5 53 22 fa <0f> 0b e9 82 fe ff ff e8 a9 53 22 fa 48 8b 5c 24 08 31 ff 48 89 de +RSP: 0018:ffffc90003c4f920 EFLAGS: 00010293 +RAX: 0000000000000000 RBX: 0000000000000030 RCX: 0000000000000000 +RDX: ffff8880251c0000 RSI: ffffffff875a58db RDI: 0000000000000007 +RBP: 0000000000000001 R08: 0000000000000007 R09: 0000000000000000 +R10: 0000000000000001 R11: 0000000000000001 R12: ffff888072d02628 +R13: ffff888072d02618 R14: ffff888072d02634 R15: 0000000000000000 +FS: 0000555555f13300(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000 +CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +CR2: 000055c44d3892b8 CR3: 00000000172d2000 CR4: 00000000003506f0 +DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 +DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 +Call Trace: + +napi_complete include/linux/netdevice.h:510 [inline] +tun_get_user+0x206d/0x3a60 drivers/net/tun.c:1980 +tun_chr_write_iter+0xdb/0x200 drivers/net/tun.c:2027 +call_write_iter include/linux/fs.h:2191 [inline] +do_iter_readv_writev+0x20b/0x3b0 fs/read_write.c:735 +do_iter_write+0x182/0x700 fs/read_write.c:861 +vfs_writev+0x1aa/0x630 fs/read_write.c:934 +do_writev+0x133/0x2f0 fs/read_write.c:977 +do_syscall_x64 arch/x86/entry/common.c:50 [inline] +do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 +entry_SYSCALL_64_after_hwframe+0x63/0xcd +RIP: 0033:0x7f37021a3c19 + +Fixes: 1118b2049d77 ("net: tun: Fix memory leaks of napi_get_frags") +Reported-by: syzbot +Signed-off-by: Eric Dumazet +Cc: Wang Yufen +Link: https://lore.kernel.org/r/20221107180011.188437-1-edumazet@google.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/tun.c | 19 +++++++++++++------ + 1 file changed, 13 insertions(+), 6 deletions(-) + +--- a/drivers/net/tun.c ++++ b/drivers/net/tun.c +@@ -1949,18 +1949,25 @@ drop: + skb_headlen(skb)); + + if (unlikely(headlen > skb_headlen(skb))) { ++ WARN_ON_ONCE(1); ++ err = -ENOMEM; + atomic_long_inc(&tun->dev->rx_dropped); ++napi_busy: + napi_free_frags(&tfile->napi); + rcu_read_unlock(); + mutex_unlock(&tfile->napi_mutex); +- WARN_ON(1); +- return -ENOMEM; ++ return err; + } + +- local_bh_disable(); +- napi_gro_frags(&tfile->napi); +- napi_complete(&tfile->napi); +- local_bh_enable(); ++ if (likely(napi_schedule_prep(&tfile->napi))) { ++ local_bh_disable(); ++ napi_gro_frags(&tfile->napi); ++ napi_complete(&tfile->napi); ++ local_bh_enable(); ++ } else { ++ err = -EBUSY; ++ goto napi_busy; ++ } + mutex_unlock(&tfile->napi_mutex); + } else if (tfile->napi_enabled) { + struct sk_buff_head *queue = &tfile->sk.sk_write_queue; diff --git a/queue-5.15/series b/queue-5.15/series index 2adc6b9cabe..61664334348 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -126,3 +126,6 @@ dmaengine-at_hdmac-fix-completion-of-unissued-descriptor-in-case-of-errors.patch dmaengine-at_hdmac-don-t-allow-cpu-to-reorder-channel-enable.patch dmaengine-at_hdmac-fix-impossible-condition.patch dmaengine-at_hdmac-check-return-code-of-dma_async_device_register.patch +marvell-octeontx2-build-error-unknown-type-name-u64.patch +drm-amdkfd-migrate-in-cpu-page-fault-use-current-mm.patch +net-tun-call-napi_schedule_prep-to-ensure-we-own-a-napi.patch