From patchwork Tue Jan 28 14:04:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 232459 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B22FC2D0DB for ; Tue, 28 Jan 2020 14:46:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EDC1820716 for ; Tue, 28 Jan 2020 14:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580222794; bh=PiuDZQEdnw3N7o/vAV/LH4ff4l5jO2NrHYVYvMt/9SI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=luDOxWbEcgV4KJKMGKUODuvaVKlIRjY7oZArPk7fzNIqXeVQg6boB8zGDeYUNopqi WR1efWEY6+guv6alrCOfiiKgOjMDODC0WhnblUELeIdfF72qNtYhz02rxcE+hYEU2m xVy+v51Ls3yMS7AiLCO25IWA3x/s8PhE0u1Nh57M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728666AbgA1OJH (ORCPT ); Tue, 28 Jan 2020 09:09:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:57432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728663AbgA1OJH (ORCPT ); Tue, 28 Jan 2020 09:09: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 316BE24694; Tue, 28 Jan 2020 14:09:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580220546; bh=PiuDZQEdnw3N7o/vAV/LH4ff4l5jO2NrHYVYvMt/9SI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ymrXuggjMmIFHl44mP+BE0r8GSrQlyq41dJXmjGN/AMRTn8f0l8xSn+LAOdnMILRh jWmGWtc7vcIlx7uFdiZz/82r5xfs66uFd8oRXCxx7p++m3fOtlwNUctzhJNy1mbZGN KbStmYS/eBwD+HOG5MDnUzZbNGRLwVGq59Xw/NsY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gal Pressman , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.4 033/183] RDMA/ocrdma: Fix out of bounds index check in query pkey Date: Tue, 28 Jan 2020 15:04:12 +0100 Message-Id: <20200128135833.317143595@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135829.486060649@linuxfoundation.org> References: <20200128135829.486060649@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Gal Pressman [ Upstream commit b188940796c7be31c1b8c25a9a0e0842c2e7a49e ] The pkey table size is one element, index should be tested for > 0 instead of > 1. Fixes: fe2caefcdf58 ("RDMA/ocrdma: Add driver for Emulex OneConnect IBoE RDMA adapter") Signed-off-by: Gal Pressman Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index 76e96f97b3f64..6385448b22c5a 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c @@ -55,7 +55,7 @@ int ocrdma_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey) { - if (index > 1) + if (index > 0) return -EINVAL; *pkey = 0xffff;