Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13473973ybl; Sun, 29 Dec 2019 12:46:25 -0800 (PST) X-Google-Smtp-Source: APXvYqxdZ8Uqm0rrNcH4R65ox2h0mkV4S/Cutsb7CcSi4R8F8fiB9jjSAY1UDOeb5GEZmArmza1w X-Received: by 2002:a9d:74d8:: with SMTP id a24mr73704928otl.100.1577652385673; Sun, 29 Dec 2019 12:46:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577652385; cv=none; d=google.com; s=arc-20160816; b=njuQhlMU+seYXKmzon4Vg8zBNGjoK5RIO6/IH8x7hjNCKOo7YXnyL6XS40SanBXUOK oHrOtjLtwxjK16e6emQGulb7I570dyeXoHNcE7ITJyo2+H5xQHjVgsVJtc6cQJpYixRT DPoCQoSEFaxgLOFuyUewxZAV1zSvj0ycBm/gQ9BI6FKmUNYqj/HFCEu0wC/DDSwddloA 5hnZSe2IdLD/dd9Q/b6Z+qeIayHt1OXq5jORl1uwLbvelUDfcR9kr4Phls+Ya+Y5haFC gIgD+iE7bM6z2KzNheuEXnVrxHQf3dYjLtP6ubjKHSzs0gA9yHUupHyFK9kx7eoTMIRC I+1g== 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=W2K/EAHjNAyLueIPy4pqXG1Xn55XXZ1c5fGY1MklDo8=; b=N1SWChPDb6ZMTDVZu3lSCN35XiyIrd1F6piLXL56X4PPDESYaHbkrjcI/z+R+/Ycxh CkONMS7Ieb+o4S5lufOt9G8v23knsRIzKPJFMBAMCa5ggNrrVGUuD3OYQeZVRWV8vvVU PQauQTQgiFHx4VDQYbC1lLLQA+BLAt+7Px9r4u6Ok/PE8hISUWHkJ8fRn+8RXjRx0OFT 2Ecm1rw2FhPMagX/1r/z/qktVLEWaBbdIvEMLphVSBL0Kf+cvhoId+PT2cknmxYM0kWa aKHf1FaY+QJpFHxx1leU9a9obuCavpAMVw048l73Gav29DF2GSmeF7L6Qv6G/pux7WrU 1b0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SA3d8t1I; 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 8si22816295otd.274.2019.12.29.12.46.14; Sun, 29 Dec 2019 12:46:25 -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=SA3d8t1I; 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 S1731033AbfL2RqN (ORCPT + 99 others); Sun, 29 Dec 2019 12:46:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:55618 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730206AbfL2RqH (ORCPT ); Sun, 29 Dec 2019 12:46:07 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 675E521744; Sun, 29 Dec 2019 17:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577641566; bh=q2qlQ1zu1e9Jtr0J4QDuk2XSaGdWhQDJ2Xa9AyyGR54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SA3d8t1Iy+8TE6Q/WUFmvnTYHVwSuBpuhm4vD7zZJ4J3aHTCaTd2TXKRNkCH9Bahy nP3WBSOA8be+3F4aMdKplRXWxhpz2VKvTKapeIWpNrhCR0I26AvZxOufiNNTb0TsrV mrW8SW3e8yiiZ2vO9BqxV01AWZWPD6rwarhPa9e4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ursula Braun , Karsten Graul , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.4 120/434] net/smc: increase device refcount for added link group Date: Sun, 29 Dec 2019 18:22:53 +0100 Message-Id: <20191229172709.661650133@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229172702.393141737@linuxfoundation.org> References: <20191229172702.393141737@linuxfoundation.org> User-Agent: quilt/0.66 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: Ursula Braun [ Upstream commit b3cb53c05f20c5b4026a36a7bbd3010d1f3e0a55 ] SMCD link groups belong to certain ISM-devices and SMCR link group links belong to certain IB-devices. Increase the refcount for these devices, as long as corresponding link groups exist. Signed-off-by: Ursula Braun Signed-off-by: Karsten Graul Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/smc/smc_core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index 2ba97ff325a5..0c5fcb8ed404 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -231,10 +231,12 @@ static int smc_lgr_create(struct smc_sock *smc, struct smc_init_info *ini) lgr->conns_all = RB_ROOT; if (ini->is_smcd) { /* SMC-D specific settings */ + get_device(&ini->ism_dev->dev); lgr->peer_gid = ini->ism_gid; lgr->smcd = ini->ism_dev; } else { /* SMC-R specific settings */ + get_device(&ini->ib_dev->ibdev->dev); lgr->role = smc->listen_smc ? SMC_SERV : SMC_CLNT; memcpy(lgr->peer_systemid, ini->ib_lcl->id_for_peer, SMC_SYSTEMID_LEN); @@ -433,10 +435,13 @@ static void smc_lgr_free_bufs(struct smc_link_group *lgr) static void smc_lgr_free(struct smc_link_group *lgr) { smc_lgr_free_bufs(lgr); - if (lgr->is_smcd) + if (lgr->is_smcd) { smc_ism_put_vlan(lgr->smcd, lgr->vlan_id); - else + put_device(&lgr->smcd->dev); + } else { smc_link_clear(&lgr->lnk[SMC_SINGLE_LINK]); + put_device(&lgr->lnk[SMC_SINGLE_LINK].smcibdev->ibdev->dev); + } kfree(lgr); } -- 2.20.1