Received: by 10.192.165.156 with SMTP id m28csp51207imm; Tue, 10 Apr 2018 16:11:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx4847ov1pupVucQuXKjZh/Tjb1DOkmfHNuFERfneGwIXnL/pDiNC9QUrocEo7g3EZlGXrCUs X-Received: by 10.101.86.139 with SMTP id v11mr1631513pgs.420.1523401878642; Tue, 10 Apr 2018 16:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523401878; cv=none; d=google.com; s=arc-20160816; b=i7LBIKiMGxn6Tx7MuaXGviLfk9eIvsspfbJGvzi2AHjLIMFpOVPjlBWQLIU68qHUML 8ObpH1adFPDAxhKF1uAq00CXq/JuyCsvEfCzcRFvhzj5ydwSiKhwSjRRjTdw6WK87wVs MLFozzMztKyXcZezTQaqhOikFBwMbmO9I7emmYltMq9FR1brTzt2UvNgcg2a44rGSMGQ NN2TkXIhGJARkGzvmgLWYcbLjuLMgZdrossw9YgHzesQOWwEFJbFVtTnksb7XEl8R00P K03dLbjCzcFX8TrLVj+3r0B2Bpmu2f+pUYRWy5Hgs6/ioFaho3DCM+/jTAGOYWAcbnFH WAXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=4uxZzGL3UKtDvBEu29e03rw+wjUJVvL1fOK0tJl9JE0=; b=un29iWwqkQujMm8d+pxSF1/r67cAabYIECwvLk3Q9ZlT3Om9m8hbpmMem6gSY3YSu4 yErAW1+hwJeaYvpkMB9dkR+WO8qFm1iiPcuVMEJ7EQJVruvcOgw5aI6xyndphsQVCuB/ sWTtxM24mtHGS7OfqqNWuRMKlqfpxi7ItKPTbYAK7H2SFlVzTVG8ZHU/psueXKzvlShv xkYtXMeh/6JPR6EAYwkZNW6M1vUdYjRev15PygeNibjWMgmFmTt8/QXJaPJ+GkDwN8GX U5n81Tz4mUGrX7qbCPHkjwdiZCBO2hwGdH2WHbW1Vgw7hQmPTyO5dcpLhhwinb9jx/J3 GoiQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h10si2378794pgq.514.2018.04.10.16.10.41; Tue, 10 Apr 2018 16:11:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754366AbeDJWfH (ORCPT + 99 others); Tue, 10 Apr 2018 18:35:07 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41970 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754449AbeDJWfE (ORCPT ); Tue, 10 Apr 2018 18:35:04 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D4850DAC; Tue, 10 Apr 2018 22:35:03 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tatyana Nikolova , Shiraz Saleem , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.14 003/138] i40iw: Validate correct IRD/ORD connection parameters Date: Wed, 11 Apr 2018 00:23:13 +0200 Message-Id: <20180410212902.471577814@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tatyana Nikolova [ Upstream commit ce9ce74145aa6814a370a9ff4f5a1d719baaced1 ] Casting to u16 before validating IRD/ORD connection parameters could cause recording wrong IRD/ORD values in the cm_node. Validate the IRD/ORD parameters as they are passed by the application before recording them. Fixes: f27b4746f378 ("i40iw: add connection management code") Signed-off-by: Tatyana Nikolova Signed-off-by: Shiraz Saleem Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/i40iw/i40iw_cm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/infiniband/hw/i40iw/i40iw_cm.c +++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c @@ -125,7 +125,8 @@ static u8 i40iw_derive_hw_ird_setting(u1 * @conn_ird: connection IRD * @conn_ord: connection ORD */ -static void i40iw_record_ird_ord(struct i40iw_cm_node *cm_node, u16 conn_ird, u16 conn_ord) +static void i40iw_record_ird_ord(struct i40iw_cm_node *cm_node, u32 conn_ird, + u32 conn_ord) { if (conn_ird > I40IW_MAX_IRD_SIZE) conn_ird = I40IW_MAX_IRD_SIZE; @@ -3841,7 +3842,7 @@ int i40iw_connect(struct iw_cm_id *cm_id } cm_node->apbvt_set = true; - i40iw_record_ird_ord(cm_node, (u16)conn_param->ird, (u16)conn_param->ord); + i40iw_record_ird_ord(cm_node, conn_param->ird, conn_param->ord); if (cm_node->send_rdma0_op == SEND_RDMA_READ_ZERO && !cm_node->ord_size) cm_node->ord_size = 1;