Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3702970ybv; Mon, 10 Feb 2020 05:01:15 -0800 (PST) X-Google-Smtp-Source: APXvYqwLUmrWjF7gAwHX6n8N5SXmjWF7YgB+nfKBmi+YQmu9W//UtECIjF/jcawNv7r3IHZS8x7B X-Received: by 2002:a05:6808:a83:: with SMTP id q3mr781933oij.0.1581339675278; Mon, 10 Feb 2020 05:01:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581339675; cv=none; d=google.com; s=arc-20160816; b=VyGQR8N3AQ89dCbuvi+h/9SgsO22ipDj7W5ephZxQW8lk1+HU0Y9e7Bc2CvjZf9EwF fFRl8CusW+wIgDA9Xy3nSB1wBGvacgpbbMXwYWIBB+ZdXiF10TKAQWSCbuhHlcJ1Nw7o TVRjf4Ef+9I6CD29q2qYGcNjV9ajr8Uh3y949pPxw++oE1mcevPBUfR6hrTdOBSilHeD eJUd58yEjO1kf1ts4HhmdJsOq9gyGT0IV6SfFGCC5nLl6+KamZ/00yNwtRnzVx9suiA7 h3m/nlaD1jsgsw/INEuKI47u+op5qqO51DUh7I7rIXIR28AdpLZn1khlifQnn4IfNIlT S++g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/4dvFyq57pebdfpbDgByenr5smmcjH98DCx8uxSqIgI=; b=MSncwcli2DEIgMweG+JiF5YmsjGdW7xP+arX7CliFV1v55Pm/r0isO5T6o7OoHODfw mowvLEpMBBVr0K0BV/BoiXQGb2BgO5v0gXhxD6ivmyYWUpdPDObUUrJz2hLiccz9vS5y 3cSCSlFacJa35gUylLxloVwQ4CS19B+UWu/A+rrlUXKZFjStjhGCO9+frPg/uvSA/UYs gqQl6jTHJklDbDNVDZSuvuQgoD3O5PVI4PLMGWFk0mermOufhtHXlGTC60LRpr4rBcoc J6/+sEpJnk1rn15VNcm4CvvVOpdvyrBWWkXHMN1i2LJn9GoAQlI9pkHJzGh4bZxIiiGX jvXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="I6I/jkil"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e5si158780oii.32.2020.02.10.05.01.03; Mon, 10 Feb 2020 05:01:15 -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=@kernel.org header.s=default header.b="I6I/jkil"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730436AbgBJNBB (ORCPT + 99 others); Mon, 10 Feb 2020 08:01:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:41782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729834AbgBJMkz (ORCPT ); Mon, 10 Feb 2020 07:40:55 -0500 Received: from localhost (unknown [209.37.97.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 537662085B; Mon, 10 Feb 2020 12:40:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338454; bh=Rb4+5OZy8/cgfkqgiWf+evdbzazPvvSkiaJPEhlwwHA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I6I/jkilf028Qmnt/79qqONuy8ad8Ls0554q8MCB2lQ1OPJZHoOx8slNkrWn1slqC 0q1RrJgdnqlf2vOt0vP2P5vglayP18OrjzKTjCAGMVUX7IpskcXy97yUMkzlScwVGK TvgFy0ptgNkQzjfNQXzacFYA4k1Clpn+Ya4OK2rU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Amol Grover , Daniel Borkmann , Jesper Dangaard Brouer , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= Subject: [PATCH 5.5 163/367] bpf, devmap: Pass lockdep expression to RCU lists Date: Mon, 10 Feb 2020 04:31:16 -0800 Message-Id: <20200210122439.878252174@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Amol Grover commit 485ec2ea9cf556e9c120e07961b7b459d776a115 upstream. head is traversed using hlist_for_each_entry_rcu outside an RCU read-side critical section but under the protection of dtab->index_lock. Hence, add corresponding lockdep expression to silence false-positive lockdep warnings, and harden RCU lists. Fixes: 6f9d451ab1a3 ("xdp: Add devmap_hash map type for looking up devices by hashed index") Signed-off-by: Amol Grover Signed-off-by: Daniel Borkmann Acked-by: Jesper Dangaard Brouer Acked-by: Toke Høiland-Jørgensen Link: https://lore.kernel.org/bpf/20200123120437.26506-1-frextrite@gmail.com Signed-off-by: Greg Kroah-Hartman --- kernel/bpf/devmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/kernel/bpf/devmap.c +++ b/kernel/bpf/devmap.c @@ -293,7 +293,8 @@ struct bpf_dtab_netdev *__dev_map_hash_l struct hlist_head *head = dev_map_index_hash(dtab, key); struct bpf_dtab_netdev *dev; - hlist_for_each_entry_rcu(dev, head, index_hlist) + hlist_for_each_entry_rcu(dev, head, index_hlist, + lockdep_is_held(&dtab->index_lock)) if (dev->idx == key) return dev;