Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3300161ybb; Tue, 31 Mar 2020 02:24:46 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtMU3Om/oIGxu4dpdXGddVl91uPJ6erk+C9bJpj54auWCzXhB/OqUJ9AaqjFOabp7yHJbAz X-Received: by 2002:aca:aac1:: with SMTP id t184mr1439766oie.14.1585646685989; Tue, 31 Mar 2020 02:24:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585646685; cv=none; d=google.com; s=arc-20160816; b=ShMpiAy7z22sciHziuHOTzNsYOUBpn+uZ31x0gxl69y1PSPVgQBlYaTOvRWFySexuV 7c6AGaSmHeOAynPEQfRoy7h+c7xSjyH2NckKcv3izupULPLJQaUl9E9B5i7HItYg70ty gtT+4U19EhXXZTvHWnhY0JCCDhHpgqfGp0jdERp8b5Ovj+wUPTAhNVQiXMQRAJfIFfL3 5xebt4eZ86P5epHAsjSnd5kZH07FCvWqYK/msZjFzleW/0YJJNGtcgitn8PHZHhzAB+r YiEIe0eiK7GjeXbJI8bTq9cfiD1Fii/rp8Y4mAHuau2ka5kVIOyjRkm4lWzwY6lxP7EK hUmw== 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=ucAiGUJz/l7OyS6/WifezMXnNra130UAuaiqm8yoqL0=; b=RUFCTrRY/Ab1ILDPJpW+dB0gnJJGxpwT+oDyuQRTBzW5MEKF3p3PUcwXqu8gNiJtb/ mLSctcPjoTlNdytkzoNnybCr54hy6IZ4TcArCuLnEcg+DL5e/VrpoznUWXVs8y5lAdLg 0C0aPCmHmSleluu4mlHNtNyyXaIa6SBR+/BMLbeOnxv02tvFQZQ/mINs1wdnltLNpXw6 c2dP5m6zoypvosvyCGrR+10HdwEs9pIkIZSero+o2X8wCjj6m9ut44oFMWoEQzTHZGa1 aw/EWitVmQu4gFPWPOvpQ8rDMv0EHJZpwLwmi8W2qV7SznxToz2q4806z+EiOmoAhcx3 MgWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="BQ531U7/"; 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 l22si5564434otd.53.2020.03.31.02.24.34; Tue, 31 Mar 2020 02:24:45 -0700 (PDT) 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="BQ531U7/"; 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 S1730261AbgCaJBp (ORCPT + 99 others); Tue, 31 Mar 2020 05:01:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:40996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730376AbgCaJBn (ORCPT ); Tue, 31 Mar 2020 05:01:43 -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 755A320848; Tue, 31 Mar 2020 09:01:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585645302; bh=1B1aebWkCEYVkaxkqB7iz+P4KZW79djIflH1OP/2ues=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BQ531U7/PYC2oN4nQjDhWG6iwva450bIEzB0/Jdj+dyOJQ5o4vLjwvM/w0qZwXMMp b1y8equ1Q/nWfmJcBAdg+Ftjfzmu2Y3xnbasdkyILwxjKebZCra+bJi6HYAG9il2T8 wx8N7jah4A7cprD0XxcrRJraFLj1efM85/zgeM08= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qian Cai , David Ahern , "David S. Miller" Subject: [PATCH 5.5 012/170] ipv4: fix a RCU-list lock in inet_dump_fib() Date: Tue, 31 Mar 2020 10:57:06 +0200 Message-Id: <20200331085425.441188487@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200331085423.990189598@linuxfoundation.org> References: <20200331085423.990189598@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: Qian Cai [ Upstream commit dddeb30bfc43926620f954266fd12c65a7206f07 ] There is a place, inet_dump_fib() fib_table_dump fn_trie_dump_leaf() hlist_for_each_entry_rcu() without rcu_read_lock() will trigger a warning, WARNING: suspicious RCU usage ----------------------------- net/ipv4/fib_trie.c:2216 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 ip/1923: #0: ffffffff8ce76e40 (rtnl_mutex){+.+.}, at: netlink_dump+0xd6/0x840 Call Trace: dump_stack+0xa1/0xea lockdep_rcu_suspicious+0x103/0x10d fn_trie_dump_leaf+0x581/0x590 fib_table_dump+0x15f/0x220 inet_dump_fib+0x4ad/0x5d0 netlink_dump+0x350/0x840 __netlink_dump_start+0x315/0x3e0 rtnetlink_rcv_msg+0x4d1/0x720 netlink_rcv_skb+0xf0/0x220 rtnetlink_rcv+0x15/0x20 netlink_unicast+0x306/0x460 netlink_sendmsg+0x44b/0x770 __sys_sendto+0x259/0x270 __x64_sys_sendto+0x80/0xa0 do_syscall_64+0x69/0xf4 entry_SYSCALL_64_after_hwframe+0x49/0xb3 Fixes: 18a8021a7be3 ("net/ipv4: Plumb support for filtering route dumps") Signed-off-by: Qian Cai Reviewed-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/fib_frontend.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -997,7 +997,9 @@ static int inet_dump_fib(struct sk_buff return -ENOENT; } + rcu_read_lock(); err = fib_table_dump(tb, skb, cb, &filter); + rcu_read_unlock(); return skb->len ? : err; }