Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6259942imu; Mon, 21 Jan 2019 06:01:31 -0800 (PST) X-Google-Smtp-Source: ALg8bN5s7BXS5Yq6S2GGA4ZhaaEEEzXRETGITEDT4Q8G3oosCoWSlDvYBEmS7kXF3Xmx5IjW2nEY X-Received: by 2002:a63:3602:: with SMTP id d2mr27715385pga.404.1548079291070; Mon, 21 Jan 2019 06:01:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548079291; cv=none; d=google.com; s=arc-20160816; b=CCub0IdZ35hWyqrnIFKDCe/Ol89N5UyZSVVN3jTTDUd5aYgFm/afXUJilfz8eACC1d s2SLDHOlJ0duepj3O278P2Mkrq4+AAAtbA2mKfnubn/wr5J/dTwptqzYlLb6xUpEnokP XbX3748gZA6plonlU5QnA4V1rBwnkHOudk+SC0H1E5VJaUii+t/BU6cOJCS/9MUfBG9w YkRifQaBYidRCVIEad4n0ZYXefoFfWZ2gBLPc00Seax5yfY1qh0vpm98unvxBLhSl4sZ wActik+9FDvhW9rhMeoyxGB0vYfelfprCQkMIxlGurd+ei8zt8xHr6ZPQYzDD7neGEpk q95w== 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=mCbMoGx7cSSynh3b86a6IQAGMiHZFPSG32jup8LAdsU=; b=UWkhH/k+wfDKZYdJBa67SscwOFYSu+c0A+9Jk3OU3dYzrHNNYyCeH5laQ03NKg/fga Uk/NS3RvU1JbfDkBkTi4cXdK/D/XVx9xF/35BEcOBRoX1x2/IC2WCWqXoW9Xp5BrQmKj EGzZT1WHbGR8SE7tMoO/LwqUB3koe23B+OwETzvJwJ7rgYQK4bx1ow1udXVC5LvaWk2s C7Hn0ixJ16jR0cYx6fwJS3XWfrCu3Oo9kdhvHN8ssGtrbMWWcyKOScccyLatnciDpo3E cpoouB5zepwrEBudE/wFup9CDqAzM98RPbqzhJOP5g4gWLqkgKd2gctfC+bTSTFOv1O1 HiCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ak3kfMct; 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 b7si12724283plb.234.2019.01.21.06.01.15; Mon, 21 Jan 2019 06:01:31 -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=ak3kfMct; 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 S1732168AbfAUN7U (ORCPT + 99 others); Mon, 21 Jan 2019 08:59:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:45280 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731776AbfAUN7T (ORCPT ); Mon, 21 Jan 2019 08:59:19 -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 93A182084C; Mon, 21 Jan 2019 13:59:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548079158; bh=spSRsRAWG8sg17XdavLPxWEHFURDOgWAaziahICidpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ak3kfMctKKwykJMcHIbRl/LjtZJyXo45VX9MjQJK0a2gF2nZnvOpVAodDz+nNV4IF GCLjlSK4wn92+X1LeeSLHGexQj1RVb64su9p5jtpI0Jm1dJ76H82HgGt2qdiuvN/vX 7VMjBVMh9roFbLvtEHAsPw13T2oWcn5RlOsPbpr4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Willem de Bruijn , "David S. Miller" Subject: [PATCH 4.19 28/99] bonding: update nest level on unlink Date: Mon, 21 Jan 2019 14:48:20 +0100 Message-Id: <20190121134914.970613365@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121134913.924726465@linuxfoundation.org> References: <20190121134913.924726465@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.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Willem de Bruijn [ Upstream commit 001e465f09a18857443489a57e74314a3368c805 ] A network device stack with multiple layers of bonding devices can trigger a false positive lockdep warning. Adding lockdep nest levels fixes this. Update the level on both enslave and unlink, to avoid the following series of events .. ip netns add test ip netns exec test bash ip link set dev lo addr 00:11:22:33:44:55 ip link set dev lo down ip link add dev bond1 type bond ip link add dev bond2 type bond ip link set dev lo master bond1 ip link set dev bond1 master bond2 ip link set dev bond1 nomaster ip link set dev bond2 master bond1 .. from still generating a splat: [ 193.652127] ====================================================== [ 193.658231] WARNING: possible circular locking dependency detected [ 193.664350] 4.20.0 #8 Not tainted [ 193.668310] ------------------------------------------------------ [ 193.674417] ip/15577 is trying to acquire lock: [ 193.678897] 00000000a40e3b69 (&(&bond->stats_lock)->rlock#3/3){+.+.}, at: bond_get_stats+0x58/0x290 [ 193.687851] but task is already holding lock: [ 193.693625] 00000000807b9d9f (&(&bond->stats_lock)->rlock#2/2){+.+.}, at: bond_get_stats+0x58/0x290 [..] [ 193.851092] lock_acquire+0xa7/0x190 [ 193.855138] _raw_spin_lock_nested+0x2d/0x40 [ 193.859878] bond_get_stats+0x58/0x290 [ 193.864093] dev_get_stats+0x5a/0xc0 [ 193.868140] bond_get_stats+0x105/0x290 [ 193.872444] dev_get_stats+0x5a/0xc0 [ 193.876493] rtnl_fill_stats+0x40/0x130 [ 193.880797] rtnl_fill_ifinfo+0x6c5/0xdc0 [ 193.885271] rtmsg_ifinfo_build_skb+0x86/0xe0 [ 193.890091] rtnetlink_event+0x5b/0xa0 [ 193.894320] raw_notifier_call_chain+0x43/0x60 [ 193.899225] netdev_change_features+0x50/0xa0 [ 193.904044] bond_compute_features.isra.46+0x1ab/0x270 [ 193.909640] bond_enslave+0x141d/0x15b0 [ 193.913946] do_set_master+0x89/0xa0 [ 193.918016] do_setlink+0x37c/0xda0 [ 193.921980] __rtnl_newlink+0x499/0x890 [ 193.926281] rtnl_newlink+0x48/0x70 [ 193.930238] rtnetlink_rcv_msg+0x171/0x4b0 [ 193.934801] netlink_rcv_skb+0xd1/0x110 [ 193.939103] rtnetlink_rcv+0x15/0x20 [ 193.943151] netlink_unicast+0x3b5/0x520 [ 193.947544] netlink_sendmsg+0x2fd/0x3f0 [ 193.951942] sock_sendmsg+0x38/0x50 [ 193.955899] ___sys_sendmsg+0x2ba/0x2d0 [ 193.960205] __x64_sys_sendmsg+0xad/0x100 [ 193.964687] do_syscall_64+0x5a/0x460 [ 193.968823] entry_SYSCALL_64_after_hwframe+0x49/0xbe Fixes: 7e2556e40026 ("bonding: avoid lockdep confusion in bond_get_stats()") Reported-by: syzbot Signed-off-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/bonding/bond_main.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1947,6 +1947,9 @@ static int __bond_release_one(struct net if (!bond_has_slaves(bond)) { bond_set_carrier(bond); eth_hw_addr_random(bond_dev); + bond->nest_level = SINGLE_DEPTH_NESTING; + } else { + bond->nest_level = dev_get_nest_level(bond_dev) + 1; } unblock_netpoll_tx();