mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 14:04:27 -04:00
net: core: check skb_frags_readable before uncloning in skb_copy_ubufs
skb_copy_ubufs drops clones and modifies the SKB via pskb_expand_head()
before checking for !skb_frags_readable(skb). This alters the SKB
geometry prior to throwing an -EFAULT on an invalid SKB. Check
readability first.
Fixes: 65249feb6b ("net: add support for skbs with unreadable frags")
Signed-off-by: Mina Almasry <almasrymina@google.com>
Link: https://patch.msgid.link/20260823183602.1051453-1-almasrymina@google.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
committed by
Paolo Abeni
parent
2db9bfa3e2
commit
00e11ee983
@@ -2004,12 +2004,12 @@ int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask)
|
||||
int i, order, psize, new_frags;
|
||||
u32 d_off;
|
||||
|
||||
if (skb_shared(skb) || skb_unclone(skb, gfp_mask))
|
||||
return -EINVAL;
|
||||
|
||||
if (!skb_frags_readable(skb))
|
||||
return -EFAULT;
|
||||
|
||||
if (skb_shared(skb) || skb_unclone(skb, gfp_mask))
|
||||
return -EINVAL;
|
||||
|
||||
if (!num_frags)
|
||||
goto release;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user