summaryrefslogtreecommitdiff
path: root/net/core/filter.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2023-01-05 15:34:11 -0800
committerJakub Kicinski <kuba@kernel.org>2023-01-05 15:34:11 -0800
commit4aea86b4033f92f01547e6d4388d4451ae9b0980 (patch)
tree1e6e70b8133187b56d636ad9bb942c81b2654173 /net/core/filter.c
parent0471005efac9ac70bffd50532f8de07a28eac5aa (diff)
parent50011c32f421215f6231996fcc84fd1fe81c4a48 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
No conflicts. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core/filter.c')
-rw-r--r--net/core/filter.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/core/filter.c b/net/core/filter.c
index c746e4d77214..ab811293ae5d 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3180,15 +3180,18 @@ static int bpf_skb_generic_push(struct sk_buff *skb, u32 off, u32 len)
static int bpf_skb_generic_pop(struct sk_buff *skb, u32 off, u32 len)
{
+ void *old_data;
+
/* skb_ensure_writable() is not needed here, as we're
* already working on an uncloned skb.
*/
if (unlikely(!pskb_may_pull(skb, off + len)))
return -ENOMEM;
- skb_postpull_rcsum(skb, skb->data + off, len);
- memmove(skb->data + len, skb->data, off);
+ old_data = skb->data;
__skb_pull(skb, len);
+ skb_postpull_rcsum(skb, old_data + off, len);
+ memmove(skb->data, old_data, off);
return 0;
}