Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4415121pxa; Mon, 10 Aug 2020 08:33:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxczgvVUFp3Dckh+skFzb+R4YFh+xHLgq1NzywgMSW08dCOvAEjmRZDwhKSWMPbIZzuLi/ X-Received: by 2002:a17:906:845:: with SMTP id f5mr21783338ejd.34.1597073609150; Mon, 10 Aug 2020 08:33:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597073609; cv=none; d=google.com; s=arc-20160816; b=dhYaYX0QXYmOKpfXmWI+uxbtw93+1/JYDZzyKXTU0cn8ugL+eP6d7NjT6N+0w1a2gP tr+uDKGwr2BM3/mGtotIHOWfGnzXgQwCjDa7lKlypRFU8TK86WElk3lUF94LpLQmRQQR 5sj7sK8ZnXfG9fuz+jej9RoDUOouBudJrAB1i+qGGRixwzYXuO0aMpVCgXNmuqyaZLWs cv7HtoKlhMhgKvw1iuSOTFsG+nHOELyU1m3arxrpPuyGgPH2ZhYmHi/vW448Cnw6W3uq 1o44QjN0zkGffgdDnWaXRkfPBw8kZgj32yuevjrmUGmkCd0ELVvx7jymcd3Y7w2t0y97 RvFA== 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=+juBmSVVQ9D1op+YfOpOUHjxV6bT2OdUYMNsZAwbzls=; b=bcTSwH9or6Ql45dCcvy0uTNuL9cXjr7nof0uTKEv/U9DZslNdif8UnCytZi4qeP0yT 67V5aoiHL1lm4gilTgPLf0a50/zXdvUDSd+xxP9Fpz0gT9S7FLCGGXpFaxTHOy9prKJw bF3vZ1Ts3yXH58+ZTCqtMmr2S/X3I7S62JUyTUwJChIF58kOTEGnmOd6ybQ0x259Q38j avVBJNYSyRHGG6i9AE3e2UucVGpC/7e2kELYa/ucO+VqhF6ng1wp9XjzY6VnX4f+Hkmq sRvrwgvIrIJCjjNisPHzhIxXyQ/0bntLgAtx43qBZjILfOCDxJQFc7jv1KeaenXSyg+n PyxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U+AzgNnO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d24si10878215edz.145.2020.08.10.08.33.06; Mon, 10 Aug 2020 08:33:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U+AzgNnO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729093AbgHJPce (ORCPT + 99 others); Mon, 10 Aug 2020 11:32:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:37248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729079AbgHJPaZ (ORCPT ); Mon, 10 Aug 2020 11:30:25 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 5AF7520791; Mon, 10 Aug 2020 15:30:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597073425; bh=iUtBz3wDtIp/7HNgFnqlL/txe0+7TWtlKGlPE0Ita6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U+AzgNnOCSz3U8fuIb+mG1HWRSTbxJOjji3eFfXGFOiu/VCMoU5OwfSkYK0MLEHq0 pq8SOCjH3eU8F8yIHe0X18Sx6cUfsqAKAfaY+gjx51/4atEJBmIMU8tTqHynuc/RiB 5dOeD93SBkeV2udRPsTHjXNHqEhzRNl/B+R+KzcI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ido Schimmel , Jiri Pirko , "David S. Miller" Subject: [PATCH 4.19 35/48] vxlan: Ensure FDB dump is performed under RCU Date: Mon, 10 Aug 2020 17:21:57 +0200 Message-Id: <20200810151805.943341960@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200810151804.199494191@linuxfoundation.org> References: <20200810151804.199494191@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: Ido Schimmel [ Upstream commit b5141915b5aec3b29a63db869229e3741ebce258 ] The commit cited below removed the RCU read-side critical section from rtnl_fdb_dump() which means that the ndo_fdb_dump() callback is invoked without RCU protection. This results in the following warning [1] in the VXLAN driver, which relied on the callback being invoked from an RCU read-side critical section. Fix this by calling rcu_read_lock() in the VXLAN driver, as already done in the bridge driver. [1] WARNING: suspicious RCU usage 5.8.0-rc4-custom-01521-g481007553ce6 #29 Not tainted ----------------------------- drivers/net/vxlan.c:1379 RCU-list traversed in non-reader section!! other info that might help us debug this: rcu_scheduler_active = 2, debug_locks = 1 1 lock held by bridge/166: #0: ffffffff85a27850 (rtnl_mutex){+.+.}-{3:3}, at: netlink_dump+0xea/0x1090 stack backtrace: CPU: 1 PID: 166 Comm: bridge Not tainted 5.8.0-rc4-custom-01521-g481007553ce6 #29 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-2.fc32 04/01/2014 Call Trace: dump_stack+0x100/0x184 lockdep_rcu_suspicious+0x153/0x15d vxlan_fdb_dump+0x51e/0x6d0 rtnl_fdb_dump+0x4dc/0xad0 netlink_dump+0x540/0x1090 __netlink_dump_start+0x695/0x950 rtnetlink_rcv_msg+0x802/0xbd0 netlink_rcv_skb+0x17a/0x480 rtnetlink_rcv+0x22/0x30 netlink_unicast+0x5ae/0x890 netlink_sendmsg+0x98a/0xf40 __sys_sendto+0x279/0x3b0 __x64_sys_sendto+0xe6/0x1a0 do_syscall_64+0x54/0xa0 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7fe14fa2ade0 Code: Bad RIP value. RSP: 002b:00007fff75bb5b88 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00005614b1ba0020 RCX: 00007fe14fa2ade0 RDX: 000000000000011c RSI: 00007fff75bb5b90 RDI: 0000000000000003 RBP: 00007fff75bb5b90 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00005614b1b89160 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Fixes: 5e6d24358799 ("bridge: netlink dump interface at par with brctl") Signed-off-by: Ido Schimmel Reviewed-by: Jiri Pirko Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/vxlan.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -975,6 +975,7 @@ static int vxlan_fdb_dump(struct sk_buff for (h = 0; h < FDB_HASH_SIZE; ++h) { struct vxlan_fdb *f; + rcu_read_lock(); hlist_for_each_entry_rcu(f, &vxlan->fdb_head[h], hlist) { struct vxlan_rdst *rd; @@ -987,12 +988,15 @@ static int vxlan_fdb_dump(struct sk_buff cb->nlh->nlmsg_seq, RTM_NEWNEIGH, NLM_F_MULTI, rd); - if (err < 0) + if (err < 0) { + rcu_read_unlock(); goto out; + } skip: *idx += 1; } } + rcu_read_unlock(); } out: return err;