Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9081858pxu; Mon, 28 Dec 2020 06:12:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxy7/QTbR2FUoJMG9xy1SHROckhv+uMq5dWcY/IpplJgdpymDJVOzm6y4HRbbrxQBoqnvJ2 X-Received: by 2002:a50:ee97:: with SMTP id f23mr40666180edr.311.1609164723647; Mon, 28 Dec 2020 06:12:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609164723; cv=none; d=google.com; s=arc-20160816; b=fF7ZP8FxXiaxi1KJU3PODnP16CExnZY7doszAs0hCsHMjJdtVjeYT5UC5iauMj8uuu 2YUkxGoLol/WNtxZF0Lg+1zlvcs80wf7XXruNt0M6R39ObyziEkN1W39jAbMFYR2774q BIcJW3yPbanzSJLt7drQUgWxsilo7TQYpNPxdz9GK+gkJLnzia9E4Ya0RRzaMfTIhXzk tOoELqU4Cw0qOmADOPBYQHV4bghtjUietZNfTjb0v9nft7IFz6bk3CxP1n6FDoPPnB/v MDeTOjUVFNGiVCqF9jwOlfKDV2J4d9BOQ/LOs0NUO7yg+7ZRIbGlleAXLJQ0WM1OZ5j8 mMFg== 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=z+kUF3/UQVoD9ONZGt9nLgCKD6grTpQp/hBW8c8mrtE=; b=fayA0G/5gmFttfFyAwC3pV8/6a7kcpW8sXTVvvollEOEURFkaQCV2cssx0mBqWsTjU r6t5odX4QvABD6oYZM0fa7AT36MGaZP4GXZK/r+dM8xYB24JUJLVgmlVUs0TZhtaZr5T Sf0Fbnz7g7wdSTaKtaMUp8GJj9K24zOotmrEEe2uy+n2beqOvrg37BP5nmA3d6X8oT9V atyqYkQZTjalybfsVmWxmWWW4OLLZflKpiOxn8dC1RKDtb2DQo4+zOemAQaTFTcgZgmG LkJUFU226kRAqTkPWl/aK1L2KriKTbOzToB3k4av+R8mPrOfw5M8PzMOE8iWma4IkCX0 bGww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o0qUKPjk; 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 hr23si18189207ejc.111.2020.12.28.06.11.40; Mon, 28 Dec 2020 06:12:03 -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=o0qUKPjk; 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 S2438665AbgL1OIm (ORCPT + 99 others); Mon, 28 Dec 2020 09:08:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:42886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438645AbgL1OIT (ORCPT ); Mon, 28 Dec 2020 09:08:19 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5C0192063A; Mon, 28 Dec 2020 14:07:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164458; bh=3MmpDDqL5dqQFlyFfQEQH4nXPsv/iniCXrcR9JwhZw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o0qUKPjkCE3uTVxIiByj7640RuYGRSbZ3tXbJ6w8HRE2oScW8bDEeyWhlQ77/fJmc gjbQCLsIv1RG7l9HSAhZX76l/FO2UUykpZKcM2rFmn2mlAwUzj4KBH4L/cEyv7PO03 +DtSVAJHth0fyOY7PMwiO/9JjL927NHOnEs+ETLk= 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 5.10 188/717] RDMA/cxgb4: Validate the number of CQEs Date: Mon, 28 Dec 2020 13:43:06 +0100 Message-Id: <20201228125029.978229933@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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 28349ed508854..d6cfefc269ee3 100644 --- a/drivers/infiniband/hw/cxgb4/cq.c +++ b/drivers/infiniband/hw/cxgb4/cq.c @@ -1008,6 +1008,9 @@ int c4iw_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, if (attr->flags) return -EINVAL; + if (entries < 1 || entries > ibdev->attrs.max_cqe) + return -EINVAL; + if (vector >= rhp->rdev.lldi.nciq) return -EINVAL; -- 2.27.0