From patchwork Mon Jun 11 07:20:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalderon, Michal" X-Patchwork-Id: 10457285 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C8DE460467 for ; Mon, 11 Jun 2018 07:20:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B427027F93 for ; Mon, 11 Jun 2018 07:20:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8B1B27FA3; Mon, 11 Jun 2018 07:20:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0344027F93 for ; Mon, 11 Jun 2018 07:20:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754066AbeFKHUs (ORCPT ); Mon, 11 Jun 2018 03:20:48 -0400 Received: from mail-dm3nam03on0088.outbound.protection.outlook.com ([104.47.41.88]:6320 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754053AbeFKHUr (ORCPT ); Mon, 11 Jun 2018 03:20:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tDNmGrrgsD78dUQah/ePOhRGDSD6BulPY7DD6iXCsrI=; b=Y4TrQTW1sFxgP5tTwTnn4/CO2ALcunBgCwEOW4GuSaDPF03RpSItu3oujD+Ls9L2ydf7hLoRjuRs1rwXSkeVq1Tw2wXWWFIAz62Cp8n62xJ3iiTU/tWpbpMcqzlMDZG4R71vda7QVVqbUJ99oSTTiqcLvPGiW4m5cuDk6mgZcp4= Received: from BY2PR07CA0025.namprd07.prod.outlook.com (2a01:111:e400:7bff::20) by CY4PR07MB3175.namprd07.prod.outlook.com (2603:10b6:903:cf::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.16; Mon, 11 Jun 2018 07:20:45 +0000 Received: from DM3NAM05FT037.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::200) by BY2PR07CA0025.outlook.office365.com (2a01:111:e400:7bff::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.841.18 via Frontend Transport; Mon, 11 Jun 2018 07:20:45 +0000 Authentication-Results: spf=pass (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=cavium.com; Received-SPF: Pass (protection.outlook.com: domain of cavium.com designates 50.232.66.26 as permitted sender) receiver=protection.outlook.com; client-ip=50.232.66.26; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by DM3NAM05FT037.mail.protection.outlook.com (10.152.98.150) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P256) id 15.20.863.7 via Frontend Transport; Mon, 11 Jun 2018 07:20:44 +0000 Received: from lb-tlvb-michal.il.qlogic.com.com (10.185.6.89) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.347.0; Mon, 11 Jun 2018 00:20:42 -0700 From: Michal Kalderon To: , , CC: , , Michal Kalderon , Ariel Elior Subject: [PATCH for-rc] RDMA/qedr: Fix Null pointer dereference when running over iWARP without RDMA-CM Date: Mon, 11 Jun 2018 10:20:20 +0300 Message-ID: <20180611072020.4046-1-Michal.Kalderon@cavium.com> X-Mailer: git-send-email 2.14.3 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:50.232.66.26; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39850400004)(346002)(39380400002)(396003)(376002)(2980300002)(438002)(189003)(199004)(48376002)(77096007)(26005)(486006)(51416003)(186003)(336012)(2616005)(476003)(305945005)(126002)(104016004)(356003)(4326008)(5660300001)(47776003)(6666003)(36756003)(107886003)(50226002)(106466001)(8676002)(50466002)(8936002)(1076002)(69596002)(81166006)(81156014)(2906002)(110136005)(106002)(54906003)(575784001)(86362001)(16586007)(2201001)(316002)(72206003)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3175; H:CAEXCH02.caveonetworks.com; FPR:; SPF:Pass; LANG:en; PTR:50-232-66-26-static.hfc.comcastbusiness.net; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM05FT037; 1:LZd02oGag4nEkcH7OdaSJpD3pTAXPRj0ok4iaARlhlbv29gX0MIc2ih6iD/EWGTKhEOqzy3vt3wQRyJA7x+58SmJAOlCxdat8O4dU6ISEzVVO90on4Yv0nMokdbq+fQi X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:CY4PR07MB3175; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3175; 3:G6dyV7HEIlZJBygsZMLBsNTAEC5pSUIpFkqB7BLh9Wu1pG0o+yAvf5xzDYV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TC7FHlNIhrxrLmltzx6l1xfF4q2eDI0OeSdFJ7HDGsZi0Bci7ksCZfFi8FUE2OjO1pKEyGQp290RdGGmM+QdMy63/J49/h0t+rathKGRwqHIRLSOKXCjxKNESrQ9lTMsFGG0uDoYOfz9zQiOTOoLFyreMS+/rcjCJFEpJ1jPRrILF5s0kd+AmNiWbVhNZmjzdXcfFcMYlm2iX7KDMDB1qyC2t3+ULdikunQ6xqCEtSMv6fhDm9yvD9YgPzzlwskCRkSOcas0q01ep62Nwa8jLiMUV1tRfqrUUizMkN+kWVXzW3iGUF8o3xPlZw+MJrCk7uSyeAxQQw+dbZMrFZzv+ff72/WyIXxJVwAm/bDkOeZ8PH2C509gC3BvbnyuOX+/2tjOpj30 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93004095)(3002001)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:CY4PR07MB3175; BCL:0; PCL:0; RULEID:; SRVR:CY4PR07MB3175; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3175; 4:0jk81PAVdAFHM0/+kSAeBhbGMd5gxF6nPzlzl6K+IA9Eow5GAtTgax9OJq3JJlv4Hu7WqtURPFLngzLfs/9u54wV6A/FTypncfPwnpImPfRBBcdBvyHd45r5TCB568KK3a3sYUuEZnwSpuq13jVZi/jcYpyeh7x1W+706yEdDdVezIRKMo2POhNAcQlXPuEuOVco4RMFmapUq+8DEueUoHsr/yl3KBJr1kKmTnDvr0+zp/merqSvBpselYun8gbkt2PX92w4Hafzh1yf4Sax0Q== X-Forefront-PRVS: 070092A9D3 X-Microsoft-Exchange-Diagnostics: =?us-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mZA5mXbbytUlw6e1FhwCzHarZNUTwhdaTeW72qkhXvR4ghEcVdlWj5MsMxJSVWNRpXqNTmZcGRpTlbVPCjf/bJU+VG4k93l5yr7Mmwm41i1TTJ7L4ZneyARvj3pSYrc=; 24:cAn7IJTbgaYpZFiarTnxQ8yVbb0fFDR13HW90Zk0vZHULRqZNISc5o/s6YClTs9hnzOw9En+P2tSKK+i8TMj5qY0ctnNRdiprGDUNPmmXkY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3175; 7:IcmXxoiKI9kRAqEdO060c1snJUavzQ6YgdPs8DVHjovhBy2LIhnqbelNaYoiR7GQES72euAShKLbM6mcH8Spo44rNNZy24r7MM+Dkv4Bs7h9PsZsfKr1DZYjkV7J324VMQxNBbw/jTlI5U4fjil9Dy4g4/7xQb3n5v6g1BNFnAWSWV5ZPaztx7QkW+8+eKkpPkJMCKg6al8ohS8RSQ7wNQcHx+2QSiC1M6X7IjW2He5mhW1Jf+RXzlkdglOLl8pU X-MS-Office365-Filtering-Correlation-Id: 9e2dd0d7-16ca-4daf-fab1-08d5cf6bd8fc X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2018 07:20:44.8732 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9e2dd0d7-16ca-4daf-fab1-08d5cf6bd8fc X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=711e4ccf-2e9b-4bcf-a551-4094005b6194; Ip=[50.232.66.26]; Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3175 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some RoCE specific code in qedr_modify_qp was run over an iWARP device when running perftest benchmarks without the -R option. The commit 3e44e0ee0893 ("IB/providers: Avoid null netdev check for RoCE") exposed this. Dropping the check for NULL pointer on ndev in qedr_modify_qp lead to a null pointer dereference when running over iWARP. Before the code would identify ndev as being NULL and return an error. Fixes: 3e44e0ee0893 ("IB/providers: Avoid null netdev check for RoCE") Signed-off-by: Ariel Elior Signed-off-by: Michal Kalderon --- drivers/infiniband/hw/qedr/verbs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c index 3f9afc0..f86223a 100644 --- a/drivers/infiniband/hw/qedr/verbs.c +++ b/drivers/infiniband/hw/qedr/verbs.c @@ -1957,6 +1957,9 @@ int qedr_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, } if (attr_mask & (IB_QP_AV | IB_QP_PATH_MTU)) { + if (rdma_protocol_iwarp(&dev->ibdev, 1)) + return -EINVAL; + if (attr_mask & IB_QP_PATH_MTU) { if (attr->path_mtu < IB_MTU_256 || attr->path_mtu > IB_MTU_4096) {