aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2022-04-17 11:34:32 -0700
committerDavid S. Miller <davem@davemloft.net>2022-04-18 10:28:40 +0100
commit843f77407eebee07c2a3300df0c4b33f64322e29 (patch)
tree90d7a5df0d50c275334fa252a132ab1d9e2a295f /net/ipv4/tcp_input.c
parentMerge branch 'tcp-drop-reason-additions' (diff)
downloadlinux-dev-843f77407eebee07c2a3300df0c4b33f64322e29.tar.xz
linux-dev-843f77407eebee07c2a3300df0c4b33f64322e29.zip
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: 4b506af9c5b8 ("tcp: add two drop reasons for tcp_ack()") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: kernel test robot <lkp@intel.com> Reported-by: Andreas Schwab <schwab@linux-m68k.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index cf2dc19bb8c7..daff631b9486 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5959,9 +5959,10 @@ slow_path:
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. */