On Wed, Oct 02, 2019 at 08:19:59PM -0700, Eric Dumazet wrote:
> Apparently a refactoring patch brought a bug, that was caught
> by syzbot [1]
That wasn't refactoring. As you know (because we talked about it at
LSFMM), this is an enabling patch for supporting hch's work to fix
get_user_pages().
> Original code was correct, do not try to be smarter than the
> compiler :/
That wasn't an attempt to be smarter than the compiler. I was trying
to keep the line length below 80 columns. Which you probably now see
that you haven't done.
I must have a blind spot here. I can't see the difference between the
two versions.
> +++ b/net/ipv4/tcp.c
> @@ -1798,13 +1798,11 @@ static int tcp_zerocopy_receive(struct sock *sk,
> }
> if (skb_frag_size(frags) != PAGE_SIZE || skb_frag_off(frags)) {
> int remaining = zc->recv_skip_hint;
> - int size = skb_frag_size(frags);
>
> - while (remaining && (size != PAGE_SIZE ||
> + while (remaining && (skb_frag_size(frags) != PAGE_SIZE
> ||
> skb_frag_off(frags))) {
> - remaining -= size;
> + remaining -= skb_frag_size(frags);
> frags++;
> - size = skb_frag_size(frags);
> }
> zc->recv_skip_hint -= remaining;
> break;
> --
> 2.23.0.581.g78d2f28ef7-goog
>