Commit 843f7740 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

tcp: fix signed/unsigned comparison

Kernel test robot reported:

smatch warnings:
net/ipv4/tcp_input.c:5966 tcp_rcv_established() warn: unsigned 'reason' is never less than zero.

I actually had one packetdrill failing because of this bug,
and was about to send the fix :)

v2: Andreas Schwab also pointed out that @reason needs to be negated
    before we reach tcp_drop_reason()

Fixes: 4b506af9 ("tcp: add two drop reasons for tcp_ack()")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarAndreas Schwab <schwab@linux-m68k.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 53c33a16
......@@ -5959,9 +5959,10 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb)
step5:
reason = tcp_ack(sk, skb, FLAG_SLOWPATH | FLAG_UPDATE_TS_RECENT);
if (reason < 0)
if ((int)reason < 0) {
reason = -reason;
goto discard;
}
tcp_rcv_rtt_measure_ts(sk, skb);
/* Process urgent data. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment