Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2780636pxj; Mon, 10 May 2021 10:33:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfMzWG0KXAzJXvdENzNld1codv4Ms4LVh+O2Sh0y6lKVRuobUYJWtrEK2860rJ7WEbq477 X-Received: by 2002:a05:6e02:dca:: with SMTP id l10mr22497539ilj.203.1620667991145; Mon, 10 May 2021 10:33:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620667991; cv=none; d=google.com; s=arc-20160816; b=Troa2jw4Ad8uaE3R0dz7GniW32vJJhfCEZwP3e3DR3xvyCLGl2aejcmQDR33xMlMvi ILtczTqonvzTICMPF08t0HTHquIEEMU3njJGxhX0X1xlCmaNxXbRddYivWKyfC3LwkqZ rQToddjlJIhWvdpYMSqVePzN06XI40e7iJGYGkY0ZVMgPlAMF49ZuRl9eRJsB3sclhul eYHGpYFN7nMeGqztO7f+/1WxkmCc2rKMGy3zbYO78xpBAFCWkLOszMZ0f9xo4DJBaa1M 7p7tO1lhOchMq2x5oPESo4/adxdz4eD7JTfebtj7QKWewzLtWO+RyuDfqU6gQBrkc2Jg C5QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:content-transfer-encoding:references :importance:sensitivity:mime-version:date:cc:to:from:subject :in-reply-to:dkim-signature; bh=O7t3E8f6afvRrEIHpBcgV+tX3m8XCdkTaVANeHqT4Lc=; b=J7MFT671VaOYmq+FlGNk0R4TkH0mjRl+CJwNxSo+XtkhzTsw6uPV8yvVbISlvHQzu1 Yu0rkbf1kfoeBLGXIkl7sU1P+KLZKbE1KxBx+fksHcIC1peRoeJJem9WcWVzl6PCF478 8eE4ouVUFhbOKRlpfqcjk9/9fbmRYJRUcQ5HD4BRm6CyAieuKZyy1NjYIRsDm1rhfIU3 xLz/wAlSqOAwFFzFBGrJjSKu7EDUR67qk1E/aPEsXtlWSUwXNNhwzRK2/GF9Bay0vRmT aejSHSWEKWf3PFx78zPr3F68S/gqkAbd6x0MM6196HIoagR3JXVZ5KYBqwac0GAC9HIO BQfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Xv1zwF4+; 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a23si16939655jap.18.2021.05.10.10.32.58; Mon, 10 May 2021 10:33:11 -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=@ibm.com header.s=pp1 header.b=Xv1zwF4+; 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232861AbhEJRdY (ORCPT + 99 others); Mon, 10 May 2021 13:33:24 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:25990 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233437AbhEJRbx (ORCPT ); Mon, 10 May 2021 13:31:53 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14AH3OFm180203 for ; Mon, 10 May 2021 13:30:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=in-reply-to : subject : from : to : cc : date : mime-version : references : content-transfer-encoding : content-type : message-id; s=pp1; bh=O7t3E8f6afvRrEIHpBcgV+tX3m8XCdkTaVANeHqT4Lc=; b=Xv1zwF4+MNoh6lre5n57U/zqTNgI8X1JUXd3bTKajMF5I3l54SE4vCkjf2OPtG2xhRYD dvQIqBkY2rJw2DDlEuQIZB7eyXhojgfMqQD5pdA+OZ+G9IW61l+BlGfXQ3M32ZTGx5VD 7a8nS0qr10c4uyY9cKANDle1UHou9ppy95+PNyFe4/7DEy/Q4yW0FVZFG57uq/ZTwl04 rC2ySy4IwU+LCH7bMJ8TlDOgqQwQTybLU2LGKaULfa/o4ECDrxh0zt3hVLclghjD1kdR JGZeJsKeGho54HzqvNaZxaKSrUfVMcKgxD0ilwogORVC7QVNrxEGpp6crzyI782dylZV qA== Received: from smtp.notes.na.collabserv.com (smtp.notes.na.collabserv.com [192.155.248.73]) by mx0b-001b2d01.pphosted.com with ESMTP id 38f8vvrr3d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 10 May 2021 13:30:48 -0400 Received: from localhost by smtp.notes.na.collabserv.com with smtp.notes.na.collabserv.com ESMTP for from ; Mon, 10 May 2021 17:30:47 -0000 Received: from us1a3-smtp02.a3.dal06.isc4sb.com (10.106.154.159) by smtp.notes.na.collabserv.com (10.106.227.90) with smtp.notes.na.collabserv.com ESMTP; Mon, 10 May 2021 17:30:46 -0000 Received: from us1a3-mail162.a3.dal06.isc4sb.com ([10.146.71.4]) by us1a3-smtp02.a3.dal06.isc4sb.com with ESMTP id 2021051017304543-607398 ; Mon, 10 May 2021 17:30:45 +0000 In-Reply-To: Subject: Re: [PATCH rdma-rc] RDMA/siw: Properly check send and receive CQ pointers From: "Bernard Metzler" To: "Leon Romanovsky" Cc: "Doug Ledford" , "Jason Gunthorpe" , "Leon Romanovsky" , "linux-kernel" , "linux-rdma" Date: Mon, 10 May 2021 17:30:45 +0000 MIME-Version: 1.0 Sensitivity: Importance: Normal X-Priority: 3 (Normal) References: X-Mailer: IBM iNotes ($HaikuForm 1054.1) | IBM Domino Build SCN1812108_20180501T0841_FP130 January 13, 2021 at 14:04 X-LLNOutbound: False X-Disclaimed: 52419 X-TNEFEvaluated: 1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 x-cbid: 21051017-8877-0000-0000-00000600758B X-IBM-SpamModules-Scores: BY=0.057814; FL=0; FP=0; FZ=0; HX=0; KW=0; PH=0; SC=0; ST=0; TS=0; UL=0; ISC=; MB=0.001860 X-IBM-SpamModules-Versions: BY=3.00015193; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000296; SDB=6.01548292; UDB=6.00838382; IPR=6.01330253; MB=3.00036958; MTD=3.00000008; XFM=3.00000015; UTC=2021-05-10 17:30:47 X-IBM-AV-DETECTION: SAVI=unsuspicious REMOTE=unsuspicious XFE=unused X-IBM-AV-VERSION: SAVI=2021-03-25 10:42:53 - 6.00012377 x-cbparentid: 21051017-8878-0000-0000-0000F6227B5A Message-Id: X-Proofpoint-ORIG-GUID: bRw1sEty9KYDHfOlYD67e7iQGA8OVYMi X-Proofpoint-GUID: bRw1sEty9KYDHfOlYD67e7iQGA8OVYMi X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-05-10_11:2021-05-10,2021-05-10 signatures=0 X-Proofpoint-Spam-Reason: orgsafe Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org -----"Leon Romanovsky" wrote: ----- >To: "Doug Ledford" , "Jason Gunthorpe" > >From: "Leon Romanovsky" >Date: 05/09/2021 01:39PM >Cc: "Leon Romanovsky" , "Bernard Metzler" >, linux-kernel@vger.kernel.org, >linux-rdma@vger.kernel.org >Subject: [EXTERNAL] [PATCH rdma-rc] RDMA/siw: Properly check send and >receive CQ pointers > >From: Leon Romanovsky > >The check for the NULL of pointer received from container=5Fof is >incorrect by definition as it points to some random memory. > >Change such check with proper NULL check of SIW QP attributes. > >Fixes: 303ae1cdfdf7 ("rdma/siw: application interface") >Signed-off-by: Leon Romanovsky >--- > drivers/infiniband/sw/siw/siw=5Fverbs.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > >diff --git a/drivers/infiniband/sw/siw/siw=5Fverbs.c >b/drivers/infiniband/sw/siw/siw=5Fverbs.c >index d2313efb26db..917c8a919f38 100644 >--- a/drivers/infiniband/sw/siw/siw=5Fverbs.c >+++ b/drivers/infiniband/sw/siw/siw=5Fverbs.c >@@ -300,7 +300,6 @@ struct ib=5Fqp *siw=5Fcreate=5Fqp(struct ib=5Fpd *pd, > struct siw=5Fucontext *uctx =3D > rdma=5Fudata=5Fto=5Fdrv=5Fcontext(udata, struct siw=5Fucontext, > base=5Fucontext); >- struct siw=5Fcq *scq =3D NULL, *rcq =3D NULL; > unsigned long flags; > int num=5Fsqe, num=5Frqe, rv =3D 0; > size=5Ft length; >@@ -343,10 +342,8 @@ struct ib=5Fqp *siw=5Fcreate=5Fqp(struct ib=5Fpd *pd, > rv =3D -EINVAL; > goto err=5Fout; > } >- scq =3D to=5Fsiw=5Fcq(attrs->send=5Fcq); >- rcq =3D to=5Fsiw=5Fcq(attrs->recv=5Fcq); >=20 >- if (!scq || (!rcq && !attrs->srq)) { >+ if (!attrs->send=5Fcq || (!attrs->recv=5Fcq && !attrs->srq)) { > siw=5Fdbg(base=5Fdev, "send CQ or receive CQ invalid\n"); > rv =3D -EINVAL; > goto err=5Fout; >@@ -401,8 +398,8 @@ struct ib=5Fqp *siw=5Fcreate=5Fqp(struct ib=5Fpd *pd, > } > } > qp->pd =3D pd; >- qp->scq =3D scq; >- qp->rcq =3D rcq; >+ qp->scq =3D to=5Fsiw=5Fcq(attrs->send=5Fcq); >+ qp->rcq =3D to=5Fsiw=5Fcq(attrs->recv=5Fcq); >=20 > if (attrs->srq) { > /* >--=20 >2.31.1 > > Many thanks Leon! Reviewed-by: Bernard Metzler