Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp411780ybv; Wed, 19 Feb 2020 02:06:49 -0800 (PST) X-Google-Smtp-Source: APXvYqyTh+HPo6GStyhhfOTjQzRvPEnyECYhIwATRj6qaNdqBFbRw3lr91a3kG6wfdzLWaRN2una X-Received: by 2002:a05:6830:1e72:: with SMTP id m18mr17770343otr.226.1582106808311; Wed, 19 Feb 2020 02:06:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582106808; cv=none; d=google.com; s=arc-20160816; b=Gbsui/FBK+aFxLnxm1Lxj8vG1W8AXzEk5dRJ2qzJYH60upZcB3mTGrCNTjUUts8DmZ K7402IXE8LQhogeFssbrQzjrgc/5tFDojrCXyBugreMQ3JxEDX/wPMypWR0JSTqWu3FP jBXOQtt5bqjq8uAZNrIqkLn5658Ye5AGiI3O07d7W5gE5IGkDu2Xh3MbxTZzFAU+bZLH 2lJ6FAiV/FnX8q2/dfxrtkEf4p9bzrCN+ymWxZuWEkRaoc2pUx+InuwqVvToDqTlkyHo L9Z27uqKxrwA11XwOFHJNdWCHoXzSb/zVRKI/SF6cMJQ4QiHhbDM3EFT/sl2XJgjfoCp ZgQA== 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=GVRdPNZo5d7eI2NxNW1l7GKKSA1O3A8YX4K6fJNiyFY=; b=oAS+j13b2lSDSkt9ylGF4vfX+zOLqAbIJqqNKeaMNVgVl1Vwuh84xpun+lVveqarH4 YXzEFrM7crTDO1DsL1W2ybDZUSq20QfseQi2b4GXvJDRXvM06KbiD67kid6h0zI/R33A lGTbGA04uUNM+zrjsyy4gsQfxdUoTRBwO0iY139TJCGWJkNrczkDoW1TFIO7esXdcJXr Y+G2NCKZoKYtA+D7scEeCsNp1cUu2vIRiRjV2mjsE0Z+6iTMJIgJSUo5l3JDi/ZROxY8 uM79mzmMc/YTTdKQVJIPC2CU8KohMXHEMnIRo01mA1LacDTGVLPniCq5jvrWTY4YID2J t+aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=j0baOwT4; 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 a22si8577781oii.98.2020.02.19.02.06.35; Wed, 19 Feb 2020 02:06:48 -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=j0baOwT4; 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 S1726634AbgBSKG1 (ORCPT + 99 others); Wed, 19 Feb 2020 05:06:27 -0500 Received: from mail-pj1-f65.google.com ([209.85.216.65]:36112 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726270AbgBSKG0 (ORCPT ); Wed, 19 Feb 2020 05:06:26 -0500 Received: by mail-pj1-f65.google.com with SMTP id gv17so2329209pjb.1; Wed, 19 Feb 2020 02:06:26 -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=GVRdPNZo5d7eI2NxNW1l7GKKSA1O3A8YX4K6fJNiyFY=; b=j0baOwT4MtNLCJOeh0o5lSqPQB90+Rp/h2KSZs0EGIBpTIb0AtoyvA9Om1n5YFIChN kteaGHD0cop5owLYIfi7ILHZFl/vUjEP8PP4z5tDqAuta7CFnOTHkXjeGdoceEfQY4XO +Ebx9VrVptRX/UV81DTLEQDt6kUPYlRyDJtljGmiWE6bAj0ohSZlDqigr+O8baB1TD7n IXCxhV5e35GbRm/8inLkz6r+6idv2be0yxk/GyBL3pGxrBw/DpTlWvPXiJBj6ZrPuQ81 RyptQrK4Rp5tDRTw1lnJo2YOWDKA4Y202Di+Cqnuq/xTMh9naiEzvBzwJ+IaZfs+Hup8 yNSg== 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=GVRdPNZo5d7eI2NxNW1l7GKKSA1O3A8YX4K6fJNiyFY=; b=hN73Fn4ZbR7speJsfuqEwK1Vz+++ntnk+yoVJzE15mZhA5BoHAeeioaG0I0Pzb5I4a /WWEdl2dQtE8rE3/9kXJ0BDXNIp78ysXVEWM57hdDDdl7Q2OpnzdEm8VsHEdxAhWCouo UcTqdAJ/SKAFFtTQp+PXMZfzrZoXa8iutTJjfkbgnQt1dcqmLHe8oFxQvKKMAN4vbMkl zgxtp4XyGudUPOMRHnMUHCVsGIKhOJMgVUwLboFVSmV8R1+nWzAyVSMRkS4p8QIruDri OxJzn34KtY+BuV/4iLlPPVGZVED886hlAhpr5Zhe64epBBwjDyAnE308SLATT0nWKfK2 Wguw== X-Gm-Message-State: APjAAAWMZecFY/2cH+wMUkV14sNmkCbbHAP2tJFQ0QONnQMlwTMuRS/3 QpciQOIErzEbiKdWskGuqZ0= X-Received: by 2002:a17:902:7c85:: with SMTP id y5mr24648684pll.227.1582106786018; Wed, 19 Feb 2020 02:06:26 -0800 (PST) Received: from localhost.localdomain ([146.196.37.220]) by smtp.googlemail.com with ESMTPSA id w14sm2097754pgi.22.2020.02.19.02.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 02:06:25 -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" , netdev@vger.kernel.org, Amol Grover Subject: [PATCH] tcp: Pass lockdep expression to RCU lists Date: Wed, 19 Feb 2020 15:35:46 +0530 Message-Id: <20200219100545.27397-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 tcp_cong_list is traversed using list_for_each_entry_rcu outside an RCU read-side critical section but under the protection of tcp_cong_list_lock. Hence, add corresponding lockdep expression to silence false-positive warnings, and harden RCU lists. Signed-off-by: Amol Grover --- net/ipv4/tcp_cong.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c index 3737ec096650..8d4446ed309e 100644 --- a/net/ipv4/tcp_cong.c +++ b/net/ipv4/tcp_cong.c @@ -25,7 +25,8 @@ static struct tcp_congestion_ops *tcp_ca_find(const char *name) { struct tcp_congestion_ops *e; - list_for_each_entry_rcu(e, &tcp_cong_list, list) { + list_for_each_entry_rcu(e, &tcp_cong_list, list, + lockdep_is_held(&tcp_cong_list_lock)) { if (strcmp(e->name, name) == 0) return e; } @@ -55,7 +56,8 @@ struct tcp_congestion_ops *tcp_ca_find_key(u32 key) { struct tcp_congestion_ops *e; - list_for_each_entry_rcu(e, &tcp_cong_list, list) { + list_for_each_entry_rcu(e, &tcp_cong_list, list, + lockdep_is_held(&tcp_cong_list_lock)) { if (e->key == key) return e; } @@ -317,7 +319,8 @@ int tcp_set_allowed_congestion_control(char *val) } /* pass 2 clear old values */ - list_for_each_entry_rcu(ca, &tcp_cong_list, list) + list_for_each_entry_rcu(ca, &tcp_cong_list, list, + lockdep_is_held(&tcp_cong_list_lock)) ca->flags &= ~TCP_CONG_NON_RESTRICTED; /* pass 3 mark as allowed */ -- 2.24.1