Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3787468pxb; Mon, 4 Oct 2021 09:35:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynBUL6xvS727fuPhQiNQrCN4/nyQRsm04X3tOJDYCRaA1ywswVqoXj60l/e+8jvbMYni1T X-Received: by 2002:a17:906:7053:: with SMTP id r19mr17757535ejj.476.1633365307728; Mon, 04 Oct 2021 09:35:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633365307; cv=none; d=google.com; s=arc-20160816; b=Db/atWuopDS1jTLMepsWiWw//YdtzbryymxC/etDF4iKDiX9M4C0CNl2IZwhQens36 5J4ZwiguCinsqPQB9l4vNnZTZURyZqA+djiCFY1QzFj+lrQ+oaPo5aeiIsX4jEoQHFDC Y1MThyl5z27Wy2/5e9uhsZf93VT2QC4z6mLPMVDQUvGpdLyucHJPEg7VIAtD5NH54cgI Qzm3DijmK8TeUXO1Z6FGZf0hhUaX90GxTuQBWAjaRl5WR+KBf0TY9FjJ+lTrzLe3M1xF 7aNQaTsWQKAf0mBleqdnthP1h47qHM0xRpcqxlrGNexT69knvcFnSmKDyzgUpM4nO8CH gJQQ== 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=hyzf/bIniM8XH30DaVPOGrDkWqE3bpt+tRbY6wxuZMg=; b=cub3d0m76BsB1yyTte5V5Nor1X0ix7fNi6F7BKDHv9lgnNedqFJLZ02K3QyWobAUhS Gf52zYiZlsYGBKYQI6YOntCy/IxxAtPGk/wcfyYPnrWAInY8Xnda4PBqrRsX2DCZxVJr +tmUbSUPunwXmbi6dmYb5izUEbmtPQS+EcuWXZ6/NipPRwIQLnGS6B5ZqlxS5/Y+q/A9 9HjrZYNyw1tbPm6BMYEYgwIsn/hxzI5sIvSKlxrpjCiMLzgfvuwSO0YqTrBKv1BcQ480 Mwk/Q3lrjHinA28N2c9PxBbvTLdvYv3Rk9K+Z3tKVv3c00KXDo25gd9wQwPEpnYi9tsH FAhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F2fgfIA0; 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 p14si10113091ejr.349.2021.10.04.09.34.39; Mon, 04 Oct 2021 09:35:07 -0700 (PDT) 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=F2fgfIA0; 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 S237352AbhJDNgF (ORCPT + 99 others); Mon, 4 Oct 2021 09:36:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:48040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237041AbhJDNds (ORCPT ); Mon, 4 Oct 2021 09:33:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4575563231; Mon, 4 Oct 2021 13:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633353323; bh=NjK0VONX59kuUgZNW4kpqcg7X7vcUvRcsgH3Cjz61CA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F2fgfIA0scHGnemZ6u+rV4kcj1jI/Gjwb73Jd4tC6hXZKNDngWMU+fcj63xtHHbAu P0Sq+7kdRlkVkMStzgENptPhWj8arPL313jL2g/MBuCXjo/piF1w1F0jn+8lWpxzHg c/dz9y8bXHi3e7WOBeuLxtXgAU5iWzkAqIxWwKHA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sindhu Devale , Shiraz Saleem , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.14 083/172] RDMA/irdma: Validate number of CQ entries on create CQ Date: Mon, 4 Oct 2021 14:52:13 +0200 Message-Id: <20211004125047.670577370@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004125044.945314266@linuxfoundation.org> References: <20211004125044.945314266@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: Sindhu Devale [ Upstream commit f4475f249445b3c1fb99919b0514a075b6d6b3d4 ] Add lower bound check for CQ entries at creation time. Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs") Link: https://lore.kernel.org/r/20210916191222.824-3-shiraz.saleem@intel.com Signed-off-by: Sindhu Devale Signed-off-by: Shiraz Saleem Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/irdma/verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c index 6107f37321d2..6c3d28f744cb 100644 --- a/drivers/infiniband/hw/irdma/verbs.c +++ b/drivers/infiniband/hw/irdma/verbs.c @@ -2040,7 +2040,7 @@ static int irdma_create_cq(struct ib_cq *ibcq, /* Kmode allocations */ int rsize; - if (entries > rf->max_cqe) { + if (entries < 1 || entries > rf->max_cqe) { err_code = -EINVAL; goto cq_free_rsrc; } -- 2.33.0