Received: by 10.213.65.68 with SMTP id h4csp882538imn; Tue, 27 Mar 2018 10:31:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/4gBWNkMajQdl8O96lPRGclKgW6Wf7aixeFkSb1nA9f76BqEAbHKSXEfJRNAu0my11PXYO X-Received: by 10.167.131.135 with SMTP id u7mr197569pfm.50.1522171871549; Tue, 27 Mar 2018 10:31:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522171871; cv=none; d=google.com; s=arc-20160816; b=qzqmgvgkpEvvxiHeTxGlfpZIRjETVL0zXMRFDYvk8H326zsNa9V6l2RD+Ga8iqQM7F dawlQTl9i0w28MOkVpzzWJeHmRGDoI3wrT7aR4csZhJ1fTMoLZYxcdJiLRwh5n8vnxgH rwp69bwODvBnKFOjRP8GtG/eIACjyh+nji6Lh5leJ+AG+ijH+Hf+emP2RoTj5p/U5wDf Sd2wqYyjT7vcUZh8wd3eGf/9T9MitOWkQ5uKqDgLfGqpHNrsj8SkM9FFYbhO6nC0/JtG 3D835eLk3IiDwTSzJ+b2k3CyijZ0sseRUttQ36CDWCCMRIowoWSHlWmWwOOacA1vWvtl dVtA== 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=zPXcZQm7bUc5WSWGJjvgNiEoaiIGtElcj42CZzdAtUQ=; b=o/injPXxbiMY6BJEQSXamk5cHV7goiWCBGoQc9vkWXhUtNzoywum1fz04lq3XSbHle DH+5RDw7pUQ+RTEsJSMJf/TDmQnRs8fo43Es5RqfJ1S01gt8HVwag8PfX8DGkbdiveZa Un4h4AbbJVFJW8Xon2/TZdzNR6FsElU51UjeObQSKSF2EnE0dycqr6rSfgf1Ljylzxip G8Q6hka4qrK8EpDWmYdMyi2Z/J8KPVFUTlfoxtPDhz8aYnF3xwkxSsxbC2LjYryDOhin 3EKQIvKwzRnYnL/1UfWFZZX4RDQDfIPGM2YwoLHzwQLnpqmZ0/AlmANgnk2723snmjTZ xEuA== 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 z196si1131433pgz.349.2018.03.27.10.30.56; Tue, 27 Mar 2018 10:31:11 -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 S1754681AbeC0QgS (ORCPT + 99 others); Tue, 27 Mar 2018 12:36:18 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45698 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751486AbeC0QgQ (ORCPT ); Tue, 27 Mar 2018 12:36:16 -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 929D2E10; Tue, 27 Mar 2018 16:36:15 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eyal Itkin , Daniel Vetter Subject: [PATCH 4.14 057/101] drm: udl: Properly check framebuffer mmap offsets Date: Tue, 27 Mar 2018 18:27:29 +0200 Message-Id: <20180327162753.489597499@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162749.993880276@linuxfoundation.org> References: <20180327162749.993880276@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: Greg Kroah-Hartman commit 3b82a4db8eaccce735dffd50b4d4e1578099b8e8 upstream. The memmap options sent to the udl framebuffer driver were not being checked for all sets of possible crazy values. Fix this up by properly bounding the allowed values. Reported-by: Eyal Itkin Cc: stable Signed-off-by: Greg Kroah-Hartman Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20180321154553.GA18454@kroah.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/udl/udl_fb.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/udl/udl_fb.c +++ b/drivers/gpu/drm/udl/udl_fb.c @@ -159,10 +159,15 @@ static int udl_fb_mmap(struct fb_info *i { unsigned long start = vma->vm_start; unsigned long size = vma->vm_end - vma->vm_start; - unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; + unsigned long offset; unsigned long page, pos; - if (offset + size > info->fix.smem_len) + if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) + return -EINVAL; + + offset = vma->vm_pgoff << PAGE_SHIFT; + + if (offset > info->fix.smem_len || size > info->fix.smem_len - offset) return -EINVAL; pos = (unsigned long)info->fix.smem_start + offset;