linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v1] netmem: fix skb_frag_address_safe with unreadable skbs
@ 2025-06-17 21:09 Mina Almasry
  2025-06-17 21:15 ` Mina Almasry
  2025-06-18 21:53 ` Jakub Kicinski
  0 siblings, 2 replies; 7+ messages in thread
From: Mina Almasry @ 2025-06-17 21:09 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Mina Almasry, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman, ap420073

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>
---
 include/linux/skbuff.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 5520524c93bf..9d551845e517 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -3665,7 +3665,12 @@ 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));
+	void *ptr;
+
+	if (!skb_frag_page(frag))
+		return NULL;
+
+	ptr = page_address(skb_frag_page(frag));
 	if (unlikely(!ptr))
 		return NULL;
 

base-commit: 7b4ac12cc929e281cf7edc22203e0533790ebc2b
-- 
2.50.0.rc2.696.g1fc2a0284f-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-06-18 21:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-17 21:09 [PATCH net v1] netmem: fix skb_frag_address_safe with unreadable skbs Mina Almasry
2025-06-17 21:15 ` Mina Almasry
2025-06-17 21:30   ` Stanislav Fomichev
2025-06-17 21:52     ` Mina Almasry
2025-06-18 21:27       ` Jakub Kicinski
2025-06-18 21:38         ` Stanislav Fomichev
2025-06-18 21:53 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).