Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp862107yba; Wed, 24 Apr 2019 10:48:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwQUs7Mxhu0XYGb2xmq2Ee/9b6YYySc8dz1uft9+1imWXcnK7JX5OWWvlv/XVVNQ8rMN2D X-Received: by 2002:a65:6688:: with SMTP id b8mr9968306pgw.81.1556128101602; Wed, 24 Apr 2019 10:48:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556128101; cv=none; d=google.com; s=arc-20160816; b=fa3QTG7B6QcdUI1z4du8x1oKiQEu3siJo/b24auYzJ7gkABF3CzylYiZOwzRLYRaNB JljfPCfmrh6cm16l5PvrCWRAzG+TuvitIT6tOCSYGuImDtVStH2QbMgPZ3kcArVkpQmA bhIMeYYQD13WAPwPQvrgHFjcAkL8YGcFESQHiNC1nx5h/bpMtGSFGYjbwDHNUmH/T2Mk Lktk0X8SC+h5cqsT6Aka/zHT3VicO24P7gqCRkZ3EfJ63U3DtrFlmCDqi+qC5HF5XTgE DDALScDSp2wEbv/F4TJcgHbukWqRZjyMPJV7k2hDyGKAUzkBXlJE5pCijgbDk65btC6/ 5KxA== 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=grBQycqch4+MRVcnQ0ls3qjGFR+Ok7F7Hn6q1A6l1Mg=; b=cvzdcdh5sAc2vXrAKh2/bumRwyoB+UM+5bmz+SuYo6iYRaIY7HfwGK0ujESEKuJD2E 5J+FkKxQ9WVarNbvKcMAIJQKm31GeUr3zi7anRan3OJm+MUYodLwr9hMXyoL9mPyps8J HBswbteGrJTVYI0V4EOEgvzA6+rkFxrD4PzlXiL1k8+eDTd41gA1G+sxMd/PNIWNS511 9NvBKW6X7NFKFL1DTAVujPwbPd4aK14ifTmmz3RGCfNPpntDfnduA4R9yxU0SV4tqWKQ 8jQsksGF5Rz7xywkiDaTPgm0yS3KHv8WmKXmsd8Xkjbv3yNpK4fqpRKFDaKll4Vgom5Z acqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PcmiJvhz; 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 o12si19550755plk.310.2019.04.24.10.48.06; Wed, 24 Apr 2019 10:48:21 -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=PcmiJvhz; 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 S2391894AbfDXRpT (ORCPT + 99 others); Wed, 24 Apr 2019 13:45:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:60592 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391044AbfDXRdf (ORCPT ); Wed, 24 Apr 2019 13:33:35 -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 9A0CD2054F; Wed, 24 Apr 2019 17:33:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556127214; bh=nwvbiVZH5kS4HxXVX8OS5u+d4I6uHw15UCBqenIF13c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PcmiJvhzAVe0N4yGEb/CZGnkU2MZTb6PttwoVaMZMCGsAb8yIoMvOYP+tcY2UUT/U X/CdK3AbKC4YLNO9FQE0f2LWq3yQkxKl3oh1SqWfS0K0FzDOTskRbw4qZF0PxiSdMI ZLQjoBkppx0v+sNmRKhze+YBLZC6ZPQDJThAO4rw= 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 5.0 001/115] bonding: fix event handling for stacked bonds Date: Wed, 24 Apr 2019 19:08:57 +0200 Message-Id: <20190424170924.965996081@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190424170924.797924502@linuxfoundation.org> References: <20190424170924.797924502@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 @@ -3214,8 +3214,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) {