Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp839739yba; Wed, 24 Apr 2019 10:25:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqycbeWN5X66YxcScklLT8SIPQOEtWKLZrF6dzmot0Sa04n5wmODCupgWGKWoIH92orueRxb X-Received: by 2002:aa7:9888:: with SMTP id r8mr34764977pfl.116.1556126753627; Wed, 24 Apr 2019 10:25:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556126753; cv=none; d=google.com; s=arc-20160816; b=a1Jzxbqtu20Q3scvHMK0bV3AcnsqGYlUybMuOo85n2WUy7kpO42YNrd+YY1SUT4IAH XHG3Q9ZNthBF8Teto2MchHh6WkmPPBe+Ny0K5Q5xdwlsRnIW2ezEdf82iNaIpZ53V0cH CygV+6HpxsaNreENm0MI/Gb5DXLjRz0GgrhWvDmOGX57gKZbVwNf4V1Iei8x1yp8bPup gAYrWrbQgTFlUWD9p68SEdydu/y9j1FufMvDenLGc3qxoqrZczUdVLwxblW9CuXhjqMw 05tPy0sKSxttS9LVexaTbg5WbsHnxhX+bNrkzK9u2yW2jCMjexmje4rSb0WAsmMcE6GU BwmA== 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=0GvIzEGgsEGSdXVltCJSpSHX+O+sfYAnJYAikK1km90=; b=hfn5n1on79vS/8f/RHHBWr8qh+SRqNPFUkxsYwQVu91+ey2TmbhCttPpgmVoHgWQhA eUeyqYOTwR6LfdQWoO58YuLAViC16yJOO9YTZmhIV77vb6OoHzjIVFwfuyYsVytu+3AJ bHBz2IPL8c1MxJ9B4Qo4bpCqF+m1hvMSmcZkTbYgNC/Nh+qL0dECJQftXNcUFhXL1byP beD4xlzNtbKIrMeyrB5ho+22s/DWeEMnsIXQLPnFPBud8Vch4AhiUoCJg1Bgcm6JjkpC HYCt/Kz2nyxVr8mh2aAuCxg8KxyG6Q/O5cvtDcC9nCUuOO6rZ3wVfejb1ROkeroLDHpa YAZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AkyXe+gi; 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 a36si18466075pgb.165.2019.04.24.10.25.37; Wed, 24 Apr 2019 10:25:53 -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=AkyXe+gi; 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 S2389798AbfDXRYA (ORCPT + 99 others); Wed, 24 Apr 2019 13:24:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:49690 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389789AbfDXRX5 (ORCPT ); Wed, 24 Apr 2019 13:23:57 -0400 Received: from localhost (62-193-50-229.as16211.net [62.193.50.229]) (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 8AFF020675; Wed, 24 Apr 2019 17:23:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556126637; bh=E6ZXEfCzatP91a+TcG2vPcCKkndFYuU2ZBYmSVblhpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AkyXe+gilARAY0q/44k2HvTlgAfmIUz0aCEFhdz4tsWTivgdBUOf7EP2lRsVYsLMx V7I0VVL6jsoWUiUxXXdhyEpm1Mf+04KifaT7ZtX4pwGBEzfqfxRBmnPP45a4yPmhDP yFindHVr/XMe7jQ+iJIiTLDGx4pgFOIQ+7fPnznk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sabrina Dubroca , "David S. Miller" Subject: [PATCH 4.9 01/44] bonding: fix event handling for stacked bonds Date: Wed, 24 Apr 2019 19:09:39 +0200 Message-Id: <20190424170841.022088215@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190424170839.924291114@linuxfoundation.org> References: <20190424170839.924291114@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Sabrina Dubroca [ Upstream commit 92480b3977fd3884649d404cbbaf839b70035699 ] When a bond is enslaved to another bond, bond_netdev_event() only handles the event as if the bond is a master, and skips treating the bond as a slave. This leads to a refcount leak on the slave, since we don't remove the adjacency to its master and the master holds a reference on the slave. Reproducer: ip link add bondL type bond ip link add bondU type bond ip link set bondL master bondU ip link del bondL No "Fixes:" tag, this code is older than git history. Signed-off-by: Sabrina Dubroca Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/bonding/bond_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -3134,8 +3134,12 @@ static int bond_netdev_event(struct noti return NOTIFY_DONE; if (event_dev->flags & IFF_MASTER) { + int ret; + netdev_dbg(event_dev, "IFF_MASTER\n"); - return bond_master_netdev_event(event, event_dev); + ret = bond_master_netdev_event(event, event_dev); + if (ret != NOTIFY_DONE) + return ret; } if (event_dev->flags & IFF_SLAVE) {