]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: netmem: fix skb_ensure_writable with unreadable skbs
authorMina Almasry <almasrymina@google.com>
Sun, 15 Jun 2025 20:07:33 +0000 (20:07 +0000)
committerJakub Kicinski <kuba@kernel.org>
Tue, 17 Jun 2025 22:48:20 +0000 (15:48 -0700)
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: 65249feb6b3d ("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>
net/core/skbuff.c

index 85fc82f72d26883307a975a90336a0474debaf8e..d6420b74ea9c6a9c53a7c16634cce82a1cd1bbd3 100644 (file)
@@ -6261,9 +6261,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;