From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8AEB4CA9EC0 for ; Mon, 28 Oct 2019 13:57:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 527DE214D9 for ; Mon, 28 Oct 2019 13:57:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572271078; bh=auTisxDBqPAovqdOLJ4zRzbvYr1seh/4dOnj8zyrEAU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=J9EgFMfLYyJXgaSj5x7A4o6tMU+iaMUnpBN2dUhcfBzslzPK9gimfASvsgGTDQtmC /yKyLslmgy1MCJ5hrIqQpYC66gHjv7Wvl2zz/BzjDNLhtdBDWE/Q0TWWKT0446HS3q KwAhyCjaCgPikLJ8LbD7rMrKY8VLPbRAzkQRGB4s= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728017AbfJ1N55 (ORCPT ); Mon, 28 Oct 2019 09:57:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:54740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727243AbfJ1N55 (ORCPT ); Mon, 28 Oct 2019 09:57:57 -0400 Received: from localhost (unknown [77.137.89.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7AD252086D; Mon, 28 Oct 2019 13:57:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572271077; bh=auTisxDBqPAovqdOLJ4zRzbvYr1seh/4dOnj8zyrEAU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oFQooDh9zNY6Olq/UPz3/bH3gK2+/rMspyz2Kw+HJFolmP8CQ9PRjDugsb7xEQst3 ww55M6GHvTNvYmmnttHTyZXh39ztj/Kh6ruLCUAu/AmZoQ4FfbGXTuTkAuyc87R1aL Wnuf5jiB3oYA/3/Tyu7hSO+jRgCR+MW7ZoWsI1so= Date: Mon, 28 Oct 2019 15:57:52 +0200 From: Leon Romanovsky To: Jason Gunthorpe Cc: Doug Ledford , RDMA mailing list , Sean Hefty Subject: Re: [PATCH rdma-next] RDMA/ucma: Protect kernel from QPN larger than declared in IBTA Message-ID: <20191028135752.GG5146@unreal> References: <20191028134444.25537-1-leon@kernel.org> <20191028134528.GW22766@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191028134528.GW22766@mellanox.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Mon, Oct 28, 2019 at 03:45:33PM +0200, Jason Gunthorpe wrote: > On Mon, Oct 28, 2019 at 03:44:44PM +0200, Leon Romanovsky wrote: > > From: Leon Romanovsky > > > > IBTA declares QPN as 24bits, mask input to ensure that kernel > > doesn't get higher bits. > > > > Fixes: 75216638572f ("RDMA/cma: Export rdma cm interface to userspace") > > Signed-off-by: Leon Romanovsky > > * Not fully tested yet, passed sanity tests for now. > > drivers/infiniband/core/ucma.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c > > index 0274e9b704be..57e68491a2fd 100644 > > +++ b/drivers/infiniband/core/ucma.c > > @@ -1045,7 +1045,7 @@ static void ucma_copy_conn_param(struct rdma_cm_id *id, > > dst->retry_count = src->retry_count; > > dst->rnr_retry_count = src->rnr_retry_count; > > dst->srq = src->srq; > > srq too? If I read IBTA correctly, the answer is yes. In all CM messages, QPN, SRQ number and EECN are 24 bits. Thanks > > Jason