Received: by 10.192.165.156 with SMTP id m28csp20329imm; Tue, 10 Apr 2018 15:31:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+KDu0V3K9qgQDRGJ037R8Mh3i4rUwKPezxQ7i3qxGRImsVjD/NaNh33caVF0s1tRbFlEWM X-Received: by 10.99.135.199 with SMTP id i190mr1571144pge.2.1523399483008; Tue, 10 Apr 2018 15:31:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523399482; cv=none; d=google.com; s=arc-20160816; b=ahkPIf9KLcoJO/iln3cF5AQFRgZ9QjpIuLjChZB7NvjavmpwLJqAiiIGNNyvkKYX2k EkAVNF16D7Y7lgr1BrdwAeud023gIFDuNVcD0hRGg+a7ELeGasFQA8RCvw/uGfsomw4a b7dYypGNFaAFnCsVNoYO5Wbt6lk27IqgPnKH6YZtFSfk9pg4OTJ0oZlcgGZoWFPQZ1yl JbI56BW5eTASf1ao6OZUZQIJ8O4ozgnQsWsZttHmidIoceuHd6JLY08tMzV1/m7rr+/j JHVggCDHJ44Hw9jkhUrQGFNIA0B7yOcOa0IPBCXIMD0uclhRmVsvRdtdt7odQuP/Nq4H RMJQ== 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=x1Z6LvZBUksDknGWv+/jMGFoPM8RbwFg2CKjMhGTskQ=; b=Kz3SnzJ0tzkr9tC91A8TaJMdLwYxoMlh3CsSnVA/Kwzbuh0hCyx3hx/j8HnGa2gTHB 6ZqtRXEtks3wK+ryXJZt/1/wKvU/mK/DS4s3d36QHfmVrZ4cQwSXaYBbvPiRWwkuhbZM kcNeB2Zac6ynL0Nj0zByTj/Y63QVXidhz0AnR75zzYMrFr3LPuO96+Vi1DV292jxIlQy X5k00QJH+omyuMmvG7QQIgYAnkmD736kiV/qXmMHYdwQfsjvAttAmMfyY7Y8PNZS8I+B yHmzY0rNd/Wf9y6L4Za++9C4Y/cG//6SM340FCfshz3ViOTbWShj6wMcKVhBSpck+UPS 1qyw== 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 f5si2371049pgv.668.2018.04.10.15.30.45; Tue, 10 Apr 2018 15:31:22 -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 S1753061AbeDJW0M (ORCPT + 99 others); Tue, 10 Apr 2018 18:26:12 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37094 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752928AbeDJW0G (ORCPT ); Tue, 10 Apr 2018 18:26:06 -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 4A5E9DC3; Tue, 10 Apr 2018 22:26:05 +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.15 003/168] i40iw: Validate correct IRD/ORD connection parameters Date: Wed, 11 Apr 2018 00:22:25 +0200 Message-Id: <20180410212800.327539566@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@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.15-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; @@ -3849,7 +3850,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;