diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index 634415c7fbcd..943929a05c92 100644 --- a/kernel/bpf/sockmap.c +++ b/kernel/bpf/sockmap.c @@ -326,6 +326,9 @@ static int bpf_tcp_push(struct sock *sk, int apply_bytes, if (ret > 0) { if (apply) apply_bytes -= ret; + + sg->offset += ret; + sg->length -= ret; size -= ret; offset += ret; if (uncharge) @@ -333,8 +336,6 @@ static int bpf_tcp_push(struct sock *sk, int apply_bytes, goto retry; } - sg->length = size; - sg->offset = offset; return ret; }