From: Eric Dumazet Subject: [PATCH net-next] tcp: drop dst in tcp_add_backlog() Date: Mon, 19 Nov 2018 17:45:55 -0800 Message-ID: <20181120014555.254608-1-edumazet@google.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: netdev , Eric Dumazet , Eric Dumazet To: "David S . Miller" Return-path: Received: from mail-pl1-f193.google.com ([209.85.214.193]:34043 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726119AbeKTMMf (ORCPT ); Tue, 20 Nov 2018 07:12:35 -0500 Received: by mail-pl1-f193.google.com with SMTP id f12-v6so175355plo.1 for ; Mon, 19 Nov 2018 17:45:59 -0800 (PST) Sender: netdev-owner@vger.kernel.org List-ID: Under stress, softirq rx handler often hits a socket owned by the user, and has to queue the packet into socket backlog. When this happens, skb dst refcount is taken before we escape rcu protected region. This is done from __sk_add_backlog() calling skb_dst_force(). Consumer will have to perform the opposite costly operation. AFAIK nothing in tcp stack requests the dst after skb was stored in the backlog. If this was the case, we would have had failures already since skb_dst_force() can end up clearing skb dst anyway. Signed-off-by: Eric Dumazet --- net/ipv4/tcp_ipv4.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 0952d4b772e7aa3cfb936596aa586dbd2dd6efde..795605a2327504b8a025405826e7e0ca8dc8501d 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -1634,6 +1634,8 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb) */ skb_condense(skb); + skb_dst_drop(skb); + if (unlikely(sk_add_backlog(sk, skb, limit))) { bh_unlock_sock(sk); __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPBACKLOGDROP); -- 2.19.1.1215.g8438c0b245-goog