Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2019234ybv; Fri, 21 Feb 2020 07:26:07 -0800 (PST) X-Google-Smtp-Source: APXvYqyLJFGDnW+v1CxZrbvk/comu2Qw4qbT/Vpvymb1Ckt7ugIvVWeZLMifx1ldS6lUu1Cc0Oy+ X-Received: by 2002:a05:6808:a8a:: with SMTP id q10mr2371331oij.66.1582298767292; Fri, 21 Feb 2020 07:26:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582298767; cv=none; d=google.com; s=arc-20160816; b=0yJPD1IAGgftscEEWj95IRCP4cInoL6VaQ4qYuY8YdkvWa35u4cudl2VKmEzt+UNtN 4w2bMnyaRXWt6DXbRA/JFOTv/S0EWZKYmJh33T28JnASXemvWNprs/yTdvmstIjAySFt dzkiIi/YFQ4o+Fl76Xyt4wP4MFX6b6PE2eTjVu8l+RDj1lIto+nWSOhMy7Fouz5yUONO n2CqMVJ959m6vsFlg/QH7+2Au+tx5taA7korhT8iZjvqHrDLKBYEuOfBj9LBRk4AJcQn GB6DvPKTKMPgUS/kcDsDP0l1iR82yedY4kpYVpdCzudthneqXB6i/nVV/8ZD07j1x+Mp OS2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/D8p3umAJnu2Rmie5wIDoJw/XtMw5bg4kYLl7SwrZqU=; b=sbOWjffLQxjwNWkbaH0ye2a8YmZexgJFapTB8jFx/75OuG0fv/0L4/RmBb+ZeUovNy 7KbRfsjRa6YB29Pa0YhNQqmJTFPyitilKKmSyiocP5UZNPAfUEhHDgirzbVRQYswXZP8 BNKc+e5qjeAHY7a7vOuOh4j+uACsiOy//JnYFjRV4oR6j+c+5IGvE8Uv8DoMaQfqL4+L uQy+I4T3HcjrU87Uomnsa8zwsqMCnQ+bHNscCT2XGurKcgOqr79IRgh4XHzjeDeQBE8L ToJRF9tq6J5mnTOirc/vOSaabJ3IjnwDCGIdw3p2MnQ9u5sf/qaSkSmth7vlpq2m6qK7 PjcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pdGu78qA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t11si860467oih.187.2020.02.21.07.25.55; Fri, 21 Feb 2020 07:26:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pdGu78qA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729196AbgBUPYD (ORCPT + 99 others); Fri, 21 Feb 2020 10:24:03 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:46352 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729187AbgBUPYC (ORCPT ); Fri, 21 Feb 2020 10:24:02 -0500 Received: by mail-pl1-f196.google.com with SMTP id y8so964846pll.13 for ; Fri, 21 Feb 2020 07:24:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/D8p3umAJnu2Rmie5wIDoJw/XtMw5bg4kYLl7SwrZqU=; b=pdGu78qAVOal10Sy3Z0B22mZC2QD6KvLq0XrW0D4SXBwjRLWx2x65aL9uy4xbnVU0w 2yaacYhHhoU0hioia4BuUt1RKp4bj/LgGQsjpefcv9ITHNwI/dIfBK/Is7cnePaxqrfv iTNFn6u+XCJTNHLNFOoxyKHDMfsnEUaa/p5DXRlcPvngtraX1n7+rYdosLE7SdTrPQar 8nYpIoW18oDr/sCviGKKJczzHMJB/jkuyjjNloiOZMFZySqSN9HeNODLnBCFTtaA1IDT 74OIE0ljfjFznWa1YAFI1nX1Vz0bTjlDCzTwOLqVc8p25Uj4EbWbz5FLuyE0plRi0b/D YeXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/D8p3umAJnu2Rmie5wIDoJw/XtMw5bg4kYLl7SwrZqU=; b=dHTsndevOU4yC46Xrg7Cw4ECDHdNTyqd731tY6GpP0+U1DVwKsEx9jgq/ItkXDi5kO +GMtraAgK4Nfc+AYvIWytYqJIXfx52VbEAxPceMyCxvGXcifq+Ingf//rHQHdLBfabjs b2AnvppiO8BdVYC0jDPMUTgcHBYH5OXLmqKWFZYcwZJShrorBTDniR6S0+0rm9vLBj3r A6AUtepciyjDsXOeyh15E9yivMJocLuoLlmKTgSY1GxbdJXSBNxJujyvTashp5z3H15u X5N9YzpCWLL9WSu+3/zJIog4TSyNrqHihYPyy2JhMRVS/PrdcLCx8glxzG0ht4AedbQ9 K5HQ== X-Gm-Message-State: APjAAAVQpylLnKnsan0DkmirJMbNdiriBW51wy//w+U0wdAyUPPumW0K RDzGpdA9ME9RcDRow9/p4PVPU09aVBM= X-Received: by 2002:a17:90a:d80b:: with SMTP id a11mr3747256pjv.142.1582298641501; Fri, 21 Feb 2020 07:24:01 -0800 (PST) Received: from localhost.localdomain ([103.87.57.170]) by smtp.googlemail.com with ESMTPSA id w128sm1588394pgb.55.2020.02.21.07.23.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 07:24:01 -0800 (PST) From: Amol Grover To: Eric Dumazet , "David S . Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , Jakub Kicinski Cc: linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Joel Fernandes , Madhuparna Bhowmik , "Paul E . McKenney" , Amol Grover Subject: [PATCH] tcp: ipv4: Pass lockdep expression to RCU lists Date: Fri, 21 Feb 2020 20:51:54 +0530 Message-Id: <20200221152152.16685-1-frextrite@gmail.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org md5sig->head maybe traversed using hlist_for_each_entry_rcu outside an RCU read-side critical section but under the protection of socket lock. Hence, add corresponding lockdep expression to silence false-positive warnings, and harden RCU lists. Signed-off-by: Amol Grover --- net/ipv4/tcp_ipv4.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 1c7326e04f9b..6519429f32cd 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -1000,7 +1000,8 @@ struct tcp_md5sig_key *__tcp_md5_do_lookup(const struct sock *sk, if (!md5sig) return NULL; - hlist_for_each_entry_rcu(key, &md5sig->head, node) { + hlist_for_each_entry_rcu(key, &md5sig->head, node, + lockdep_sock_is_held(sk)) { if (key->family != family) continue; @@ -1043,7 +1044,8 @@ static struct tcp_md5sig_key *tcp_md5_do_lookup_exact(const struct sock *sk, if (family == AF_INET6) size = sizeof(struct in6_addr); #endif - hlist_for_each_entry_rcu(key, &md5sig->head, node) { + hlist_for_each_entry_rcu(key, &md5sig->head, node, + lockdep_sock_is_held(sk)) { if (key->family != family) continue; if (!memcmp(&key->addr, addr, size) && -- 2.24.1