summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorMina Almasry <almasrymina@google.com>2025-06-19 20:52:38 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-08-20 19:30:36 +0300
commitc500a13fd6cff0cf047c672da126b386e6d32740 (patch)
tree8321d0b1b890f20a21fb333315931bb2007455e6 /include/linux
parent8f2d0a7d993dbec0f93baa4d723ad33f0c3ced5d (diff)
downloadlinux-c500a13fd6cff0cf047c672da126b386e6d32740.tar.xz
netmem: fix skb_frag_address_safe with unreadable skbs
[ Upstream commit 4672aec56d2e8edabcb74c3e2320301d106a377e ] skb_frag_address_safe() needs a check that the skb_frag_page exists check similar to skb_frag_address(). Cc: ap420073@gmail.com Signed-off-by: Mina Almasry <almasrymina@google.com> Acked-by: Stanislav Fomichev <sdf@fomichev.me> Link: https://patch.msgid.link/20250619175239.3039329-1-almasrymina@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/skbuff.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index a726a698aac4..b2827fce5a2d 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -3638,7 +3638,13 @@ static inline void *skb_frag_address(const skb_frag_t *frag)
*/
static inline void *skb_frag_address_safe(const skb_frag_t *frag)
{
- void *ptr = page_address(skb_frag_page(frag));
+ struct page *page = skb_frag_page(frag);
+ void *ptr;
+
+ if (!page)
+ return NULL;
+
+ ptr = page_address(page);
if (unlikely(!ptr))
return NULL;