Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9182868pxu; Mon, 28 Dec 2020 08:38:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJwrr0yV4EyYOwrjcICj1NZI/qFJf8dp1VFiDHDzoW96ChXMle6AHOZsiPZ4xhsChK9mJYvd X-Received: by 2002:aa7:dac5:: with SMTP id x5mr43670066eds.198.1609173535207; Mon, 28 Dec 2020 08:38:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609173535; cv=none; d=google.com; s=arc-20160816; b=g6WDL3jCWd4rB/K2Q7+dN5oR4dwkz9xJ1NaKhd3sESZIm0OA751D4ckZNEmK3MnGr2 LQCvbFtYKeoHwQoIgS5Gegf334JBsxGR+OnhHvUUungrq1M/htXSB43TNQF6b2e+4/cw iBtIGGMFaHD9MC8nPp9LZbyUPIEYtnt+Zkm+y//46QGZAT7Xg0hEWVLLylmkCw4Nj64w yPODh7URmBJLtxMNv81rUsF95c/x+fsPBbp9OfbuBJ02Kx74Q8RUn0YR7I3jtQfhuHTi Y/aGyqONrwSWZ1LK5D62vPC8MtkEilMa6p1F8TlMaGo7YPhOQFZngN+dUa04HwZVNHdR +PTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9yCmIdSLGodKdcZ570p09IZpjBLzKawBPw0Kv/iNlec=; b=PHwwrkEX89gLNXP+WVifpIEZGcTZyjfasC2toj1cnadY0KbLReiw7Hj+Qk5xafP+vF 9YGLTmxxsDQmEsjtIqGWxCWu7m0ayNb7wTydR2wSAeZaT5ZLFEFoBLBimNQDI91rArht WzUuTj9u+05H9GYCcYfSDC/10rIh3CO9/9cnWxcC5rmEMVTn6xkhf0pHcFef7WmERqJA ehnlv8ue73QwDWCLzP9EDd6X4Eann8WrGslBFHsPZdG+tv2WBs48FnA1WQPYt9QkSHxG 83NUcmYVkcLgxc8DlRKoJc0JJpbuf7nDHNFG194ZR+rlNAvRLmxReRpgCJDcnMV44XU9 tpBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mSDeXDuM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn9si20150780edb.347.2020.12.28.08.38.31; Mon, 28 Dec 2020 08:38:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mSDeXDuM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2634177AbgL1QfP (ORCPT + 99 others); Mon, 28 Dec 2020 11:35:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:57636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729979AbgL1NCI (ORCPT ); Mon, 28 Dec 2020 08:02:08 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 75D2B22573; Mon, 28 Dec 2020 13:01:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160513; bh=w/jIiCdB4hH0VtmD/FjeQIDWgM8kH+eyi5kTzMPkg4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mSDeXDuM3wd97s7+hTxvJm373CHM+Oph+6ZsfgnXqLdUDUd+B7gw0AXgMznwL1u+A yx6YwWNkpK0YJLvyCDQQBJMvU0DqKr4U0nYqT2j1HSKdFldkMFuf7gCm4r0X+Jox6H kkNGZPP+8a7n/ThpCmw2Wiw+tbfYTBGQBi9fhc4w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kamal Heib , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.9 076/175] RDMA/cxgb4: Validate the number of CQEs Date: Mon, 28 Dec 2020 13:48:49 +0100 Message-Id: <20201228124856.922283475@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124853.216621466@linuxfoundation.org> References: <20201228124853.216621466@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kamal Heib [ Upstream commit 6d8285e604e0221b67bd5db736921b7ddce37d00 ] Before create CQ, make sure that the requested number of CQEs is in the supported range. Fixes: cfdda9d76436 ("RDMA/cxgb4: Add driver for Chelsio T4 RNIC") Link: https://lore.kernel.org/r/20201108132007.67537-1-kamalheib1@gmail.com Signed-off-by: Kamal Heib Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/cxgb4/cq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c index a856371bbe58c..501f496f4e1a1 100644 --- a/drivers/infiniband/hw/cxgb4/cq.c +++ b/drivers/infiniband/hw/cxgb4/cq.c @@ -893,6 +893,9 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, rhp = to_c4iw_dev(ibdev); + if (entries < 1 || entries > ibdev->attrs.max_cqe) + return -EINVAL; + if (vector >= rhp->rdev.lldi.nciq) return ERR_PTR(-EINVAL); -- 2.27.0