Skip to content

Commit

Permalink
net: netmem: fix skb_ensure_writable with unreadable skbs
Browse files Browse the repository at this point in the history
[ Upstream commit 6f793a1 ]

skb_ensure_writable should succeed when it's trying to write to the
header of the unreadable skbs, so it doesn't need an unconditional
skb_frags_readable check. The preceding pskb_may_pull() call will
succeed if write_len is within the head and fail if we're trying to
write to the unreadable payload, so we don't need an additional check.

Removing this check restores DSCP functionality with unreadable skbs as
it's called from dscp_tg.

Cc: willemb@google.com
Cc: asml.silence@gmail.com
Fixes: 65249fe ("net: add support for skbs with unreadable frags")
Signed-off-by: Mina Almasry <almasrymina@google.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20250615200733.520113-1-almasrymina@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Mina Almasry authored and Greg Kroah-Hartman committed Jun 27, 2025
1 parent ed42b8d commit 32955a4
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -6220,9 +6220,6 @@ int skb_ensure_writable(struct sk_buff *skb, unsigned int write_len)
if (!pskb_may_pull(skb, write_len))
return -ENOMEM;

if (!skb_frags_readable(skb))
return -EFAULT;

if (!skb_cloned(skb) || skb_clone_writable(skb, write_len))
return 0;

Expand Down

0 comments on commit 32955a4

Please sign in to comment.