Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2750886imj; Mon, 11 Feb 2019 07:57:45 -0800 (PST) X-Google-Smtp-Source: AHgI3IZi6Bcz9Z6BZd4PDvWtLsp18ZgLp6MOSlJy8yeQaVCVRPrg2efg9eYcnzksWZHgBH5dDO0x X-Received: by 2002:a65:4904:: with SMTP id p4mr19175578pgs.384.1549900665357; Mon, 11 Feb 2019 07:57:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549900665; cv=none; d=google.com; s=arc-20160816; b=Ukm+PD8KVfVWn9F648Ef+8dVXHzJfnk3OJGfztl10E/0uBQSnZWGAPzkbb+lHYw/iu EZv2SjVt7M8DD24UlYrUdMUqBc4LASarkpVRxXaZlbyTC/v0xyPcS8FoDSYKMznRN9v/ xhzIwGlSosKqqgnQrPVsy5kyQ2/T11Jjk8d73TE4sCdNh0I2axZNsQIDn/JuSdzo79yF iy7VEb2v5WgHUYs/qy+mly4Vnyo8uFc37oQPWGbJx6I3Rsx8XpjMjj1BJXbYyNDPBuoY BpbGrB3KmTvvyhWT9bMYlOJfp5SoaGZDo2etPuCEgXGX9qM7RMBzWI657K0D6TteIc7O jYiA== 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=yVQ+BX91iu5YPIvg9gwyl7WsgnnW2Q5aaaCCp1iekcQ=; b=ID66GyaIraphSqalwV7kwQtu2bUsZKYXUceZ1s8KE3SxKMpyOguOaCbzfRwSFNOWDK 1nQcnAdQtb9pop0rjVIG8LW6i12F2J46EOvnXTLd0KJov6MAkqSX/jZOdoot0DBU3qcD Rh1e0Llor5zKEacMLFznQC1etmLu+jJn0WWGwwdpFWWwQ7sbuM2frq34IZSxNnwtGK9U 1KtWPycVqERiFxmM/OrXHwMlw/hzx03viPpiS4KJ12nhbOpub54pY0z37Z5rmAagx1rw 4QKoLN8DWbN1SrZEDEe+NEXcdonxWJAArmeMozUcneMNiS9aQFvKJcedPphRmNVAZm4O yhJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=b3kAX3DD; 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 w8si11065872pgm.467.2019.02.11.07.57.29; Mon, 11 Feb 2019 07:57:45 -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=b3kAX3DD; 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 S1731384AbfBKPzW (ORCPT + 99 others); Mon, 11 Feb 2019 10:55:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:43716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729806AbfBKOfJ (ORCPT ); Mon, 11 Feb 2019 09:35:09 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 DAC92204EC; Mon, 11 Feb 2019 14:35:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895708; bh=4q8aZ79naB27YUEaCOnlfdVV1H7W5/a1FgtimEj+n+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b3kAX3DDcAVv1v9WfJryTLJmNds65lecJOY/RyXu9PE8M9nHQf0FOh+MyH/tlKoLE td3U+4dk2JRtFJ04VjSBGRyXsTSFCoAPs2IOkCqeQetSprQbHLGQ9oMdKmNr2G/n+F dXTqs5GsQr9v3wA60wl7ywpAW6ciVB107TDlQqGg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Florian Fainelli , "David S. Miller" Subject: [PATCH 4.20 296/352] net: dsa: Fix lockdep false positive splat Date: Mon, 11 Feb 2019 15:18:43 +0100 Message-Id: <20190211141905.721438647@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marc Zyngier [ Upstream commit c8101f7729daee251f4f6505f9d135ec08e1342f ] Creating a macvtap on a DSA-backed interface results in the following splat when lockdep is enabled: [ 19.638080] IPv6: ADDRCONF(NETDEV_CHANGE): lan0: link becomes ready [ 23.041198] device lan0 entered promiscuous mode [ 23.043445] device eth0 entered promiscuous mode [ 23.049255] [ 23.049557] ============================================ [ 23.055021] WARNING: possible recursive locking detected [ 23.060490] 5.0.0-rc3-00013-g56c857a1b8d3 #118 Not tainted [ 23.066132] -------------------------------------------- [ 23.071598] ip/2861 is trying to acquire lock: [ 23.076171] 00000000f61990cb (_xmit_ETHER){+...}, at: dev_set_rx_mode+0x1c/0x38 [ 23.083693] [ 23.083693] but task is already holding lock: [ 23.089696] 00000000ecf0c3b4 (_xmit_ETHER){+...}, at: dev_uc_add+0x24/0x70 [ 23.096774] [ 23.096774] other info that might help us debug this: [ 23.103494] Possible unsafe locking scenario: [ 23.103494] [ 23.109584] CPU0 [ 23.112093] ---- [ 23.114601] lock(_xmit_ETHER); [ 23.117917] lock(_xmit_ETHER); [ 23.121233] [ 23.121233] *** DEADLOCK *** [ 23.121233] [ 23.127325] May be due to missing lock nesting notation [ 23.127325] [ 23.134315] 2 locks held by ip/2861: [ 23.137987] #0: 000000003b766c72 (rtnl_mutex){+.+.}, at: rtnetlink_rcv_msg+0x338/0x4e0 [ 23.146231] #1: 00000000ecf0c3b4 (_xmit_ETHER){+...}, at: dev_uc_add+0x24/0x70 [ 23.153757] [ 23.153757] stack backtrace: [ 23.158243] CPU: 0 PID: 2861 Comm: ip Not tainted 5.0.0-rc3-00013-g56c857a1b8d3 #118 [ 23.166212] Hardware name: Globalscale Marvell ESPRESSOBin Board (DT) [ 23.172843] Call trace: [ 23.175358] dump_backtrace+0x0/0x188 [ 23.179116] show_stack+0x14/0x20 [ 23.182524] dump_stack+0xb4/0xec [ 23.185928] __lock_acquire+0x123c/0x1860 [ 23.190048] lock_acquire+0xc8/0x248 [ 23.193724] _raw_spin_lock_bh+0x40/0x58 [ 23.197755] dev_set_rx_mode+0x1c/0x38 [ 23.201607] dev_set_promiscuity+0x3c/0x50 [ 23.205820] dsa_slave_change_rx_flags+0x5c/0x70 [ 23.210567] __dev_set_promiscuity+0x148/0x1e0 [ 23.215136] __dev_set_rx_mode+0x74/0x98 [ 23.219167] dev_uc_add+0x54/0x70 [ 23.222575] macvlan_open+0x170/0x1d0 [ 23.226336] __dev_open+0xe0/0x160 [ 23.229830] __dev_change_flags+0x16c/0x1b8 [ 23.234132] dev_change_flags+0x20/0x60 [ 23.238074] do_setlink+0x2d0/0xc50 [ 23.241658] __rtnl_newlink+0x5f8/0x6e8 [ 23.245601] rtnl_newlink+0x50/0x78 [ 23.249184] rtnetlink_rcv_msg+0x360/0x4e0 [ 23.253397] netlink_rcv_skb+0xe8/0x130 [ 23.257338] rtnetlink_rcv+0x14/0x20 [ 23.261012] netlink_unicast+0x190/0x210 [ 23.265043] netlink_sendmsg+0x288/0x350 [ 23.269075] sock_sendmsg+0x18/0x30 [ 23.272659] ___sys_sendmsg+0x29c/0x2c8 [ 23.276602] __sys_sendmsg+0x60/0xb8 [ 23.280276] __arm64_sys_sendmsg+0x1c/0x28 [ 23.284488] el0_svc_common+0xd8/0x138 [ 23.288340] el0_svc_handler+0x24/0x80 [ 23.292192] el0_svc+0x8/0xc This looks fairly harmless (no actual deadlock occurs), and is fixed in a similar way to c6894dec8ea9 ("bridge: fix lockdep addr_list_lock false positive splat") by putting the addr_list_lock in its own lockdep class. Signed-off-by: Marc Zyngier Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/dsa/master.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/net/dsa/master.c +++ b/net/dsa/master.c @@ -179,6 +179,8 @@ static const struct attribute_group dsa_ .attrs = dsa_slave_attrs, }; +static struct lock_class_key dsa_master_addr_list_lock_key; + int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp) { int ret; @@ -190,6 +192,8 @@ int dsa_master_setup(struct net_device * wmb(); dev->dsa_ptr = cpu_dp; + lockdep_set_class(&dev->addr_list_lock, + &dsa_master_addr_list_lock_key); ret = dsa_master_ethtool_setup(dev); if (ret)