Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp866014yba; Wed, 24 Apr 2019 10:52:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqy89DerWHxw3pAn7Hc35f6/RorTlmVqhba8JH0TrFHZzQq/6qYujkOb6ULuTEci+6vP1nG0 X-Received: by 2002:a63:6849:: with SMTP id d70mr31012315pgc.21.1556128355376; Wed, 24 Apr 2019 10:52:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556128355; cv=none; d=google.com; s=arc-20160816; b=cc6wDJ9Vq6lAhP3L7fvc/wIzd5/4w2iH3wbPFtMnoMJXfBv/TmcNKt6H6SBVC36Aj/ VoOOGYVOII9OdnEC70K8Qze3H6Mu+D3MN9KbjIDZ//mETa+5U2HgOkGsmYP83AJ8oChL zGxax+lB0NAF9mS5wa6g1WzqlZUvW9PFOnwaj5/cKJjxAZuBoC/Z0/3uMomWnPyYhcTH GWH96xO1aK3X01ml2pDdTRx/pgqQeZJErhXAmOyD3S2SQwGfF1fcrcweNtTwCXCIam1s TjeJ7bEazSgQ2PWNXsOofi9ygU/YlVBR2AJ8uEo5gQWQfAKJcLw+uRgQZBt4prQyrPmv oyTw== 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=6px2CSyiQPoEAdOWolCfBXOYE/mGtzl6RRVQgimCEr8=; b=Qkhi7N1jhRSoUXBszG6PJeKi6WxraiqDvXep1DUVYOmFOtBCgsZas8gpHcLjwNjkFB 3jnpRLKJfvQwSTsWcg/lT6f5rX8kd+WNPmdZ7MnBCXRTf/gWGq+j9ihWn3B57jwWIxL3 BpJ/komzlWtzx+7wYmnqroBlQIcAuax/f0ZySZqCmdU7yQfV/0m69dZqCUjfinj9xaV+ MhhZ4Sq/7HAwV4G5yWtN5CBiJjbjt8ug0wc4t9/U7xUS2JH1hhwkF0u7OGLdFaRhEOBs k9cndtZoqo21JpMpvWqv1w1/LBXV+3WLw01azsrgArvQbKQHvHoF/oPq6/8Y/OMSLFS8 Z/dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qFVHgFrX; 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 v77si20000220pfa.219.2019.04.24.10.52.19; Wed, 24 Apr 2019 10:52:35 -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=qFVHgFrX; 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 S2390391AbfDXR3Y (ORCPT + 99 others); Wed, 24 Apr 2019 13:29:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:55650 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390050AbfDXR3U (ORCPT ); Wed, 24 Apr 2019 13:29:20 -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 8FF3A2054F; Wed, 24 Apr 2019 17:29:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556126960; bh=aGRFe0HcIB613C85TNsgjSBUr6KvgpVTIziqUNaqMg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qFVHgFrXXdgnJSS7RRdRdFySeWZPW8KT7Kt+7VwKgNvNHSQ/zGQ9p62tm62kGC3Uc i+BNfsrcvauea4lLdWVlaqJhxAbO1KB0YuINnM+efbc2FBeZVBfIranQ0dizE/mVRb TnljEFwBnBa/BWQTHQcrMs3MzPff1AABnBwRpbg0= 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.19 01/96] bonding: fix event handling for stacked bonds Date: Wed, 24 Apr 2019 19:09:06 +0200 Message-Id: <20190424170919.926231805@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190424170919.829037226@linuxfoundation.org> References: <20190424170919.829037226@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 @@ -3198,8 +3198,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) {