Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9225149pxu; Mon, 28 Dec 2020 09:46:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvrGsBDLa5XODxXmUnWAbnLTFFoZPnnxJnN29QFwhocpfoVe2lc/8K6SFVbMHmXnvZiUSt X-Received: by 2002:a17:906:eb49:: with SMTP id mc9mr41225790ejb.487.1609177601262; Mon, 28 Dec 2020 09:46:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609177601; cv=none; d=google.com; s=arc-20160816; b=OfKn+oCTXwBMBaUP3lfWVedqg1ToUJ0nPN3v8ZwzIpx2DGeOMR4+CEhFxK8Iu/UFF3 vq8sSo8NoRoX/WCIx0B+bVJ4wob0TgN1o7IIsk+rYXyYAd8XVgOabJjHacGAtUDp7hdN efp6dPm83ENgJ9T1Aa1NUsAPNKdNu+B+2ChNz8se7n157ahe/56wMzgDUuf/LVWjik/k H9LnInrgVBSWwDOb9n8oz5rdBJyBj34Ipez9V73M2FmIjq24w5BWgGGgNZd/+n5FDMcp Lr1iG33KEK3mykEAUHQ+tn3lIqTvtOD4g6Gw+eeAL6TSnVooYy7AOqTpCwDteXlU9Rrq ahxw== 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=fC0Rpv/SPo1SRA58rGwwZuqg6yAhU4W52s4HwjmTi5A=; b=RFlvU8KVrs7NBLtU96aZ20duqFELdGbsNIe5ZnJLVWDmNTLCrzxra8u0NYkHmMYGpw RnG+Og314pjHyFN3QZLGRD+eb3Vc/NI5PozbbgQ+19UXnNxkdGGsEIPjMnTMeqvI24+G 1ZQ1LencUv30evZCbsdmZjQ6LvtDUJcUgFzw6dvSVj1l6J9fMtB/ntqHYX8K+T7x5e6k zfs7lejy2IOejbPeG34yBBZvb8Ye2MG6PhSZZJlwvkkT4aBnLzlec4sSGl/vK0XkHCTw yvjDl0eoN10FrkraS1lQO6AAaBZkooa+e67mDePJJIPhXNDJt5Pag+JoSABxowttjAN9 kO6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Z8wI/xnH"; 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 f15si21235315edc.147.2020.12.28.09.46.19; Mon, 28 Dec 2020 09:46:41 -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="Z8wI/xnH"; 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 S1732248AbgL1NNe (ORCPT + 99 others); Mon, 28 Dec 2020 08:13:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:41456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732234AbgL1NN0 (ORCPT ); Mon, 28 Dec 2020 08:13:26 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B3035207C9; Mon, 28 Dec 2020 13:12:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161166; bh=E1GYUYAbH9ykkfF4Oarmxgi3hbfAtM29mibHRjVhMaY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z8wI/xnHGX2q2fGTmq+N5sVy2AvFPdyPOqeRakrCINalrd0O5nnl7jP+yJB/8nsoI ZWF2mDo1IzZCfg62YibVVH0J3RRYwdG0kJoNH+ffXQQUdJQW0OEDuwAILvahAfPxRF 5uGRvwpbvhDHZBEB0i0orfaF8hR6EYZaqy7Jxp3c= 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.14 106/242] RDMA/cxgb4: Validate the number of CQEs Date: Mon, 28 Dec 2020 13:48:31 +0100 Message-Id: <20201228124909.913851885@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@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 Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/cxgb4/cq.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/infiniband/hw/cxgb4/cq.c +++ b/drivers/infiniband/hw/cxgb4/cq.c @@ -906,6 +906,9 @@ struct ib_cq *c4iw_create_cq(struct ib_d rhp = to_c4iw_dev(ibdev); + if (entries < 1 || entries > ibdev->attrs.max_cqe) + return ERR_PTR(-EINVAL); + if (vector >= rhp->rdev.lldi.nciq) return ERR_PTR(-EINVAL);