Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6248275imu; Mon, 21 Jan 2019 05:49:02 -0800 (PST) X-Google-Smtp-Source: ALg8bN66MZ65/7bOI/smvmm9U5vOtq6rymvOE+vsA3/TZ+eMuyyqHQkrhb2o4xnSPwrTUTDYKMYt X-Received: by 2002:a17:902:8484:: with SMTP id c4mr29521464plo.59.1548078542086; Mon, 21 Jan 2019 05:49:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548078542; cv=none; d=google.com; s=arc-20160816; b=HpRSxvXFaMSOgsolI6Z6oYbeegM7K9AEoCSP7+I1x4usEb2sAbJIulxuTfU3CSbVgF /c7KJjk/NttnPiGZPBPNyGUdNSp4EYK05VD43hS6XJorjyLNygH9Z4/2tBf8XFlfD5lS UITEj09oVVsRg4sqFWfgEAE6++Xgk8g95bX5DUk7Tidt0+V1S8ll6EMdrrdlG1KYb2jg rVgLtgxDsI6eHGO2FQH8AWVgCgpAelNGf9kBgxLlVDieiOL1NMHPm50WrSXeF31ABACg cQygNmN+T+oGkGEe1lG6Jdj7KHtheHSkBKkmgO3qdolrnKglitvkTsE2ggadaNE0rWRc iDnA== 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=W0TOy7tvH1LP12C8K/EoeJm0Vmp619plgyJTTHIO63Q=; b=hlr9yfafvx8N2RBmQezJ/urRROXnlUQLj3cFWKAs7Gh6WOqeiXIVSFih3vOZK4uKR2 n3N4XR1ldftTEYREyy0KGIRDE6UJxhF10eCpRi4MsLfUgfzfuZmdWak0iXeUXlWpogu0 3uWPN1A/QOGB8m34lFFUGlRCVbMVEsvjoP9r3qnUf7YE1Tw7DS/cjxzxT9FJ7I5mIUKU GUr1TS+S2y/hVHtg5IMKs8eDFvHgJxKZSGCpHt2cjSKEM1WHzeCvlrjV+BKZYJhXRPTx GUM9A+xfs/CYh+Zu8JpjysVJqBnauJ8mxGKWUICpNcnzV3rMDPdN2yv4qA422tWc4nak DpOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qSKeLH40; 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 q17si11244867pfc.198.2019.01.21.05.48.46; Mon, 21 Jan 2019 05:49:02 -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=qSKeLH40; 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 S1729523AbfAUNrN (ORCPT + 99 others); Mon, 21 Jan 2019 08:47:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:56336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729028AbfAUNrK (ORCPT ); Mon, 21 Jan 2019 08:47:10 -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 0751020861; Mon, 21 Jan 2019 13:47:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548078429; bh=v1/yHsXYlkZRXrVq7s9gm4iaXsYfpeKlZyWdZzXOA/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qSKeLH40UI6gJCP0DqnEtpEr1s9jXY1IPXJ0yzSACyQUxsqoAFDeYr5IpePQxV8Wo oEE8iwTzE9awx80TXtjjmBrSJplxhcDGLQVVeQM3O/AuwJ/3/2yrPK2qhDSgORrFmR iqYWIxQ93zuezFx4irsy63sRx/KUORz6G4ceS2/s= 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.20 028/111] bonding: update nest level on unlink Date: Mon, 21 Jan 2019 14:42:22 +0100 Message-Id: <20190121122458.925923731@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121122455.819406896@linuxfoundation.org> References: <20190121122455.819406896@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: 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 @@ -1948,6 +1948,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();