Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2317917imm; Mon, 28 May 2018 06:00:49 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLoom5zdFHMfmvE6EzF5CmEL2H+36RZ8CX9TLDZzX9JZHllgYLBZPY+R7JL7FNWMacZKUmW X-Received: by 2002:a63:a44a:: with SMTP id c10-v6mr4879357pgp.198.1527512449154; Mon, 28 May 2018 06:00:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527512449; cv=none; d=google.com; s=arc-20160816; b=gSh/Sw9d73qnvNOWYsa8zT3Xa/N5WvwScc3Mz9pYlYI3WLFKUaGqHESH9bSoMK/fCg sac19cmbMpARfZCX3d7Tq48qUjN62hDfHbBiHo/+FyGmvIsE0pofQGkt7F/I0KfGrhYn TBlPp9AGSEL817WNTOkiIYRqbLzNZqwBa1OJiOzeAElwA3rIU8IRiY+5DaRXS9S5Op/J sB1OGRp3O0EKqJrOs5q70i0NOzw7MfCgdoJ0RvYyYgLrLDzyJ4JoLtCDODbBs/4LeXdm DelrkLJNh5EcN9dE0dHr3WCgVZr07ZgBvrt6H1gmYXBRF3KdQ01SivCWK2VcYCUfPokA J9WQ== 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:dkim-signature :arc-authentication-results; bh=gYUp+pJtGt8DD2I/UrfUMbbWzKX35tnocHzKZ0CSHNU=; b=nToLNa6p0Svvb4olnH+WDfUMwgeFBH6MIhryuUiE+RQGzOv95LQAswQE9/FzFzQo7T s4gqWqaEn7+fcVa0JIaSzfnZWuWkEWodB18OtGxJqmfhzJd5k9/bR4feG8UlhpjfzMH9 dRv0rlkSGmIGZlEY7r1ecwzu+odop3YD7lLCEnA8/4JHHkOZICvZiOlssgSQqOZlze2e bRbOaWkaFuWNIezrHiQqX/xthSIscJRR4p9AUhWGWuzcrbDNvyyYZ31W21s+7/mwHsd6 +btJJDVz30LozvYva7QEwY1XqM1u+1yAXPnDB9dKdUGMyIPDgY2wVXSJ7+QjzsLNvLdR ldug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lVj1CbEb; 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 x10-v6si29341163plv.1.2018.05.28.06.00.34; Mon, 28 May 2018 06:00:49 -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; dkim=pass header.i=@kernel.org header.s=default header.b=lVj1CbEb; 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 S1164206AbeE1Kxv (ORCPT + 99 others); Mon, 28 May 2018 06:53:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:42808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163766AbeE1Kxn (ORCPT ); Mon, 28 May 2018 06:53:43 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 97D0620845; Mon, 28 May 2018 10:53:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504823; bh=LSXkIMMMXzYmbJHU3fJBDLKBY8petqt5QsOp8iuTOwQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lVj1CbEbDcb5F8IJK4fndPq5iMQZPNHt+ypM1lbEtU0/qzsVduP+yvxJRlOukO2KN ZHZcneU9Dx6RiE2zjnVDx/HI2gAosnejsz4yCvXEgZHBq664EJ3UG65HIB+VM9kBdU MSr/ZEcobzJyhe3HRNiuOAeTv514kkGPuyEvfjSc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chien Tin Tung , Shiraz Saleem , Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.14 275/496] RDMA/ucma: Correct option size check using optlen Date: Mon, 28 May 2018 12:01:00 +0200 Message-Id: <20180528100331.435301840@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@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: Chien Tin Tung [ Upstream commit 5f3e3b85cc0a5eae1c46d72e47d3de7bf208d9e2 ] The option size check is using optval instead of optlen causing the set option call to fail. Use the correct field, optlen, for size check. Fixes: 6a21dfc0d0db ("RDMA/ucma: Limit possible option size") Signed-off-by: Chien Tin Tung Signed-off-by: Shiraz Saleem Reviewed-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/core/ucma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c @@ -1315,7 +1315,7 @@ static ssize_t ucma_set_option(struct uc if (IS_ERR(ctx)) return PTR_ERR(ctx); - if (unlikely(cmd.optval > KMALLOC_MAX_SIZE)) + if (unlikely(cmd.optlen > KMALLOC_MAX_SIZE)) return -EINVAL; optval = memdup_user((void __user *) (unsigned long) cmd.optval,