Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp698158pxv; Thu, 22 Jul 2021 09:59:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4rOJN7YZmY4WpJKHUzexVAszLqTT03SpCZL1GBY7dU5s2H0NbgT8fXwEd2tRV5lRgnVtF X-Received: by 2002:a05:6402:711:: with SMTP id w17mr666732edx.233.1626973197451; Thu, 22 Jul 2021 09:59:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626973197; cv=none; d=google.com; s=arc-20160816; b=qhQzDv8SLjwDkCfSsm9jCEoe+Q976HioPbO1eB9ZgdeR6k/LtbLcSjYzdaK63qskVc caoQ0LcjegrPquqD65SXiYcQs4Lr1uPkar1LEUp3x3Opj5WOTy/9HDts/uiO61tC6VJ6 YpwS4GTsm985rSV5BmwUgbD7Rnk798sMiwBkbHALKfuTMdBujWhZ/ksJpvD9wvnc+EAr PQRB3sEY4ENAfm2k8Vi4PCy0gadhk8c/U683T11dfo2LeT+5lwksHv9vsW8N+zgV7ylZ gda8GPblgv22PL0cSgGAPzQ/162f0G4nQWWdAPvpsWWUg9SsoE2zyQ2xAAD8pPd0iYFG K8BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3yIKOC67zm7lcj+LcsQ/82jhr03s0dFECvZfuWfV4/8=; b=vFH3ae3ETCD3AesFIV9wMTiEZwQuuBngNeVBbRy5eJE3MMeyGTQqjY7k5d4YrYnkEz zT5J3ZtNmTgPBefKiAw4GJYxeBJEjZpnN7S1ao9vIlYR5+1fSNxhZw7A1O5L9lXc5Jy+ CsjbT4Ltcn/YMChPUPcirGoOtc4c8kMa7I4phRgKMqe/LcCThDH72eX0raz4bXztwuE7 NXRtDZ9V41w1HWzWgEKYxTNE5doLa1lozoc+9JWTCQ5aS3yOwgzwNQYQAVy9lbBdwHbn VeRTcRSDudWQlRmnUy0jpQaE9neC9c8jOlUhiEuYu0k6aRhUsMHUqab/Y+spKw9KmyO4 Z8Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wos+aayw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gv16si30822309ejb.111.2021.07.22.09.59.33; Thu, 22 Jul 2021 09:59:57 -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=@linuxfoundation.org header.s=korg header.b=wos+aayw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235048AbhGVQOG (ORCPT + 99 others); Thu, 22 Jul 2021 12:14:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:43670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235319AbhGVQJJ (ORCPT ); Thu, 22 Jul 2021 12:09:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 40C5861DD1; Thu, 22 Jul 2021 16:49:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626972546; bh=AjX/28Op4hCXdCIy2nXmH/R1DvTpLUzb/0GfhETzCIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wos+aaywIuCn6QnnwiYVwxacyU5HUfjLVM6sGAoD3XBbOifPhgUG6ODD758BLsEss 1/19i/TwKCqOqlbzaYBdAhpYfqQGH6oWQ9vLJQXmUixR/2medRWE9Qfs7ON9h/Jm2c 1JURUP+CMrpPq8tWwvut8JDuagxLn9Yk5XRfkmdY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vasily Averin , Florian Westphal , Pablo Neira Ayuso Subject: [PATCH 5.13 116/156] netfilter: ctnetlink: suspicious RCU usage in ctnetlink_dump_helpinfo Date: Thu, 22 Jul 2021 18:31:31 +0200 Message-Id: <20210722155632.121098126@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210722155628.371356843@linuxfoundation.org> References: <20210722155628.371356843@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vasily Averin commit c23a9fd209bc6f8c1fa6ee303fdf037d784a1627 upstream. Two patches listed below removed ctnetlink_dump_helpinfo call from under rcu_read_lock. Now its rcu_dereference generates following warning: ============================= WARNING: suspicious RCU usage 5.13.0+ #5 Not tainted ----------------------------- net/netfilter/nf_conntrack_netlink.c:221 suspicious rcu_dereference_check() usage! other info that might help us debug this: rcu_scheduler_active = 2, debug_locks = 1 stack backtrace: CPU: 1 PID: 2251 Comm: conntrack Not tainted 5.13.0+ #5 Call Trace: dump_stack+0x7f/0xa1 ctnetlink_dump_helpinfo+0x134/0x150 [nf_conntrack_netlink] ctnetlink_fill_info+0x2c2/0x390 [nf_conntrack_netlink] ctnetlink_dump_table+0x13f/0x370 [nf_conntrack_netlink] netlink_dump+0x10c/0x370 __netlink_dump_start+0x1a7/0x260 ctnetlink_get_conntrack+0x1e5/0x250 [nf_conntrack_netlink] nfnetlink_rcv_msg+0x613/0x993 [nfnetlink] netlink_rcv_skb+0x50/0x100 nfnetlink_rcv+0x55/0x120 [nfnetlink] netlink_unicast+0x181/0x260 netlink_sendmsg+0x23f/0x460 sock_sendmsg+0x5b/0x60 __sys_sendto+0xf1/0x160 __x64_sys_sendto+0x24/0x30 do_syscall_64+0x36/0x70 entry_SYSCALL_64_after_hwframe+0x44/0xae Fixes: 49ca022bccc5 ("netfilter: ctnetlink: don't dump ct extensions of unconfirmed conntracks") Fixes: 0b35f6031a00 ("netfilter: Remove duplicated rcu_read_lock.") Signed-off-by: Vasily Averin Reviewed-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nf_conntrack_netlink.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c @@ -218,6 +218,7 @@ static int ctnetlink_dump_helpinfo(struc if (!help) return 0; + rcu_read_lock(); helper = rcu_dereference(help->helper); if (!helper) goto out; @@ -233,9 +234,11 @@ static int ctnetlink_dump_helpinfo(struc nla_nest_end(skb, nest_helper); out: + rcu_read_unlock(); return 0; nla_put_failure: + rcu_read_unlock(); return -1; }