Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2216797imm; Thu, 7 Jun 2018 07:13:17 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK6+FbbEAOHvKuvptdnBzmCdOeG8nJbkJHbyhcHk0NCXmwZ0zL0OZbQ/uuMU1msVAHRS1Wi X-Received: by 2002:a17:902:6e4:: with SMTP id 91-v6mr2229573plh.63.1528380796982; Thu, 07 Jun 2018 07:13:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528380796; cv=none; d=google.com; s=arc-20160816; b=te0KAWLOKtG+ZdC8muud6w3iJLMqeGX7ZPJfu/nuT11IQtCD6yxiTajBcAi/KJu9BS R0LCsRsTPvoH9x4XvUNCdgp542QuXfSVsKWW6ka99mheP8RWcACfAFaIALHGT5E0zM1w x9ANYbYP+C8SV9xfzwIFJWbTVhfzfoYRk42GcCoJT81XGhGR77lTYpgqrmfHKN2njtx0 XTJaWaXMBlPtRm1mCMWeWcUKvrhW3EXjM+CtmpkjmFnHAZgATqJpiORUC1ZJTyVKydkq eBYAF8WBJvQ4X7MlMNYrzesgPkODGFA4WlPj4G6jhR4I2nYv+F+x96qFLly3z56Bczrc MmkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=/OUmgDoXvxn2GWvXXj2ytNCne4w+Bw80vWftW+EJq9o=; b=S4dds+yLTHZZi417ISjvBksD4lEQS17OTM0NmF9WwMwLgqsEPH9u43H+Kd6/SXTKsB hsjd8NvVXoUh+REkub/+xAulc8ZG0aBZEaDSPTzDWejKbuiTjMg/G0D8Vgy2u9upDuf5 5n1tU669CFdfbmOu2pe1b0XtcUwy+8Q9NpYwUvH9EAWStPg1BZBMLSF1Hn8z5CSWyj0C L0YoYKxuWHHe9oTEFLwNLF4zKllcus/LZCwSa9QojhL7vY1vf9LcuWmox3/FT6AATXjI iYxgRRnu3ptnV6fMxLrm2ZAB9rc/VJUUkHzD/2c9p/h5Hkev07mmBhBLmhrui0EsZ/0N 0eaQ== 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 b8-v6si56233000pls.261.2018.06.07.07.13.02; Thu, 07 Jun 2018 07:13:16 -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 S933180AbeFGOJp (ORCPT + 99 others); Thu, 7 Jun 2018 10:09:45 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:39446 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932921AbeFGOJf (ORCPT ); Thu, 7 Jun 2018 10:09:35 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvbM-0005Zp-So; Thu, 07 Jun 2018 15:09:21 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvbE-0003Hh-3X; Thu, 07 Jun 2018 15:09:12 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Jason Gunthorpe" , "Shiraz Saleem" , "Leon Romanovsky" , "Chien Tin Tung" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 384/410] RDMA/ucma: Correct option size check using optlen In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Chien Tin Tung commit 5f3e3b85cc0a5eae1c46d72e47d3de7bf208d9e2 upstream. 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: Ben Hutchings --- 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 @@ -1200,7 +1200,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,