From patchwork Mon Jan 7 15:27:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gal Pressman X-Patchwork-Id: 10750723 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-2.web.codeaurora.org (Postfix) with ESMTP id CFA75746 for ; Mon, 7 Jan 2019 15:28:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDC4D209CE for ; Mon, 7 Jan 2019 15:28:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B165828355; Mon, 7 Jan 2019 15:28:05 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 54ACC209CE for ; Mon, 7 Jan 2019 15:28:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729843AbfAGP2F (ORCPT ); Mon, 7 Jan 2019 10:28:05 -0500 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:34622 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727418AbfAGP2E (ORCPT ); Mon, 7 Jan 2019 10:28:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1546874883; x=1578410883; h=from:to:cc:subject:date:message-id:mime-version; bh=PRtyKDQH8VA4vdpaHb2k/U+xLJYutZ7CRUgGkQKy9xc=; b=TDfTsAPaHbLJ4BlLOxY44eJM0lSOOVP4hN2zKQc1l6ol/uD4KiZl39uF MNhi99NL3VUVay/MmCYA1yn8sPnEMLN0dlEAB7Dh44/IwQGRtjNwkg7v8 T0T4ZAew0Afg8uW3MpGZErRr8us/BxwKNvFwSZI0tGWTXSloWArTvODIB 4=; X-IronPort-AV: E=Sophos;i="5.56,253,1539648000"; d="scan'208";a="775033510" Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-2b-81e76b79.us-west-2.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Jan 2019 15:28:01 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2b-81e76b79.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id x07FRvIO072268 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Mon, 7 Jan 2019 15:28:01 GMT Received: from EX13D19EUA002.ant.amazon.com (10.43.165.247) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 7 Jan 2019 15:28:00 +0000 Received: from EX13MTAUEA001.ant.amazon.com (10.43.61.82) by EX13D19EUA002.ant.amazon.com (10.43.165.247) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 7 Jan 2019 15:27:59 +0000 Received: from galpress-VirtualBox.hfa16.amazon.com (10.218.62.29) by mail-relay.amazon.com (10.43.61.243) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 7 Jan 2019 15:27:57 +0000 From: Gal Pressman To: Doug Ledford , Jason Gunthorpe CC: , Gal Pressman , Christian Benvenuti , Nelson Escobar , Parvi Kaustubhi Subject: [PATCH rdma-next 1/3] IB/usnic: Fix out of bounds index check in query pkey Date: Mon, 7 Jan 2019 17:27:54 +0200 Message-ID: <1546874876-24589-1-git-send-email-galpress@amazon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 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 The pkey table size is one element, index should be tested for > 0 instead of > 1. Fixes: e3cf00d0a87f ("IB/usnic: Add Cisco VIC low-level hardware driver") Cc: Christian Benvenuti Cc: Nelson Escobar Cc: Parvi Kaustubhi Signed-off-by: Gal Pressman Acked-by: Parvi Kaustubhi --- drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c index 1d4abef17e38..63c7b48774e9 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c @@ -449,7 +449,7 @@ struct net_device *usnic_get_netdev(struct ib_device *device, u8 port_num) int usnic_ib_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey) { - if (index > 1) + if (index > 0) return -EINVAL; *pkey = 0xffff; From patchwork Mon Jan 7 15:27:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gal Pressman X-Patchwork-Id: 10750725 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-2.web.codeaurora.org (Postfix) with ESMTP id 23D77746 for ; Mon, 7 Jan 2019 15:28:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1299E209CE for ; Mon, 7 Jan 2019 15:28:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06D8628355; Mon, 7 Jan 2019 15:28:08 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 8DDD7209CE for ; Mon, 7 Jan 2019 15:28:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729848AbfAGP2H (ORCPT ); Mon, 7 Jan 2019 10:28:07 -0500 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:32884 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727418AbfAGP2H (ORCPT ); Mon, 7 Jan 2019 10:28:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1546874886; x=1578410886; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=KjXdMroZ/X5Kor1MmIhRtQrcE8/Ok2Qz18TGao+2kKU=; b=dxZSMyzNGcOlXmzcl7/fm/9noVgI4gXJ4D5bUXp0Ku8ubV+1I4Jj+v3j hmWRTIc2h5O+zyMq8Omwzth3tbrJxLEhqVWBswoNsq7GzJy13FG0ihT7/ 825slhX/B2fFqWmGhsdDQsBtapQG7GVtee7mxNDtclMa7X9xmX0/S7RiS c=; X-IronPort-AV: E=Sophos;i="5.56,253,1539648000"; d="scan'208";a="380573928" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2b-55156cd4.us-west-2.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Jan 2019 15:28:04 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2b-55156cd4.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id x07FS0wI086518 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Mon, 7 Jan 2019 15:28:03 GMT Received: from EX13D19EUB002.ant.amazon.com (10.43.166.78) by EX13MTAUEA001.ant.amazon.com (10.43.61.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 7 Jan 2019 15:28:03 +0000 Received: from EX13MTAUEA001.ant.amazon.com (10.43.61.82) by EX13D19EUB002.ant.amazon.com (10.43.166.78) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 7 Jan 2019 15:28:02 +0000 Received: from galpress-VirtualBox.hfa16.amazon.com (10.218.62.29) by mail-relay.amazon.com (10.43.61.243) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 7 Jan 2019 15:28:00 +0000 From: Gal Pressman To: Doug Ledford , Jason Gunthorpe CC: , Gal Pressman , "Selvin Xavier" , Devesh Sharma Subject: [PATCH rdma-next 2/3] RDMA/ocrdma: Fix out of bounds index check in query pkey Date: Mon, 7 Jan 2019 17:27:55 +0200 Message-ID: <1546874876-24589-2-git-send-email-galpress@amazon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1546874876-24589-1-git-send-email-galpress@amazon.com> References: <1546874876-24589-1-git-send-email-galpress@amazon.com> MIME-Version: 1.0 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 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") Cc: Selvin Xavier Cc: Devesh Sharma Signed-off-by: Gal Pressman --- 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 c46bed0c5513..6655366affab 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; From patchwork Mon Jan 7 15:27:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gal Pressman X-Patchwork-Id: 10750727 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-2.web.codeaurora.org (Postfix) with ESMTP id 33D48746 for ; Mon, 7 Jan 2019 15:28:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D12328355 for ; Mon, 7 Jan 2019 15:28:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 119E92836F; Mon, 7 Jan 2019 15:28:14 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 866F928355 for ; Mon, 7 Jan 2019 15:28:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729854AbfAGP2N (ORCPT ); Mon, 7 Jan 2019 10:28:13 -0500 Received: from smtp-fw-6001.amazon.com ([52.95.48.154]:11972 "EHLO smtp-fw-6001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729845AbfAGP2N (ORCPT ); Mon, 7 Jan 2019 10:28:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1546874892; x=1578410892; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=At9H70aLk8aLoIdtxfKgZCpd96Q3/vdd8SoEYxsV0+s=; b=v93moMcOoXt1bLhwdJGvdBPwqwcdGdkpp0u/0ovYwxfjG1nAR/jdgFST 4rI+n3jiEvxQihhAE20iG6JARyk16+rb7W/RrZROnUsESxDNLj2RCIL5R UWgX3/vb8+yZaBf9kSkM9yL3dHohueSnhGr5fA8Q4ZrLCYJNkssudXnP5 M=; X-IronPort-AV: E=Sophos;i="5.56,253,1539648000"; d="scan'208";a="375237122" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2b-8cc5d68b.us-west-2.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-6001.iad6.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Jan 2019 15:28:08 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2b-8cc5d68b.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id x07FS2MO091754 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Mon, 7 Jan 2019 15:28:06 GMT Received: from EX13D19EUB003.ant.amazon.com (10.43.166.69) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 7 Jan 2019 15:28:06 +0000 Received: from EX13MTAUEA001.ant.amazon.com (10.43.61.82) by EX13D19EUB003.ant.amazon.com (10.43.166.69) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 7 Jan 2019 15:28:04 +0000 Received: from galpress-VirtualBox.hfa16.amazon.com (10.218.62.29) by mail-relay.amazon.com (10.43.61.243) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 7 Jan 2019 15:28:02 +0000 From: Gal Pressman To: Doug Ledford , Jason Gunthorpe CC: , Gal Pressman , "Michal Kalderon" , Ariel Elior Subject: [PATCH rdma-next 3/3] RDMA/qedr: Fix out of bounds index check in query pkey Date: Mon, 7 Jan 2019 17:27:56 +0200 Message-ID: <1546874876-24589-3-git-send-email-galpress@amazon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1546874876-24589-1-git-send-email-galpress@amazon.com> References: <1546874876-24589-1-git-send-email-galpress@amazon.com> MIME-Version: 1.0 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 The pkey table size is QEDR_ROCE_PKEY_TABLE_LEN, index should be tested for >= QEDR_ROCE_PKEY_TABLE_LEN instead of > QEDR_ROCE_PKEY_TABLE_LEN. Fixes: a7efd7773e31 ("qedr: Add support for PD,PKEY and CQ verbs") Cc: Michal Kalderon Cc: Ariel Elior Signed-off-by: Gal Pressman Acked-by: Michal KalderonĀ  --- drivers/infiniband/hw/qedr/verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c index b342a70e2814..bf37673a8302 100644 --- a/drivers/infiniband/hw/qedr/verbs.c +++ b/drivers/infiniband/hw/qedr/verbs.c @@ -67,7 +67,7 @@ static inline int qedr_ib_copy_to_udata(struct ib_udata *udata, void *src, int qedr_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey) { - if (index > QEDR_ROCE_PKEY_TABLE_LEN) + if (index >= QEDR_ROCE_PKEY_TABLE_LEN) return -EINVAL; *pkey = QEDR_ROCE_PKEY_DEFAULT;