summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorGao Feng <fgao@ikuai8.com>2017-04-06 23:05:49 +0800
committerDavid S. Miller <davem@davemloft.net>2017-04-08 08:30:09 -0700
commit7cc2b043bc3f1e8139e807528c8041c15924a411 (patch)
tree13d35a2222f52437bd26b51281933614b31526eb /net
parent3aecfbb19ca746a62575de90957c14e03b9c5d23 (diff)
downloadlinux-0-day-7cc2b043bc3f1e8139e807528c8041c15924a411.tar.gz
linux-0-day-7cc2b043bc3f1e8139e807528c8041c15924a411.tar.xz
net: tcp: Increase TCP_MIB_OUTRSTS even though fail to alloc skb
Because TCP_MIB_OUTRSTS is an important count, so always increase it whatever send it successfully or not. Now move the increment of TCP_MIB_OUTRSTS to the top of tcp_send_active_reset to make sure it is increased always even though fail to alloc skb. Signed-off-by: Gao Feng <fgao@ikuai8.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/tcp_output.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 22548b5f05cbe..c3c082ed38796 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2999,6 +2999,8 @@ void tcp_send_active_reset(struct sock *sk, gfp_t priority)
{
struct sk_buff *skb;
+ TCP_INC_STATS(sock_net(sk), TCP_MIB_OUTRSTS);
+
/* NOTE: No TCP options attached and we never retransmit this. */
skb = alloc_skb(MAX_TCP_HEADER, priority);
if (!skb) {
@@ -3014,8 +3016,6 @@ void tcp_send_active_reset(struct sock *sk, gfp_t priority)
/* Send it off. */
if (tcp_transmit_skb(sk, skb, 0, priority))
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTFAILED);
-
- TCP_INC_STATS(sock_net(sk), TCP_MIB_OUTRSTS);
}
/* Send a crossed SYN-ACK during socket establishment.