Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3101097ybi; Thu, 18 Jul 2019 21:03:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3dMxB6xHRH0vun2MsvxnnlRc3etEV5tXiWjIARTodsWYnzveRRT33S2ts2QycGWyHoXh4 X-Received: by 2002:a65:5c4b:: with SMTP id v11mr8677140pgr.62.1563508996187; Thu, 18 Jul 2019 21:03:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563508996; cv=none; d=google.com; s=arc-20160816; b=v1zSO/XvCLcKWJCjyy2UCyKWxCFJpclDUNjE2tzZT2qr25tfEqdR63Oal47yGZufvm oStqEirBQe80rRzwLoPoNuJivEYNbO3hX2ZmL2BcTbDAwh1CciqnGdPS2lka3+5IGxga yg18UfwiZwRgWWrHtrFkbUiq1Nqvqzuf08fHHe91Hw/ZNx7n3Z9CyiakLO0bR96gHSRf Gj8qfq0cfrwF2HvdZsCmfTScA9quxLUU8dU25rFTDJJgjjdu+/mdiom/5cxVajN+F+FJ L3BNDMs0XbJux4mkJNlQin5QOb7K8C9le5T7JGNFnc7bpR+TNKdr7Gp3Cr/eIHsOy80b iY0g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uW23G5uWZnfMdJtEYKIo+DcHvE7QX60aDKsb70Bew0o=; b=Kub+tjmMnpQAwe6BuqIeWeAUWhpClciwTztr49CG9XWzYNn7xtw96o37nJo0uAbWJq uOyCvtdJ3jrACX0GInMXZFztB/P4zQ9Lw3aoZz2sr4ZhKe1G1ZDmCOdKXf1ojSgSd7IV uFVKNJzyc/Um9o2R7cBL2pNpu3TRu5SzAct6BrrFKbpBznFSPol6onaMhnzsP5KPy/2K 5fOrxRaLtK+5zqIy4lbdIw9AkEZ2VxvU3A5ZMkmd36PNd1NAZZlRJkKSFfUV/uGBsqiR mgr8QcJX18xtLc8CLqkp+WvUBNkNRKAKULA4Y5YEIV/1dMaXfwuB6Diu0mLZnTZWJrpa qgRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mCVa+NvS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h12si484707pjq.63.2019.07.18.21.03.00; Thu, 18 Jul 2019 21:03:16 -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=mCVa+NvS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729765AbfGSEB6 (ORCPT + 99 others); Fri, 19 Jul 2019 00:01:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:33488 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727273AbfGSEBp (ORCPT ); Fri, 19 Jul 2019 00:01:45 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 291BB21851; Fri, 19 Jul 2019 04:01:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563508905; bh=V4huZNzy8HgUqUG9Hs18Y4DPLc1zQdIPvTrO6il0Jp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mCVa+NvSuDYvSIZZItDuyhIp90cmgKhxrHouR9TwJvrujabTZ2BqW0ICBIaYl7iZ+ wtVuAH61AdhNJVnOHqf/FAUVSiImqrIRyGF1LyvchP/ipBWzGXqP1g+Dl6gl6gV2l2 zI8XRnwOMWOuOClduApluTEQY6ilRon3N+Ps+ndA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Aya Levin , Feras Daoud , Saeed Mahameed , Sasha Levin , netdev@vger.kernel.org, linux-rdma@vger.kernel.org Subject: [PATCH AUTOSEL 5.2 150/171] net/mlx5e: IPoIB, Add error path in mlx5_rdma_setup_rn Date: Thu, 18 Jul 2019 23:56:21 -0400 Message-Id: <20190719035643.14300-150-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190719035643.14300-1-sashal@kernel.org> References: <20190719035643.14300-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aya Levin [ Upstream commit ef1ce7d7b67b46661091c7ccc0396186b7a247ef ] Check return value from mlx5e_attach_netdev, add error path on failure. Fixes: 48935bbb7ae8 ("net/mlx5e: IPoIB, Add netdevice profile skeleton") Signed-off-by: Aya Levin Reviewed-by: Feras Daoud Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c index 9ca492b430d8..603d294757b4 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c @@ -698,7 +698,9 @@ static int mlx5_rdma_setup_rn(struct ib_device *ibdev, u8 port_num, prof->init(mdev, netdev, prof, ipriv); - mlx5e_attach_netdev(epriv); + err = mlx5e_attach_netdev(epriv); + if (err) + goto detach; netif_carrier_off(netdev); /* set rdma_netdev func pointers */ @@ -714,6 +716,11 @@ static int mlx5_rdma_setup_rn(struct ib_device *ibdev, u8 port_num, return 0; +detach: + prof->cleanup(epriv); + if (ipriv->sub_interface) + return err; + mlx5e_destroy_mdev_resources(mdev); destroy_ht: mlx5i_pkey_qpn_ht_cleanup(netdev); return err; -- 2.20.1