]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.10
authorSasha Levin <sashal@kernel.org>
Mon, 11 Aug 2025 04:39:21 +0000 (00:39 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 11 Aug 2025 04:39:21 +0000 (00:39 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 files changed:
queue-5.10/alsa-hda-ca0132-fix-missing-error-handling-in-ca0132.patch [new file with mode: 0644]
queue-5.10/benet-fix-bug-when-creating-vfs.patch [new file with mode: 0644]
queue-5.10/ipv6-reject-malicious-packets-in-ipv6_gso_segment.patch [new file with mode: 0644]
queue-5.10/mm-extract-might_alloc-debug-check.patch [new file with mode: 0644]
queue-5.10/net-drop-ufo-packets-in-udp_rcv_segment.patch [new file with mode: 0644]
queue-5.10/netpoll-prevent-hanging-napi-when-netcons-gets-enabl.patch [new file with mode: 0644]
queue-5.10/nfs-fix-filehandle-bounds-checking-in-nfs_fh_to_dent.patch [new file with mode: 0644]
queue-5.10/nfs-fixup-allocation-flags-for-nfsiod-s-__gfp_noretr.patch [new file with mode: 0644]
queue-5.10/nfsv4.2-another-fix-for-listxattr.patch [new file with mode: 0644]
queue-5.10/phy-mscc-fix-parsing-of-unicast-frames.patch [new file with mode: 0644]
queue-5.10/pnfs-flexfiles-avoid-spurious-layout-returns-in-ff_l.patch [new file with mode: 0644]
queue-5.10/pnfs-flexfiles-don-t-attempt-pnfs-on-fatal-ds-errors.patch [new file with mode: 0644]
queue-5.10/pptp-ensure-minimal-skb-length-in-pptp_xmit.patch [new file with mode: 0644]
queue-5.10/pptp-fix-pptp_xmit-error-path.patch [new file with mode: 0644]
queue-5.10/series
queue-5.10/smb-client-let-recv_done-cleanup-before-notifying-th.patch [new file with mode: 0644]
queue-5.10/xarray-add-calls-to-might_alloc.patch [new file with mode: 0644]

diff --git a/queue-5.10/alsa-hda-ca0132-fix-missing-error-handling-in-ca0132.patch b/queue-5.10/alsa-hda-ca0132-fix-missing-error-handling-in-ca0132.patch
new file mode 100644 (file)
index 0000000..f8cc273
--- /dev/null
@@ -0,0 +1,47 @@
+From 92d19e49060c955b1ffe8aafed2cca78776ef676 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 6 Aug 2025 11:44:22 +0200
+Subject: ALSA: hda/ca0132: Fix missing error handling in
+ ca0132_alt_select_out()
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit 9f320dfb0ffc555aa2eac8331dee0c2c16f67633 ]
+
+There are a couple of cases where the error is ignored or the error
+code isn't propagated in ca0132_alt_select_out().  Fix those.
+
+Fixes: def3f0a5c700 ("ALSA: hda/ca0132 - Add quirk output selection structures.")
+Link: https://patch.msgid.link/20250806094423.8843-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/patch_ca0132.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
+index 6d67cca4cfa6..b9d88b156f40 100644
+--- a/sound/pci/hda/patch_ca0132.c
++++ b/sound/pci/hda/patch_ca0132.c
+@@ -4671,7 +4671,8 @@ static int ca0132_alt_select_out(struct hda_codec *codec)
+       if (err < 0)
+               goto exit;
+-      if (ca0132_alt_select_out_quirk_set(codec) < 0)
++      err = ca0132_alt_select_out_quirk_set(codec);
++      if (err < 0)
+               goto exit;
+       switch (spec->cur_out_type) {
+@@ -4761,6 +4762,8 @@ static int ca0132_alt_select_out(struct hda_codec *codec)
+                               spec->bass_redirection_val);
+       else
+               err = ca0132_alt_surround_set_bass_redirection(codec, 0);
++      if (err < 0)
++              goto exit;
+       /* Unmute DSP now that we're done with output selection. */
+       err = dspio_set_uint_param(codec, 0x96,
+-- 
+2.39.5
+
diff --git a/queue-5.10/benet-fix-bug-when-creating-vfs.patch b/queue-5.10/benet-fix-bug-when-creating-vfs.patch
new file mode 100644 (file)
index 0000000..f89bcc7
--- /dev/null
@@ -0,0 +1,61 @@
+From cd8aa919f960d597412087584dfec129aafc93c6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 1 Aug 2025 12:13:37 +0200
+Subject: benet: fix BUG when creating VFs
+
+From: Michal Schmidt <mschmidt@redhat.com>
+
+[ Upstream commit 5a40f8af2ba1b9bdf46e2db10e8c9710538fbc63 ]
+
+benet crashes as soon as SRIOV VFs are created:
+
+ kernel BUG at mm/vmalloc.c:3457!
+ Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI
+ CPU: 4 UID: 0 PID: 7408 Comm: test.sh Kdump: loaded Not tainted 6.16.0+ #1 PREEMPT(voluntary)
+ [...]
+ RIP: 0010:vunmap+0x5f/0x70
+ [...]
+ Call Trace:
+  <TASK>
+  __iommu_dma_free+0xe8/0x1c0
+  be_cmd_set_mac_list+0x3fe/0x640 [be2net]
+  be_cmd_set_mac+0xaf/0x110 [be2net]
+  be_vf_eth_addr_config+0x19f/0x330 [be2net]
+  be_vf_setup+0x4f7/0x990 [be2net]
+  be_pci_sriov_configure+0x3a1/0x470 [be2net]
+  sriov_numvfs_store+0x20b/0x380
+  kernfs_fop_write_iter+0x354/0x530
+  vfs_write+0x9b9/0xf60
+  ksys_write+0xf3/0x1d0
+  do_syscall_64+0x8c/0x3d0
+
+be_cmd_set_mac_list() calls dma_free_coherent() under a spin_lock_bh.
+Fix it by freeing only after the lock has been released.
+
+Fixes: 1a82d19ca2d6 ("be2net: fix sleeping while atomic bugs in be_ndo_bridge_getlink")
+Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
+Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
+Link: https://patch.msgid.link/20250801101338.72502-1-mschmidt@redhat.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/emulex/benet/be_cmds.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
+index d9bceb26f4e5..d6984c179bae 100644
+--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
++++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
+@@ -3851,8 +3851,8 @@ int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array,
+       status = be_mcc_notify_wait(adapter);
+ err:
+-      dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma);
+       spin_unlock_bh(&adapter->mcc_lock);
++      dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma);
+       return status;
+ }
+-- 
+2.39.5
+
diff --git a/queue-5.10/ipv6-reject-malicious-packets-in-ipv6_gso_segment.patch b/queue-5.10/ipv6-reject-malicious-packets-in-ipv6_gso_segment.patch
new file mode 100644 (file)
index 0000000..4e18f8b
--- /dev/null
@@ -0,0 +1,103 @@
+From d785ca2fee8c97ab8f1dded5dea40cbd050ecd9e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 30 Jul 2025 13:17:38 +0000
+Subject: ipv6: reject malicious packets in ipv6_gso_segment()
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit d45cf1e7d7180256e17c9ce88e32e8061a7887fe ]
+
+syzbot was able to craft a packet with very long IPv6 extension headers
+leading to an overflow of skb->transport_header.
+
+This 16bit field has a limited range.
+
+Add skb_reset_transport_header_careful() helper and use it
+from ipv6_gso_segment()
+
+WARNING: CPU: 0 PID: 5871 at ./include/linux/skbuff.h:3032 skb_reset_transport_header include/linux/skbuff.h:3032 [inline]
+WARNING: CPU: 0 PID: 5871 at ./include/linux/skbuff.h:3032 ipv6_gso_segment+0x15e2/0x21e0 net/ipv6/ip6_offload.c:151
+Modules linked in:
+CPU: 0 UID: 0 PID: 5871 Comm: syz-executor211 Not tainted 6.16.0-rc6-syzkaller-g7abc678e3084 #0 PREEMPT(full)
+Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
+ RIP: 0010:skb_reset_transport_header include/linux/skbuff.h:3032 [inline]
+ RIP: 0010:ipv6_gso_segment+0x15e2/0x21e0 net/ipv6/ip6_offload.c:151
+Call Trace:
+ <TASK>
+  skb_mac_gso_segment+0x31c/0x640 net/core/gso.c:53
+  nsh_gso_segment+0x54a/0xe10 net/nsh/nsh.c:110
+  skb_mac_gso_segment+0x31c/0x640 net/core/gso.c:53
+  __skb_gso_segment+0x342/0x510 net/core/gso.c:124
+  skb_gso_segment include/net/gso.h:83 [inline]
+  validate_xmit_skb+0x857/0x11b0 net/core/dev.c:3950
+  validate_xmit_skb_list+0x84/0x120 net/core/dev.c:4000
+  sch_direct_xmit+0xd3/0x4b0 net/sched/sch_generic.c:329
+  __dev_xmit_skb net/core/dev.c:4102 [inline]
+  __dev_queue_xmit+0x17b6/0x3a70 net/core/dev.c:4679
+
+Fixes: d1da932ed4ec ("ipv6: Separate ipv6 offload support")
+Reported-by: syzbot+af43e647fd835acc02df@syzkaller.appspotmail.com
+Closes: https://lore.kernel.org/netdev/688a1a05.050a0220.5d226.0008.GAE@google.com/T/#u
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Reviewed-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
+Reviewed-by: Willem de Bruijn <willemb@google.com>
+Link: https://patch.msgid.link/20250730131738.3385939-1-edumazet@google.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/skbuff.h | 23 +++++++++++++++++++++++
+ net/ipv6/ip6_offload.c |  4 +++-
+ 2 files changed, 26 insertions(+), 1 deletion(-)
+
+diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
+index 3248e4aeec03..ca7f2a2c3e3f 100644
+--- a/include/linux/skbuff.h
++++ b/include/linux/skbuff.h
+@@ -2519,6 +2519,29 @@ static inline void skb_reset_transport_header(struct sk_buff *skb)
+       skb->transport_header = skb->data - skb->head;
+ }
++/**
++ * skb_reset_transport_header_careful - conditionally reset transport header
++ * @skb: buffer to alter
++ *
++ * Hardened version of skb_reset_transport_header().
++ *
++ * Returns: true if the operation was a success.
++ */
++static inline bool __must_check
++skb_reset_transport_header_careful(struct sk_buff *skb)
++{
++      long offset = skb->data - skb->head;
++
++      if (unlikely(offset != (typeof(skb->transport_header))offset))
++              return false;
++
++      if (unlikely(offset == (typeof(skb->transport_header))~0U))
++              return false;
++
++      skb->transport_header = offset;
++      return true;
++}
++
+ static inline void skb_set_transport_header(struct sk_buff *skb,
+                                           const int offset)
+ {
+diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
+index 673f02ea62aa..c145be2fd6e4 100644
+--- a/net/ipv6/ip6_offload.c
++++ b/net/ipv6/ip6_offload.c
+@@ -111,7 +111,9 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
+       ops = rcu_dereference(inet6_offloads[proto]);
+       if (likely(ops && ops->callbacks.gso_segment)) {
+-              skb_reset_transport_header(skb);
++              if (!skb_reset_transport_header_careful(skb))
++                      goto out;
++
+               segs = ops->callbacks.gso_segment(skb, features);
+               if (!segs)
+                       skb->network_header = skb_mac_header(skb) + nhoff - skb->head;
+-- 
+2.39.5
+
diff --git a/queue-5.10/mm-extract-might_alloc-debug-check.patch b/queue-5.10/mm-extract-might_alloc-debug-check.patch
new file mode 100644 (file)
index 0000000..36d63e0
--- /dev/null
@@ -0,0 +1,145 @@
+From b8911281779ab6c8ce0d126fc04a49b8f7fd1b15 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 14 Dec 2020 19:08:34 -0800
+Subject: mm: extract might_alloc() debug check
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Daniel Vetter <daniel.vetter@ffwll.ch>
+
+[ Upstream commit 95d6c701f4ca7c44dc148d664f604541266a2333 ]
+
+Extracted from slab.h, which seems to have the most complete version
+including the correct might_sleep() check.  Roll it out to slob.c.
+
+Motivated by a discussion with Paul about possibly changing call_rcu
+behaviour to allocate memory, but only roughly every 500th call.
+
+There are a lot fewer places in the kernel that care about whether
+allocating memory is allowed or not (due to deadlocks with reclaim code)
+than places that care whether sleeping is allowed.  But debugging these
+also tends to be a lot harder, so nice descriptive checks could come in
+handy.  I might have some use eventually for annotations in drivers/gpu.
+
+Note that unlike fs_reclaim_acquire/release gfpflags_allow_blocking does
+not consult the PF_MEMALLOC flags.  But there is no flag equivalent for
+GFP_NOWAIT, hence this check can't go wrong due to
+memalloc_no*_save/restore contexts.  Willy is working on a patch series
+which might change this:
+
+https://lore.kernel.org/linux-mm/20200625113122.7540-7-willy@infradead.org/
+
+I think best would be if that updates gfpflags_allow_blocking(), since
+there's a ton of callers all over the place for that already.
+
+Link: https://lkml.kernel.org/r/20201125162532.1299794-3-daniel.vetter@ffwll.ch
+Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
+Acked-by: Vlastimil Babka <vbabka@suse.cz>
+Acked-by: Paul E. McKenney <paulmck@kernel.org>
+Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
+Cc: Randy Dunlap <rdunlap@infradead.org>
+Cc: Paul E. McKenney <paulmck@kernel.org>
+Cc: Christoph Lameter <cl@linux.com>
+Cc: Pekka Enberg <penberg@kernel.org>
+Cc: David Rientjes <rientjes@google.com>
+Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Ingo Molnar <mingo@kernel.org>
+Cc: Vlastimil Babka <vbabka@suse.cz>
+Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Cc: Michel Lespinasse <walken@google.com>
+Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
+Cc: Waiman Long <longman@redhat.com>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: Randy Dunlap <rdunlap@infradead.org>
+Cc: Dave Chinner <david@fromorbit.com>
+Cc: Qian Cai <cai@lca.pw>
+Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
+Cc: Christian König <christian.koenig@amd.com>
+Cc: Ingo Molnar <mingo@redhat.com>
+Cc: Jason Gunthorpe <jgg@mellanox.com>
+Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
+Cc: Thomas Hellström (Intel) <thomas_os@shipmail.org>
+Cc: Will Deacon <will@kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Stable-dep-of: 99765233ab42 ("NFS: Fixup allocation flags for nfsiod's __GFP_NORETRY")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/sched/mm.h | 16 ++++++++++++++++
+ mm/slab.h                |  5 +----
+ mm/slob.c                |  6 ++----
+ 3 files changed, 19 insertions(+), 8 deletions(-)
+
+diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h
+index e3e5e149b00e..a856c4478d8c 100644
+--- a/include/linux/sched/mm.h
++++ b/include/linux/sched/mm.h
+@@ -189,6 +189,22 @@ static inline void fs_reclaim_acquire(gfp_t gfp_mask) { }
+ static inline void fs_reclaim_release(gfp_t gfp_mask) { }
+ #endif
++/**
++ * might_alloc - Mark possible allocation sites
++ * @gfp_mask: gfp_t flags that would be used to allocate
++ *
++ * Similar to might_sleep() and other annotations, this can be used in functions
++ * that might allocate, but often don't. Compiles to nothing without
++ * CONFIG_LOCKDEP. Includes a conditional might_sleep() if @gfp allows blocking.
++ */
++static inline void might_alloc(gfp_t gfp_mask)
++{
++      fs_reclaim_acquire(gfp_mask);
++      fs_reclaim_release(gfp_mask);
++
++      might_sleep_if(gfpflags_allow_blocking(gfp_mask));
++}
++
+ /**
+  * memalloc_noio_save - Marks implicit GFP_NOIO allocation scope.
+  *
+diff --git a/mm/slab.h b/mm/slab.h
+index 6952e10cf33b..4b70cf4493e6 100644
+--- a/mm/slab.h
++++ b/mm/slab.h
+@@ -507,10 +507,7 @@ static inline struct kmem_cache *slab_pre_alloc_hook(struct kmem_cache *s,
+ {
+       flags &= gfp_allowed_mask;
+-      fs_reclaim_acquire(flags);
+-      fs_reclaim_release(flags);
+-
+-      might_sleep_if(gfpflags_allow_blocking(flags));
++      might_alloc(flags);
+       if (should_failslab(s, flags))
+               return NULL;
+diff --git a/mm/slob.c b/mm/slob.c
+index 7cc9805c8091..8d4bfa46247f 100644
+--- a/mm/slob.c
++++ b/mm/slob.c
+@@ -474,8 +474,7 @@ __do_kmalloc_node(size_t size, gfp_t gfp, int node, unsigned long caller)
+       gfp &= gfp_allowed_mask;
+-      fs_reclaim_acquire(gfp);
+-      fs_reclaim_release(gfp);
++      might_alloc(gfp);
+       if (size < PAGE_SIZE - minalign) {
+               int align = minalign;
+@@ -597,8 +596,7 @@ static void *slob_alloc_node(struct kmem_cache *c, gfp_t flags, int node)
+       flags &= gfp_allowed_mask;
+-      fs_reclaim_acquire(flags);
+-      fs_reclaim_release(flags);
++      might_alloc(flags);
+       if (c->size < PAGE_SIZE) {
+               b = slob_alloc(c->size, flags, c->align, node, 0);
+-- 
+2.39.5
+
diff --git a/queue-5.10/net-drop-ufo-packets-in-udp_rcv_segment.patch b/queue-5.10/net-drop-ufo-packets-in-udp_rcv_segment.patch
new file mode 100644 (file)
index 0000000..45ac3a1
--- /dev/null
@@ -0,0 +1,122 @@
+From f965279d8fa1cccb9b8f4a13f43551450ad6c1f7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 30 Jul 2025 18:14:58 +0800
+Subject: net: drop UFO packets in udp_rcv_segment()
+
+From: Wang Liang <wangliang74@huawei.com>
+
+[ Upstream commit d46e51f1c78b9ab9323610feb14238d06d46d519 ]
+
+When sending a packet with virtio_net_hdr to tun device, if the gso_type
+in virtio_net_hdr is SKB_GSO_UDP and the gso_size is less than udphdr
+size, below crash may happen.
+
+  ------------[ cut here ]------------
+  kernel BUG at net/core/skbuff.c:4572!
+  Oops: invalid opcode: 0000 [#1] SMP NOPTI
+  CPU: 0 UID: 0 PID: 62 Comm: mytest Not tainted 6.16.0-rc7 #203 PREEMPT(voluntary)
+  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
+  RIP: 0010:skb_pull_rcsum+0x8e/0xa0
+  Code: 00 00 5b c3 cc cc cc cc 8b 93 88 00 00 00 f7 da e8 37 44 38 00 f7 d8 89 83 88 00 00 00 48 8b 83 c8 00 00 00 5b c3 cc cc cc cc <0f> 0b 0f 0b 66 66 2e 0f 1f 84 00 000
+  RSP: 0018:ffffc900001fba38 EFLAGS: 00000297
+  RAX: 0000000000000004 RBX: ffff8880040c1000 RCX: ffffc900001fb948
+  RDX: ffff888003e6d700 RSI: 0000000000000008 RDI: ffff88800411a062
+  RBP: ffff8880040c1000 R08: 0000000000000000 R09: 0000000000000001
+  R10: ffff888003606c00 R11: 0000000000000001 R12: 0000000000000000
+  R13: ffff888004060900 R14: ffff888004050000 R15: ffff888004060900
+  FS:  000000002406d3c0(0000) GS:ffff888084a19000(0000) knlGS:0000000000000000
+  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+  CR2: 0000000020000040 CR3: 0000000004007000 CR4: 00000000000006f0
+  Call Trace:
+   <TASK>
+   udp_queue_rcv_one_skb+0x176/0x4b0 net/ipv4/udp.c:2445
+   udp_queue_rcv_skb+0x155/0x1f0 net/ipv4/udp.c:2475
+   udp_unicast_rcv_skb+0x71/0x90 net/ipv4/udp.c:2626
+   __udp4_lib_rcv+0x433/0xb00 net/ipv4/udp.c:2690
+   ip_protocol_deliver_rcu+0xa6/0x160 net/ipv4/ip_input.c:205
+   ip_local_deliver_finish+0x72/0x90 net/ipv4/ip_input.c:233
+   ip_sublist_rcv_finish+0x5f/0x70 net/ipv4/ip_input.c:579
+   ip_sublist_rcv+0x122/0x1b0 net/ipv4/ip_input.c:636
+   ip_list_rcv+0xf7/0x130 net/ipv4/ip_input.c:670
+   __netif_receive_skb_list_core+0x21d/0x240 net/core/dev.c:6067
+   netif_receive_skb_list_internal+0x186/0x2b0 net/core/dev.c:6210
+   napi_complete_done+0x78/0x180 net/core/dev.c:6580
+   tun_get_user+0xa63/0x1120 drivers/net/tun.c:1909
+   tun_chr_write_iter+0x65/0xb0 drivers/net/tun.c:1984
+   vfs_write+0x300/0x420 fs/read_write.c:593
+   ksys_write+0x60/0xd0 fs/read_write.c:686
+   do_syscall_64+0x50/0x1c0 arch/x86/entry/syscall_64.c:63
+   </TASK>
+
+To trigger gso segment in udp_queue_rcv_skb(), we should also set option
+UDP_ENCAP_ESPINUDP to enable udp_sk(sk)->encap_rcv. When the encap_rcv
+hook return 1 in udp_queue_rcv_one_skb(), udp_csum_pull_header() will try
+to pull udphdr, but the skb size has been segmented to gso size, which
+leads to this crash.
+
+Previous commit cf329aa42b66 ("udp: cope with UDP GRO packet misdirection")
+introduces segmentation in UDP receive path only for GRO, which was never
+intended to be used for UFO, so drop UFO packets in udp_rcv_segment().
+
+Link: https://lore.kernel.org/netdev/20250724083005.3918375-1-wangliang74@huawei.com/
+Link: https://lore.kernel.org/netdev/20250729123907.3318425-1-wangliang74@huawei.com/
+Fixes: cf329aa42b66 ("udp: cope with UDP GRO packet misdirection")
+Suggested-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
+Signed-off-by: Wang Liang <wangliang74@huawei.com>
+Reviewed-by: Willem de Bruijn <willemb@google.com>
+Link: https://patch.msgid.link/20250730101458.3470788-1-wangliang74@huawei.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/net/udp.h | 24 ++++++++++++++++++------
+ 1 file changed, 18 insertions(+), 6 deletions(-)
+
+diff --git a/include/net/udp.h b/include/net/udp.h
+index db599b15b630..5e5e8c7c6777 100644
+--- a/include/net/udp.h
++++ b/include/net/udp.h
+@@ -479,6 +479,16 @@ static inline struct sk_buff *udp_rcv_segment(struct sock *sk,
+ {
+       netdev_features_t features = NETIF_F_SG;
+       struct sk_buff *segs;
++      int drop_count;
++
++      /*
++       * Segmentation in UDP receive path is only for UDP GRO, drop udp
++       * fragmentation offload (UFO) packets.
++       */
++      if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP) {
++              drop_count = 1;
++              goto drop;
++      }
+       /* Avoid csum recalculation by skb_segment unless userspace explicitly
+        * asks for the final checksum values
+@@ -502,16 +512,18 @@ static inline struct sk_buff *udp_rcv_segment(struct sock *sk,
+        */
+       segs = __skb_gso_segment(skb, features, false);
+       if (IS_ERR_OR_NULL(segs)) {
+-              int segs_nr = skb_shinfo(skb)->gso_segs;
+-
+-              atomic_add(segs_nr, &sk->sk_drops);
+-              SNMP_ADD_STATS(__UDPX_MIB(sk, ipv4), UDP_MIB_INERRORS, segs_nr);
+-              kfree_skb(skb);
+-              return NULL;
++              drop_count = skb_shinfo(skb)->gso_segs;
++              goto drop;
+       }
+       consume_skb(skb);
+       return segs;
++
++drop:
++      atomic_add(drop_count, &sk->sk_drops);
++      SNMP_ADD_STATS(__UDPX_MIB(sk, ipv4), UDP_MIB_INERRORS, drop_count);
++      kfree_skb(skb);
++      return NULL;
+ }
+ #ifdef CONFIG_BPF_SYSCALL
+-- 
+2.39.5
+
diff --git a/queue-5.10/netpoll-prevent-hanging-napi-when-netcons-gets-enabl.patch b/queue-5.10/netpoll-prevent-hanging-napi-when-netcons-gets-enabl.patch
new file mode 100644 (file)
index 0000000..aad25b7
--- /dev/null
@@ -0,0 +1,95 @@
+From d79a1c13d88ec841ea5045c640d0ac5c63999dbe Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 25 Jul 2025 18:08:46 -0700
+Subject: netpoll: prevent hanging NAPI when netcons gets enabled
+
+From: Jakub Kicinski <kuba@kernel.org>
+
+[ Upstream commit 2da4def0f487f24bbb0cece3bb2bcdcb918a0b72 ]
+
+Paolo spotted hangs in NIPA running driver tests against virtio.
+The tests hang in virtnet_close() -> virtnet_napi_tx_disable().
+
+The problem is only reproducible if running multiple of our tests
+in sequence (I used TEST_PROGS="xdp.py ping.py netcons_basic.sh \
+netpoll_basic.py stats.py"). Initial suspicion was that this is
+a simple case of double-disable of NAPI, but instrumenting the
+code reveals:
+
+ Deadlocked on NAPI ffff888007cd82c0 (virtnet_poll_tx):
+   state: 0x37, disabled: false, owner: 0, listed: false, weight: 64
+
+The NAPI was not in fact disabled, owner is 0 (rather than -1),
+so the NAPI "thinks" it's scheduled for CPU 0 but it's not listed
+(!list_empty(&n->poll_list) => false). It seems odd that normal NAPI
+processing would wedge itself like this.
+
+Better suspicion is that netpoll gets enabled while NAPI is polling,
+and also grabs the NAPI instance. This confuses napi_complete_done():
+
+  [netpoll]                                   [normal NAPI]
+                                        napi_poll()
+                                          have = netpoll_poll_lock()
+                                            rcu_access_pointer(dev->npinfo)
+                                              return NULL # no netpoll
+                                          __napi_poll()
+                                           ->poll(->weight)
+  poll_napi()
+    cmpxchg(->poll_owner, -1, cpu)
+      poll_one_napi()
+        set_bit(NAPI_STATE_NPSVC, ->state)
+                                              napi_complete_done()
+                                                if (NAPIF_STATE_NPSVC)
+                                                  return false
+                                           # exit without clearing SCHED
+
+This feels very unlikely, but perhaps virtio has some interactions
+with the hypervisor in the NAPI ->poll that makes the race window
+larger?
+
+Best I could to to prove the theory was to add and trigger this
+warning in napi_poll (just before netpoll_poll_unlock()):
+
+      WARN_ONCE(!have && rcu_access_pointer(n->dev->npinfo) &&
+                napi_is_scheduled(n) && list_empty(&n->poll_list),
+                "NAPI race with netpoll %px", n);
+
+If this warning hits the next virtio_close() will hang.
+
+This patch survived 30 test iterations without a hang (without it
+the longest clean run was around 10). Credit for triggering this
+goes to Breno's recent netconsole tests.
+
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Reported-by: Paolo Abeni <pabeni@redhat.com>
+Link: https://lore.kernel.org/c5a93ed1-9abe-4880-a3bb-8d1678018b1d@redhat.com
+Acked-by: Jason Wang <jasowang@redhat.com>
+Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
+Link: https://patch.msgid.link/20250726010846.1105875-1-kuba@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/core/netpoll.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/net/core/netpoll.c b/net/core/netpoll.c
+index 66a6f6241239..db18154aa238 100644
+--- a/net/core/netpoll.c
++++ b/net/core/netpoll.c
+@@ -812,6 +812,13 @@ int netpoll_setup(struct netpoll *np)
+               goto put;
+       rtnl_unlock();
++
++      /* Make sure all NAPI polls which started before dev->npinfo
++       * was visible have exited before we start calling NAPI poll.
++       * NAPI skips locking if dev->npinfo is NULL.
++       */
++      synchronize_rcu();
++
+       return 0;
+ put:
+-- 
+2.39.5
+
diff --git a/queue-5.10/nfs-fix-filehandle-bounds-checking-in-nfs_fh_to_dent.patch b/queue-5.10/nfs-fix-filehandle-bounds-checking-in-nfs_fh_to_dent.patch
new file mode 100644 (file)
index 0000000..56a5b87
--- /dev/null
@@ -0,0 +1,51 @@
+From 0c516fc0b4a3920388db71ba4be73839ed3a8385 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 22 Jul 2025 09:24:58 -0400
+Subject: NFS: Fix filehandle bounds checking in nfs_fh_to_dentry()
+
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+
+[ Upstream commit ef93a685e01a281b5e2a25ce4e3428cf9371a205 ]
+
+The function needs to check the minimal filehandle length before it can
+access the embedded filehandle.
+
+Reported-by: zhangjian <zhangjian496@huawei.com>
+Fixes: 20fa19027286 ("nfs: add export operations")
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/export.c | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/fs/nfs/export.c b/fs/nfs/export.c
+index 993be63ab301..784d0f1cfb93 100644
+--- a/fs/nfs/export.c
++++ b/fs/nfs/export.c
+@@ -67,14 +67,21 @@ nfs_fh_to_dentry(struct super_block *sb, struct fid *fid,
+       struct nfs4_label *label = NULL;
+       struct nfs_fattr *fattr = NULL;
+       struct nfs_fh *server_fh = nfs_exp_embedfh(fid->raw);
+-      size_t fh_size = offsetof(struct nfs_fh, data) + server_fh->size;
++      size_t fh_size = offsetof(struct nfs_fh, data);
+       const struct nfs_rpc_ops *rpc_ops;
+       struct dentry *dentry;
+       struct inode *inode;
+-      int len = EMBED_FH_OFF + XDR_QUADLEN(fh_size);
++      int len = EMBED_FH_OFF;
+       u32 *p = fid->raw;
+       int ret;
++      /* Initial check of bounds */
++      if (fh_len < len + XDR_QUADLEN(fh_size) ||
++          fh_len > XDR_QUADLEN(NFS_MAXFHSIZE))
++              return NULL;
++      /* Calculate embedded filehandle size */
++      fh_size += server_fh->size;
++      len += XDR_QUADLEN(fh_size);
+       /* NULL translates to ESTALE */
+       if (fh_len < len || fh_type != len)
+               return NULL;
+-- 
+2.39.5
+
diff --git a/queue-5.10/nfs-fixup-allocation-flags-for-nfsiod-s-__gfp_noretr.patch b/queue-5.10/nfs-fixup-allocation-flags-for-nfsiod-s-__gfp_noretr.patch
new file mode 100644 (file)
index 0000000..9498ff9
--- /dev/null
@@ -0,0 +1,55 @@
+From ec7534197c43663fe0592630d2a07f2730990ca6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 9 Jul 2025 21:47:43 -0400
+Subject: NFS: Fixup allocation flags for nfsiod's __GFP_NORETRY
+
+From: Benjamin Coddington <bcodding@redhat.com>
+
+[ Upstream commit 99765233ab42bf7a4950377ad7894dce8a5c0e60 ]
+
+If the NFS client is doing writeback from a workqueue context, avoid using
+__GFP_NORETRY for allocations if the task has set PF_MEMALLOC_NOIO or
+PF_MEMALLOC_NOFS.  The combination of these flags makes memory allocation
+failures much more likely.
+
+We've seen those allocation failures show up when the loopback driver is
+doing writeback from a workqueue to a file on NFS, where memory allocation
+failure results in errors or corruption within the loopback device's
+filesystem.
+
+Suggested-by: Trond Myklebust <trondmy@kernel.org>
+Fixes: 0bae835b63c5 ("NFS: Avoid writeback threads getting stuck in mempool_alloc()")
+Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
+Reviewed-by: Laurence Oberman <loberman@redhat.com>
+Tested-by: Laurence Oberman <loberman@redhat.com>
+Reviewed-by: Jeff Layton <jlayton@kernel.org>
+Link: https://lore.kernel.org/r/f83ac1155a4bc670f2663959a7a068571e06afd9.1752111622.git.bcodding@redhat.com
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/internal.h | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
+index 2fdc7c2a17fe..8af263a30fc0 100644
+--- a/fs/nfs/internal.h
++++ b/fs/nfs/internal.h
+@@ -588,9 +588,12 @@ nfs_write_match_verf(const struct nfs_writeverf *verf,
+ static inline gfp_t nfs_io_gfp_mask(void)
+ {
+-      if (current->flags & PF_WQ_WORKER)
+-              return GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN;
+-      return GFP_KERNEL;
++      gfp_t ret = current_gfp_context(GFP_KERNEL);
++
++      /* For workers __GFP_NORETRY only with __GFP_IO or __GFP_FS */
++      if ((current->flags & PF_WQ_WORKER) && ret == GFP_KERNEL)
++              ret |= __GFP_NORETRY | __GFP_NOWARN;
++      return ret;
+ }
+ /* unlink.c */
+-- 
+2.39.5
+
diff --git a/queue-5.10/nfsv4.2-another-fix-for-listxattr.patch b/queue-5.10/nfsv4.2-another-fix-for-listxattr.patch
new file mode 100644 (file)
index 0000000..063b4f5
--- /dev/null
@@ -0,0 +1,53 @@
+From 28186800ac24083f4844f29b5f052e758d122fd1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 22 Jul 2025 16:56:41 -0400
+Subject: NFSv4.2: another fix for listxattr
+
+From: Olga Kornievskaia <okorniev@redhat.com>
+
+[ Upstream commit 9acb237deff7667b0f6b10fe6b1b70c4429ea049 ]
+
+Currently, when the server supports NFS4.1 security labels then
+security.selinux label in included twice. Instead, only add it
+when the server doesn't possess security label support.
+
+Fixes: 243fea134633 ("NFSv4.2: fix listxattr to return selinux security label")
+Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
+Link: https://lore.kernel.org/r/20250722205641.79394-1-okorniev@redhat.com
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/nfs4proc.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
+index 77cc1c4219e1..97b5ff9c5c3e 100644
+--- a/fs/nfs/nfs4proc.c
++++ b/fs/nfs/nfs4proc.c
+@@ -10378,7 +10378,7 @@ const struct nfs4_minor_version_ops *nfs_v4_minor_ops[] = {
+ static ssize_t nfs4_listxattr(struct dentry *dentry, char *list, size_t size)
+ {
+-      ssize_t error, error2, error3, error4;
++      ssize_t error, error2, error3, error4 = 0;
+       size_t left = size;
+       error = generic_listxattr(dentry, list, left);
+@@ -10406,9 +10406,11 @@ static ssize_t nfs4_listxattr(struct dentry *dentry, char *list, size_t size)
+               left -= error3;
+       }
+-      error4 = security_inode_listsecurity(d_inode(dentry), list, left);
+-      if (error4 < 0)
+-              return error4;
++      if (!nfs_server_capable(d_inode(dentry), NFS_CAP_SECURITY_LABEL)) {
++              error4 = security_inode_listsecurity(d_inode(dentry), list, left);
++              if (error4 < 0)
++                      return error4;
++      }
+       error += error2 + error3 + error4;
+       if (size && error > size)
+-- 
+2.39.5
+
diff --git a/queue-5.10/phy-mscc-fix-parsing-of-unicast-frames.patch b/queue-5.10/phy-mscc-fix-parsing-of-unicast-frames.patch
new file mode 100644 (file)
index 0000000..f08e9d9
--- /dev/null
@@ -0,0 +1,53 @@
+From 9b5a341c7501dd2009b18e932fdf304463706821 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 26 Jul 2025 16:03:07 +0200
+Subject: phy: mscc: Fix parsing of unicast frames
+
+From: Horatiu Vultur <horatiu.vultur@microchip.com>
+
+[ Upstream commit 6fb5ff63b35b7e849cc8510957f25753f87f63d2 ]
+
+According to the 1588 standard, it is possible to use both unicast and
+multicast frames to send the PTP information. It was noticed that if the
+frames were unicast they were not processed by the analyzer meaning that
+they were not timestamped. Therefore fix this to match also these
+unicast frames.
+
+Fixes: ab2bf9339357 ("net: phy: mscc: 1588 block initialization")
+Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Link: https://patch.msgid.link/20250726140307.3039694-1-horatiu.vultur@microchip.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/phy/mscc/mscc_ptp.c | 1 +
+ drivers/net/phy/mscc/mscc_ptp.h | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/drivers/net/phy/mscc/mscc_ptp.c b/drivers/net/phy/mscc/mscc_ptp.c
+index 85102e895665..4a00b82d3ca5 100644
+--- a/drivers/net/phy/mscc/mscc_ptp.c
++++ b/drivers/net/phy/mscc/mscc_ptp.c
+@@ -897,6 +897,7 @@ static int vsc85xx_eth1_conf(struct phy_device *phydev, enum ts_blk blk,
+                                    get_unaligned_be32(ptp_multicast));
+       } else {
+               val |= ANA_ETH1_FLOW_ADDR_MATCH2_ANY_MULTICAST;
++              val |= ANA_ETH1_FLOW_ADDR_MATCH2_ANY_UNICAST;
+               vsc85xx_ts_write_csr(phydev, blk,
+                                    MSCC_ANA_ETH1_FLOW_ADDR_MATCH2(0), val);
+               vsc85xx_ts_write_csr(phydev, blk,
+diff --git a/drivers/net/phy/mscc/mscc_ptp.h b/drivers/net/phy/mscc/mscc_ptp.h
+index 3ea163af0f4f..7e3809e4aa5f 100644
+--- a/drivers/net/phy/mscc/mscc_ptp.h
++++ b/drivers/net/phy/mscc/mscc_ptp.h
+@@ -98,6 +98,7 @@
+ #define MSCC_ANA_ETH1_FLOW_ADDR_MATCH2(x) (MSCC_ANA_ETH1_FLOW_ENA(x) + 3)
+ #define ANA_ETH1_FLOW_ADDR_MATCH2_MASK_MASK   GENMASK(22, 20)
+ #define ANA_ETH1_FLOW_ADDR_MATCH2_ANY_MULTICAST       0x400000
++#define ANA_ETH1_FLOW_ADDR_MATCH2_ANY_UNICAST 0x200000
+ #define ANA_ETH1_FLOW_ADDR_MATCH2_FULL_ADDR   0x100000
+ #define ANA_ETH1_FLOW_ADDR_MATCH2_SRC_DEST_MASK       GENMASK(17, 16)
+ #define ANA_ETH1_FLOW_ADDR_MATCH2_SRC_DEST    0x020000
+-- 
+2.39.5
+
diff --git a/queue-5.10/pnfs-flexfiles-avoid-spurious-layout-returns-in-ff_l.patch b/queue-5.10/pnfs-flexfiles-avoid-spurious-layout-returns-in-ff_l.patch
new file mode 100644 (file)
index 0000000..431f428
--- /dev/null
@@ -0,0 +1,46 @@
+From 3f5b94c84ac53f5a3be2c00ccd77f37adc1a911a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 16 Dec 2020 14:01:07 -0500
+Subject: pNFS/flexfiles: Avoid spurious layout returns in
+ ff_layout_choose_ds_for_read
+
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+
+[ Upstream commit 9bfffea3524b49d0268d01f8e7967f06c4d0a942 ]
+
+The callers of ff_layout_choose_ds_for_read() should decide whether or
+not they want to return the layout on error. Sometimes, we may just want
+to retry from the beginning.
+
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Stable-dep-of: f06bedfa62d5 ("pNFS/flexfiles: don't attempt pnfs on fatal DS errors")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/flexfilelayout/flexfilelayout.c | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
+index f8962eaec87b..a053dd05057f 100644
+--- a/fs/nfs/flexfilelayout/flexfilelayout.c
++++ b/fs/nfs/flexfilelayout/flexfilelayout.c
+@@ -740,16 +740,12 @@ ff_layout_choose_ds_for_read(struct pnfs_layout_segment *lseg,
+       struct nfs4_ff_layout_segment *fls = FF_LAYOUT_LSEG(lseg);
+       struct nfs4_ff_layout_mirror *mirror;
+       struct nfs4_pnfs_ds *ds;
+-      bool fail_return = false;
+       u32 idx;
+       /* mirrors are initially sorted by efficiency */
+       for (idx = start_idx; idx < fls->mirror_array_cnt; idx++) {
+-              if (idx+1 == fls->mirror_array_cnt)
+-                      fail_return = !check_device;
+-
+               mirror = FF_LAYOUT_COMP(lseg, idx);
+-              ds = nfs4_ff_layout_prepare_ds(lseg, mirror, fail_return);
++              ds = nfs4_ff_layout_prepare_ds(lseg, mirror, false);
+               if (!ds)
+                       continue;
+-- 
+2.39.5
+
diff --git a/queue-5.10/pnfs-flexfiles-don-t-attempt-pnfs-on-fatal-ds-errors.patch b/queue-5.10/pnfs-flexfiles-don-t-attempt-pnfs-on-fatal-ds-errors.patch
new file mode 100644 (file)
index 0000000..472d34b
--- /dev/null
@@ -0,0 +1,176 @@
+From 65ce8df5dee98823a62d5ecdbd9e8adfc0b0580f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 27 Jun 2025 09:17:51 +0200
+Subject: pNFS/flexfiles: don't attempt pnfs on fatal DS errors
+
+From: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
+
+[ Upstream commit f06bedfa62d57f7b67d44aacd6badad2e13a803f ]
+
+When an applications get killed (SIGTERM/SIGINT) while pNFS client performs a connection
+to DS, client ends in an infinite loop of connect-disconnect. This
+source of the issue, it that flexfilelayoutdev#nfs4_ff_layout_prepare_ds gets an error
+on nfs4_pnfs_ds_connect with status ERESTARTSYS, which is set by rpc_signal_task, but
+the error is treated as transient, thus retried.
+
+The issue is reproducible with Ctrl+C the following script(there should be ~1000 files in
+a directory, client should must not have any connections to DSes):
+
+```
+echo 3 > /proc/sys/vm/drop_caches
+
+for i in *
+do
+   head -1 $i
+done
+```
+
+The change aims to propagate the nfs4_ff_layout_prepare_ds error state
+to the caller that can decide whatever this is a retryable error or not.
+
+Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
+Link: https://lore.kernel.org/r/20250627071751.189663-1-tigran.mkrtchyan@desy.de
+Fixes: 260f32adb88d ("pNFS/flexfiles: Check the result of nfs4_pnfs_ds_connect")
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/flexfilelayout/flexfilelayout.c    | 26 ++++++++++++++---------
+ fs/nfs/flexfilelayout/flexfilelayoutdev.c |  6 +++---
+ 2 files changed, 19 insertions(+), 13 deletions(-)
+
+diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
+index a053dd05057f..57150b27c0fd 100644
+--- a/fs/nfs/flexfilelayout/flexfilelayout.c
++++ b/fs/nfs/flexfilelayout/flexfilelayout.c
+@@ -739,14 +739,14 @@ ff_layout_choose_ds_for_read(struct pnfs_layout_segment *lseg,
+ {
+       struct nfs4_ff_layout_segment *fls = FF_LAYOUT_LSEG(lseg);
+       struct nfs4_ff_layout_mirror *mirror;
+-      struct nfs4_pnfs_ds *ds;
++      struct nfs4_pnfs_ds *ds = ERR_PTR(-EAGAIN);
+       u32 idx;
+       /* mirrors are initially sorted by efficiency */
+       for (idx = start_idx; idx < fls->mirror_array_cnt; idx++) {
+               mirror = FF_LAYOUT_COMP(lseg, idx);
+               ds = nfs4_ff_layout_prepare_ds(lseg, mirror, false);
+-              if (!ds)
++              if (IS_ERR(ds))
+                       continue;
+               if (check_device &&
+@@ -754,10 +754,10 @@ ff_layout_choose_ds_for_read(struct pnfs_layout_segment *lseg,
+                       continue;
+               *best_idx = idx;
+-              return ds;
++              break;
+       }
+-      return NULL;
++      return ds;
+ }
+ static struct nfs4_pnfs_ds *
+@@ -933,7 +933,7 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
+       for (i = 0; i < pgio->pg_mirror_count; i++) {
+               mirror = FF_LAYOUT_COMP(pgio->pg_lseg, i);
+               ds = nfs4_ff_layout_prepare_ds(pgio->pg_lseg, mirror, true);
+-              if (!ds) {
++              if (IS_ERR(ds)) {
+                       if (!ff_layout_no_fallback_to_mds(pgio->pg_lseg))
+                               goto out_mds;
+                       pnfs_generic_pg_cleanup(pgio);
+@@ -1820,6 +1820,7 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr)
+       u32 idx = hdr->pgio_mirror_idx;
+       int vers;
+       struct nfs_fh *fh;
++      bool ds_fatal_error = false;
+       dprintk("--> %s ino %lu pgbase %u req %zu@%llu\n",
+               __func__, hdr->inode->i_ino,
+@@ -1827,8 +1828,10 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr)
+       mirror = FF_LAYOUT_COMP(lseg, idx);
+       ds = nfs4_ff_layout_prepare_ds(lseg, mirror, false);
+-      if (!ds)
++      if (IS_ERR(ds)) {
++              ds_fatal_error = nfs_error_is_fatal(PTR_ERR(ds));
+               goto out_failed;
++      }
+       ds_clnt = nfs4_ff_find_or_create_ds_client(mirror, ds->ds_clp,
+                                                  hdr->inode);
+@@ -1869,7 +1872,7 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr)
+       return PNFS_ATTEMPTED;
+ out_failed:
+-      if (ff_layout_avoid_mds_available_ds(lseg))
++      if (ff_layout_avoid_mds_available_ds(lseg) && !ds_fatal_error)
+               return PNFS_TRY_AGAIN;
+       trace_pnfs_mds_fallback_read_pagelist(hdr->inode,
+                       hdr->args.offset, hdr->args.count,
+@@ -1890,11 +1893,14 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync)
+       int vers;
+       struct nfs_fh *fh;
+       u32 idx = hdr->pgio_mirror_idx;
++      bool ds_fatal_error = false;
+       mirror = FF_LAYOUT_COMP(lseg, idx);
+       ds = nfs4_ff_layout_prepare_ds(lseg, mirror, true);
+-      if (!ds)
++      if (IS_ERR(ds)) {
++              ds_fatal_error = nfs_error_is_fatal(PTR_ERR(ds));
+               goto out_failed;
++      }
+       ds_clnt = nfs4_ff_find_or_create_ds_client(mirror, ds->ds_clp,
+                                                  hdr->inode);
+@@ -1937,7 +1943,7 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync)
+       return PNFS_ATTEMPTED;
+ out_failed:
+-      if (ff_layout_avoid_mds_available_ds(lseg))
++      if (ff_layout_avoid_mds_available_ds(lseg) && !ds_fatal_error)
+               return PNFS_TRY_AGAIN;
+       trace_pnfs_mds_fallback_write_pagelist(hdr->inode,
+                       hdr->args.offset, hdr->args.count,
+@@ -1979,7 +1985,7 @@ static int ff_layout_initiate_commit(struct nfs_commit_data *data, int how)
+       idx = calc_ds_index_from_commit(lseg, data->ds_commit_index);
+       mirror = FF_LAYOUT_COMP(lseg, idx);
+       ds = nfs4_ff_layout_prepare_ds(lseg, mirror, true);
+-      if (!ds)
++      if (IS_ERR(ds))
+               goto out_err;
+       ds_clnt = nfs4_ff_find_or_create_ds_client(mirror, ds->ds_clp,
+diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
+index 4b0cdddce6eb..11777d33a85e 100644
+--- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
++++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
+@@ -368,11 +368,11 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg,
+                         struct nfs4_ff_layout_mirror *mirror,
+                         bool fail_return)
+ {
+-      struct nfs4_pnfs_ds *ds = NULL;
++      struct nfs4_pnfs_ds *ds;
+       struct inode *ino = lseg->pls_layout->plh_inode;
+       struct nfs_server *s = NFS_SERVER(ino);
+       unsigned int max_payload;
+-      int status;
++      int status = -EAGAIN;
+       if (!ff_layout_init_mirror_ds(lseg->pls_layout, mirror))
+               goto noconnect;
+@@ -410,7 +410,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg,
+       ff_layout_send_layouterror(lseg);
+       if (fail_return || !ff_layout_has_available_ds(lseg))
+               pnfs_error_mark_layout_for_return(ino, lseg);
+-      ds = NULL;
++      ds = ERR_PTR(status);
+ out:
+       return ds;
+ }
+-- 
+2.39.5
+
diff --git a/queue-5.10/pptp-ensure-minimal-skb-length-in-pptp_xmit.patch b/queue-5.10/pptp-ensure-minimal-skb-length-in-pptp_xmit.patch
new file mode 100644 (file)
index 0000000..89e683d
--- /dev/null
@@ -0,0 +1,92 @@
+From 5b4400286e3bac9705d7a2372d03497fd39be708 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 29 Jul 2025 08:02:07 +0000
+Subject: pptp: ensure minimal skb length in pptp_xmit()
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit de9c4861fb42f0cd72da844c3c34f692d5895b7b ]
+
+Commit aabc6596ffb3 ("net: ppp: Add bound checking for skb data
+on ppp_sync_txmung") fixed ppp_sync_txmunge()
+
+We need a similar fix in pptp_xmit(), otherwise we might
+read uninit data as reported by syzbot.
+
+BUG: KMSAN: uninit-value in pptp_xmit+0xc34/0x2720 drivers/net/ppp/pptp.c:193
+  pptp_xmit+0xc34/0x2720 drivers/net/ppp/pptp.c:193
+  ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2290 [inline]
+  ppp_input+0x1d6/0xe60 drivers/net/ppp/ppp_generic.c:2314
+  pppoe_rcv_core+0x1e8/0x760 drivers/net/ppp/pppoe.c:379
+  sk_backlog_rcv+0x142/0x420 include/net/sock.h:1148
+  __release_sock+0x1d3/0x330 net/core/sock.c:3213
+  release_sock+0x6b/0x270 net/core/sock.c:3767
+  pppoe_sendmsg+0x15d/0xcb0 drivers/net/ppp/pppoe.c:904
+  sock_sendmsg_nosec net/socket.c:712 [inline]
+  __sock_sendmsg+0x330/0x3d0 net/socket.c:727
+  ____sys_sendmsg+0x893/0xd80 net/socket.c:2566
+  ___sys_sendmsg+0x271/0x3b0 net/socket.c:2620
+  __sys_sendmmsg+0x2d9/0x7c0 net/socket.c:2709
+
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Reported-by: syzbot+afad90ffc8645324afe5@syzkaller.appspotmail.com
+Closes: https://lore.kernel.org/netdev/68887d86.a00a0220.b12ec.00cd.GAE@google.com/T/#u
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Reviewed-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
+Link: https://patch.msgid.link/20250729080207.1863408-1-edumazet@google.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ppp/pptp.c | 15 +++++++++------
+ 1 file changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c
+index 05a75b5a8b68..1b306562f916 100644
+--- a/drivers/net/ppp/pptp.c
++++ b/drivers/net/ppp/pptp.c
+@@ -159,9 +159,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
+       int len;
+       unsigned char *data;
+       __u32 seq_recv;
+-
+-
+-      struct rtable *rt;
++      struct rtable *rt = NULL;
+       struct net_device *tdev;
+       struct iphdr  *iph;
+       int    max_headroom;
+@@ -179,16 +177,20 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
+       if (skb_headroom(skb) < max_headroom || skb_cloned(skb) || skb_shared(skb)) {
+               struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom);
+-              if (!new_skb) {
+-                      ip_rt_put(rt);
++
++              if (!new_skb)
+                       goto tx_error;
+-              }
++
+               if (skb->sk)
+                       skb_set_owner_w(new_skb, skb->sk);
+               consume_skb(skb);
+               skb = new_skb;
+       }
++      /* Ensure we can safely access protocol field and LCP code */
++      if (!pskb_may_pull(skb, 3))
++              goto tx_error;
++
+       data = skb->data;
+       islcp = ((data[0] << 8) + data[1]) == PPP_LCP && 1 <= data[2] && data[2] <= 7;
+@@ -262,6 +264,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
+       return 1;
+ tx_error:
++      ip_rt_put(rt);
+       kfree_skb(skb);
+       return 1;
+ }
+-- 
+2.39.5
+
diff --git a/queue-5.10/pptp-fix-pptp_xmit-error-path.patch b/queue-5.10/pptp-fix-pptp_xmit-error-path.patch
new file mode 100644 (file)
index 0000000..97809bc
--- /dev/null
@@ -0,0 +1,84 @@
+From ce22de0be4518fc46cbbd5fa3fb8ddc8f6b0381d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 7 Aug 2025 14:21:46 +0000
+Subject: pptp: fix pptp_xmit() error path
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit ae633388cae349886f1a3cfb27aa092854b24c1b ]
+
+I accidentally added a bug in pptp_xmit() that syzbot caught for us.
+
+Only call ip_rt_put() if a route has been allocated.
+
+BUG: unable to handle page fault for address: ffffffffffffffdb
+PGD df3b067 P4D df3b067 PUD df3d067 PMD 0
+Oops: Oops: 0002 [#1] SMP KASAN PTI
+CPU: 1 UID: 0 PID: 6346 Comm: syz.0.336 Not tainted 6.16.0-next-20250804-syzkaller #0 PREEMPT(full)
+Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
+RIP: 0010:arch_atomic_add_return arch/x86/include/asm/atomic.h:85 [inline]
+RIP: 0010:raw_atomic_sub_return_release include/linux/atomic/atomic-arch-fallback.h:846 [inline]
+RIP: 0010:atomic_sub_return_release include/linux/atomic/atomic-instrumented.h:327 [inline]
+RIP: 0010:__rcuref_put include/linux/rcuref.h:109 [inline]
+RIP: 0010:rcuref_put+0x172/0x210 include/linux/rcuref.h:173
+Call Trace:
+ <TASK>
+ dst_release+0x24/0x1b0 net/core/dst.c:167
+ ip_rt_put include/net/route.h:285 [inline]
+ pptp_xmit+0x14b/0x1a90 drivers/net/ppp/pptp.c:267
+ __ppp_channel_push+0xf2/0x1c0 drivers/net/ppp/ppp_generic.c:2166
+ ppp_channel_push+0x123/0x660 drivers/net/ppp/ppp_generic.c:2198
+ ppp_write+0x2b0/0x400 drivers/net/ppp/ppp_generic.c:544
+ vfs_write+0x27b/0xb30 fs/read_write.c:684
+ ksys_write+0x145/0x250 fs/read_write.c:738
+ do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
+ do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
+ entry_SYSCALL_64_after_hwframe+0x77/0x7f
+
+Fixes: de9c4861fb42 ("pptp: ensure minimal skb length in pptp_xmit()")
+Reported-by: syzbot+27d7cfbc93457e472e00@syzkaller.appspotmail.com
+Closes: https://lore.kernel.org/netdev/689095a5.050a0220.1fc43d.0009.GAE@google.com/
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Link: https://patch.msgid.link/20250807142146.2877060-1-edumazet@google.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ppp/pptp.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c
+index 1b306562f916..3c1e7155e2bf 100644
+--- a/drivers/net/ppp/pptp.c
++++ b/drivers/net/ppp/pptp.c
+@@ -159,17 +159,17 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
+       int len;
+       unsigned char *data;
+       __u32 seq_recv;
+-      struct rtable *rt = NULL;
++      struct rtable *rt;
+       struct net_device *tdev;
+       struct iphdr  *iph;
+       int    max_headroom;
+       if (sk_pppox(po)->sk_state & PPPOX_DEAD)
+-              goto tx_error;
++              goto tx_drop;
+       rt = pptp_route_output(po, &fl4);
+       if (IS_ERR(rt))
+-              goto tx_error;
++              goto tx_drop;
+       tdev = rt->dst.dev;
+@@ -265,6 +265,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
+ tx_error:
+       ip_rt_put(rt);
++tx_drop:
+       kfree_skb(skb);
+       return 1;
+ }
+-- 
+2.39.5
+
index 9952993594913de7a69f4a97a54667bd68d5cd36..93633730e78469f3dc73d504bd6b04e9514ab61e 100644 (file)
@@ -165,3 +165,19 @@ powerpc-eeh-export-eeh_unfreeze_pe.patch
 powerpc-eeh-rely-on-dev-link_active_reporting.patch
 powerpc-eeh-make-eeh-driver-device-hotplug-safe.patch
 pci-pnv_php-fix-surprise-plug-detection-and-recovery.patch
+pnfs-flexfiles-avoid-spurious-layout-returns-in-ff_l.patch
+pnfs-flexfiles-don-t-attempt-pnfs-on-fatal-ds-errors.patch
+nfs-fix-filehandle-bounds-checking-in-nfs_fh_to_dent.patch
+nfsv4.2-another-fix-for-listxattr.patch
+mm-extract-might_alloc-debug-check.patch
+xarray-add-calls-to-might_alloc.patch
+nfs-fixup-allocation-flags-for-nfsiod-s-__gfp_noretr.patch
+netpoll-prevent-hanging-napi-when-netcons-gets-enabl.patch
+phy-mscc-fix-parsing-of-unicast-frames.patch
+pptp-ensure-minimal-skb-length-in-pptp_xmit.patch
+ipv6-reject-malicious-packets-in-ipv6_gso_segment.patch
+net-drop-ufo-packets-in-udp_rcv_segment.patch
+benet-fix-bug-when-creating-vfs.patch
+alsa-hda-ca0132-fix-missing-error-handling-in-ca0132.patch
+smb-client-let-recv_done-cleanup-before-notifying-th.patch
+pptp-fix-pptp_xmit-error-path.patch
diff --git a/queue-5.10/smb-client-let-recv_done-cleanup-before-notifying-th.patch b/queue-5.10/smb-client-let-recv_done-cleanup-before-notifying-th.patch
new file mode 100644 (file)
index 0000000..0b65554
--- /dev/null
@@ -0,0 +1,79 @@
+From 4aa6d71d88bc97e8cab8d5cca0495552f8b80a63 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 4 Aug 2025 14:10:15 +0200
+Subject: smb: client: let recv_done() cleanup before notifying the callers.
+
+From: Stefan Metzmacher <metze@samba.org>
+
+[ Upstream commit bdd7afc6dca5e0ebbb75583484aa6ea9e03fbb13 ]
+
+We should call put_receive_buffer() before waking up the callers.
+
+For the internal error case of response->type being unexpected,
+we now also call smbd_disconnect_rdma_connection() instead
+of not waking up the callers at all.
+
+Note that the SMBD_TRANSFER_DATA case still has problems,
+which will be addressed in the next commit in order to make
+it easier to review this one.
+
+Cc: Steve French <smfrench@gmail.com>
+Cc: Tom Talpey <tom@talpey.com>
+Cc: Long Li <longli@microsoft.com>
+Cc: linux-cifs@vger.kernel.org
+Cc: samba-technical@lists.samba.org
+Fixes: f198186aa9bb ("CIFS: SMBD: Establish SMB Direct connection")
+Signed-off-by: Stefan Metzmacher <metze@samba.org>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/cifs/smbdirect.c | 14 ++++++++------
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c
+index 7d18b9268817..ae332f3771f6 100644
+--- a/fs/cifs/smbdirect.c
++++ b/fs/cifs/smbdirect.c
+@@ -454,7 +454,6 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
+       if (wc->status != IB_WC_SUCCESS || wc->opcode != IB_WC_RECV) {
+               log_rdma_recv(INFO, "wc->status=%d opcode=%d\n",
+                       wc->status, wc->opcode);
+-              smbd_disconnect_rdma_connection(info);
+               goto error;
+       }
+@@ -471,8 +470,9 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
+               info->full_packet_received = true;
+               info->negotiate_done =
+                       process_negotiation_response(response, wc->byte_len);
++              put_receive_buffer(info, response);
+               complete(&info->negotiate_completion);
+-              break;
++              return;
+       /* SMBD data transfer packet */
+       case SMBD_TRANSFER_DATA:
+@@ -529,14 +529,16 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
+               }
+               return;
+-
+-      default:
+-              log_rdma_recv(ERR,
+-                      "unexpected response type=%d\n", response->type);
+       }
++      /*
++       * This is an internal error!
++       */
++      log_rdma_recv(ERR, "unexpected response type=%d\n", response->type);
++      WARN_ON_ONCE(response->type != SMBD_TRANSFER_DATA);
+ error:
+       put_receive_buffer(info, response);
++      smbd_disconnect_rdma_connection(info);
+ }
+ static struct rdma_cm_id *smbd_create_id(
+-- 
+2.39.5
+
diff --git a/queue-5.10/xarray-add-calls-to-might_alloc.patch b/queue-5.10/xarray-add-calls-to-might_alloc.patch
new file mode 100644 (file)
index 0000000..2b9473a
--- /dev/null
@@ -0,0 +1,159 @@
+From f4f032f8d29f337db1af162749d6bb48e02aa7a0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 6 Jul 2022 14:51:00 -0400
+Subject: XArray: Add calls to might_alloc()
+
+From: Matthew Wilcox (Oracle) <willy@infradead.org>
+
+[ Upstream commit 1dd685c414a7b9fdb3d23aca3aedae84f0b998ae ]
+
+Catch bogus GFP flags deterministically, instead of occasionally
+when we actually have to allocate memory.
+
+Reported-by: Nikolay Borisov <nborisov@suse.com>
+Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
+Stable-dep-of: 99765233ab42 ("NFS: Fixup allocation flags for nfsiod's __GFP_NORETRY")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/xarray.h         | 15 +++++++++++++++
+ tools/include/linux/sched/mm.h |  2 ++
+ 2 files changed, 17 insertions(+)
+
+diff --git a/include/linux/xarray.h b/include/linux/xarray.h
+index 92c0160b3352..05c025c5c100 100644
+--- a/include/linux/xarray.h
++++ b/include/linux/xarray.h
+@@ -15,6 +15,7 @@
+ #include <linux/kconfig.h>
+ #include <linux/kernel.h>
+ #include <linux/rcupdate.h>
++#include <linux/sched/mm.h>
+ #include <linux/spinlock.h>
+ #include <linux/types.h>
+@@ -583,6 +584,7 @@ static inline void *xa_store_bh(struct xarray *xa, unsigned long index,
+ {
+       void *curr;
++      might_alloc(gfp);
+       xa_lock_bh(xa);
+       curr = __xa_store(xa, index, entry, gfp);
+       xa_unlock_bh(xa);
+@@ -609,6 +611,7 @@ static inline void *xa_store_irq(struct xarray *xa, unsigned long index,
+ {
+       void *curr;
++      might_alloc(gfp);
+       xa_lock_irq(xa);
+       curr = __xa_store(xa, index, entry, gfp);
+       xa_unlock_irq(xa);
+@@ -684,6 +687,7 @@ static inline void *xa_cmpxchg(struct xarray *xa, unsigned long index,
+ {
+       void *curr;
++      might_alloc(gfp);
+       xa_lock(xa);
+       curr = __xa_cmpxchg(xa, index, old, entry, gfp);
+       xa_unlock(xa);
+@@ -711,6 +715,7 @@ static inline void *xa_cmpxchg_bh(struct xarray *xa, unsigned long index,
+ {
+       void *curr;
++      might_alloc(gfp);
+       xa_lock_bh(xa);
+       curr = __xa_cmpxchg(xa, index, old, entry, gfp);
+       xa_unlock_bh(xa);
+@@ -738,6 +743,7 @@ static inline void *xa_cmpxchg_irq(struct xarray *xa, unsigned long index,
+ {
+       void *curr;
++      might_alloc(gfp);
+       xa_lock_irq(xa);
+       curr = __xa_cmpxchg(xa, index, old, entry, gfp);
+       xa_unlock_irq(xa);
+@@ -767,6 +773,7 @@ static inline int __must_check xa_insert(struct xarray *xa,
+ {
+       int err;
++      might_alloc(gfp);
+       xa_lock(xa);
+       err = __xa_insert(xa, index, entry, gfp);
+       xa_unlock(xa);
+@@ -796,6 +803,7 @@ static inline int __must_check xa_insert_bh(struct xarray *xa,
+ {
+       int err;
++      might_alloc(gfp);
+       xa_lock_bh(xa);
+       err = __xa_insert(xa, index, entry, gfp);
+       xa_unlock_bh(xa);
+@@ -825,6 +833,7 @@ static inline int __must_check xa_insert_irq(struct xarray *xa,
+ {
+       int err;
++      might_alloc(gfp);
+       xa_lock_irq(xa);
+       err = __xa_insert(xa, index, entry, gfp);
+       xa_unlock_irq(xa);
+@@ -854,6 +863,7 @@ static inline __must_check int xa_alloc(struct xarray *xa, u32 *id,
+ {
+       int err;
++      might_alloc(gfp);
+       xa_lock(xa);
+       err = __xa_alloc(xa, id, entry, limit, gfp);
+       xa_unlock(xa);
+@@ -883,6 +893,7 @@ static inline int __must_check xa_alloc_bh(struct xarray *xa, u32 *id,
+ {
+       int err;
++      might_alloc(gfp);
+       xa_lock_bh(xa);
+       err = __xa_alloc(xa, id, entry, limit, gfp);
+       xa_unlock_bh(xa);
+@@ -912,6 +923,7 @@ static inline int __must_check xa_alloc_irq(struct xarray *xa, u32 *id,
+ {
+       int err;
++      might_alloc(gfp);
+       xa_lock_irq(xa);
+       err = __xa_alloc(xa, id, entry, limit, gfp);
+       xa_unlock_irq(xa);
+@@ -945,6 +957,7 @@ static inline int xa_alloc_cyclic(struct xarray *xa, u32 *id, void *entry,
+ {
+       int err;
++      might_alloc(gfp);
+       xa_lock(xa);
+       err = __xa_alloc_cyclic(xa, id, entry, limit, next, gfp);
+       xa_unlock(xa);
+@@ -978,6 +991,7 @@ static inline int xa_alloc_cyclic_bh(struct xarray *xa, u32 *id, void *entry,
+ {
+       int err;
++      might_alloc(gfp);
+       xa_lock_bh(xa);
+       err = __xa_alloc_cyclic(xa, id, entry, limit, next, gfp);
+       xa_unlock_bh(xa);
+@@ -1011,6 +1025,7 @@ static inline int xa_alloc_cyclic_irq(struct xarray *xa, u32 *id, void *entry,
+ {
+       int err;
++      might_alloc(gfp);
+       xa_lock_irq(xa);
+       err = __xa_alloc_cyclic(xa, id, entry, limit, next, gfp);
+       xa_unlock_irq(xa);
+diff --git a/tools/include/linux/sched/mm.h b/tools/include/linux/sched/mm.h
+index c8d9f19c1f35..967294b8edcf 100644
+--- a/tools/include/linux/sched/mm.h
++++ b/tools/include/linux/sched/mm.h
+@@ -1,4 +1,6 @@
+ #ifndef _TOOLS_PERF_LINUX_SCHED_MM_H
+ #define _TOOLS_PERF_LINUX_SCHED_MM_H
++#define might_alloc(gfp)      do { } while (0)
++
+ #endif  /* _TOOLS_PERF_LINUX_SCHED_MM_H */
+-- 
+2.39.5
+