Received: by 10.213.65.68 with SMTP id h4csp2126184imn; Sun, 8 Apr 2018 20:22:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+24NZMh0bTYwYWwytoJ4nSeiajm3/8QVc2gJMl6cC6LG/oTG0NuydbDlwlWcaLYjL+b59o X-Received: by 2002:a17:902:5acf:: with SMTP id g15-v6mr36161937plm.138.1523244127167; Sun, 08 Apr 2018 20:22:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523244127; cv=none; d=google.com; s=arc-20160816; b=U1gh6aocAh1qzZ6Rk+9jU2dl1R8xsXB+rAPbz6ft1cYT2PNctRyDSyf9YeHeREH/TN FwJKnelHkbB2U2qA15NGpa7f6hNn78UOwakgLl3Jv3jq6JVrDe2vWeKgBxY2TUyq3ms6 GVsX39GnNSmZ+6nhHg2lBdEuD1kQZNEunf337ky7ONzBpHUMZx/U/IFGXtecSGgyccUI CIATiGNBNQdYHfNWZRn4EnncokjdCe3rXet+Hy9ipNhnTDErjQzYEN4SMe+LXE+H9Iiq z5ww/oyZQODA6UJD8pkDP+9xs7TELpzlwNgL1aosRZcRMCYcvIzpY2DD0Zq1TMOYv2UD YsKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=CQIuigrT2KJ1iJX21XyZM1ZXbVfFM6rRFBsbInirkjw=; b=Kbz/ZeBcrpf48dmB86wKySeUUmMLiljHEhNEEzgPprQocW4v7kRiACI32ABP6FJ2R8 bYwvQ2ALtDzKHGdTZ88PVsF0s2LtDTw+GRk5R0909i28N3KpIJPSR4SjXm+7Lu/4kt3f FcDDLSwSilTocw5Am7C7Ly/J1uAnQlcY3uILGr2VzW/s1UmYaVDUI2gNrxrIjg3VqXQ8 uGQ435a9/+XF4FFPi7wlcuErXpob45mbXrJqnKzU9cFR8hliyis7k3/eLqv5H0/zbvWT xDFrRHPiAZhCjn+XI3X/mQTSFNMgJb8sZGf03auQ1XdMacMsxD3fwTbqRbPr3VuI8ZUX Ag5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=en4stN0Z; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a33-v6si13849302pld.125.2018.04.08.20.21.30; Sun, 08 Apr 2018 20:22:07 -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=@microsoft.com header.s=selector1 header.b=en4stN0Z; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752601AbeDIDSd (ORCPT + 99 others); Sun, 8 Apr 2018 23:18:33 -0400 Received: from mail-by2nam03on0112.outbound.protection.outlook.com ([104.47.42.112]:27929 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754863AbeDIAXd (ORCPT ); Sun, 8 Apr 2018 20:23:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=CQIuigrT2KJ1iJX21XyZM1ZXbVfFM6rRFBsbInirkjw=; b=en4stN0ZKpeRTgNsKKv6lS4eX6H298s2v4H4c6C6dR53SsNsH+m1YqTBqltVHcWAJ7J0ZJL+9ZkPjGDGjmV+HNRhZsXgCYkFgog0WbGE8KM21+nC6flboNKLXPViQ33cbbxcbjbWGjSN6Nre5aQxiYF/pZj0fSbVZbiBukFZZys= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1080.namprd21.prod.outlook.com (52.132.130.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:23:31 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:23:31 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Parav Pandit , Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 057/161] RDMA/cma: Check existence of netdevice during port validation Thread-Topic: [PATCH AUTOSEL for 4.14 057/161] RDMA/cma: Check existence of netdevice during port validation Thread-Index: AQHTz5iSWgd9fh3Y2UKKbXYtN/ubrA== Date: Mon, 9 Apr 2018 00:20:32 +0000 Message-ID: <20180409001936.162706-57-alexander.levin@microsoft.com> References: <20180409001936.162706-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001936.162706-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1080;7:i3KGbP1l8OZL2x8lpk6TpF5NfFv2PaDKfAYOCa78itGUlG//T9KlWMgqUNC5MoPJT6QS9Cy1BV6K4mDPj2rODBnwLfPsMSLDaAvSepzs9ClZDW68I/lqzeqjGBb0w8DvWq8J+Apv9MRuLgjWfwXxtMh9fc7RPLbwJBjkGmKpaUiklnGLWrLzlaqv0x26PLfzRqy6WTJIXk5UFGWL41Cdpotca0AAPQF/5yxlOw3UJAN4ZB2b5TZBOOiMMLr9XuJS;20:PEV/qnSk9xNqO3EdfYeweDwCmoQQAqsG3DnY2IcDvXeJoszqnelpnh/xXJ1JkGQsmPK+0BFhy9ww4mc1O32CvrRD+eIhmYDxD5w7GeA3wN2kAcy6DBj4cFeYFtD/Xql+WXBYaDiyC5oX8ERUWNxwfVDd5ww23EuwyJA1ZkJu3AA= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: f441c515-0ed4-4529-5ade-08d59db01f91 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1080; x-ms-traffictypediagnostic: DM5PR2101MB1080: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(3231221)(944501327)(52105095)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB1080;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1080; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(346002)(396003)(39380400002)(366004)(39860400002)(199004)(189003)(2501003)(5250100002)(8936002)(10090500001)(5660300001)(3660700001)(446003)(107886003)(14454004)(36756003)(6436002)(476003)(3280700002)(2616005)(11346002)(4326008)(53936002)(6512007)(22452003)(305945005)(10290500003)(316002)(102836004)(2906002)(6116002)(66066001)(6506007)(3846002)(7736002)(486006)(54906003)(110136005)(186003)(72206003)(26005)(1076002)(105586002)(2900100001)(6486002)(97736004)(478600001)(81156014)(81166006)(86612001)(8676002)(106356001)(99286004)(86362001)(76176011)(59450400001)(68736007)(25786009)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1080;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Y7DHsAsfew2u5kk1p49uKuLG5yOY5p0etptI7bTYEFjOT+9DKB8P2ejK86sPTypZGVaEQwj1Ow6SdJ01Mq6DOV4+h5q7J7AtXAu54TvZUnHTthMbbk755/xHBY1pIJZPqtwaOVgXo9PniTElmITSTbLmwKSV/o0z8BsF6wvha4eAd+0mrbMnf+tf2xHbfCZSFf/BqqLQT0V8bU/cFRjX2f3oMDVcQ3auNASzAx+ejq0qTOZ9TeHsAHHHbIuxFDCP5jim5TFtsgfPb84TkLpB6r1VkLO6porlEqjE4axz0OOzowjznp17cAhvTn6HrlvE0CW8oCoYEUpxGYicyVO4N7Ngh0rYcxCyxIBSi6XKFpyGkhrAPkrWe0KdR4UAANHIK2NKRuuzaHHZSc8oGUrU4NypskXyekirn3t0J4os2LA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: f441c515-0ed4-4529-5ade-08d59db01f91 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:20:32.6599 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1080 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Parav Pandit [ Upstream commit 00db63c128dd3daf38f481371976c24d32678142 ] If valid netdevice is not found for RoCE, GID table should not be searched with NULL netdevice. Doing so causes the search routines to ignore the netdev argument and may match the wrong GID table entry if the netdev is deleted. Fixes: abae1b71dd37 ("IB/cma: cma_validate_port should verify the port and = netdevice") Signed-off-by: Parav Pandit Reviewed-by: Mark Bloch Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/core/cma.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 6cae00ecc905..2cd9671366b0 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -624,11 +624,13 @@ static inline int cma_validate_port(struct ib_device = *device, u8 port, if ((dev_type !=3D ARPHRD_INFINIBAND) && rdma_protocol_ib(device, port)) return ret; =20 - if (dev_type =3D=3D ARPHRD_ETHER && rdma_protocol_roce(device, port)) + if (dev_type =3D=3D ARPHRD_ETHER && rdma_protocol_roce(device, port)) { ndev =3D dev_get_by_index(&init_net, bound_if_index); - else + if (!ndev) + return ret; + } else { gid_type =3D IB_GID_TYPE_IB; - + } =20 ret =3D ib_find_cached_gid_by_port(device, gid, gid_type, port, ndev, NULL); --=20 2.15.1