diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/core/filter.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/core/filter.c b/net/core/filter.c index a368edd9057c..0c2666e041d3 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -3184,15 +3184,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; } |