Received: by 10.213.65.68 with SMTP id h4csp905187imn; Tue, 27 Mar 2018 10:56:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/b+mjSIr3JqcCO/RQGY3r94iSXBXnbeepTEM/id88eGjFE86+KkphKjPzrJpmYTQ6Cu7rn X-Received: by 10.98.103.199 with SMTP id t68mr259558pfj.24.1522173379123; Tue, 27 Mar 2018 10:56:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522173379; cv=none; d=google.com; s=arc-20160816; b=Y5A6eM2oHUoPSZUtAaO3uqkqjEoX2DjIDFHOiAILKn5Yg2P9/NyaaRE1Dh1b7Kzaay Z6huHJSKdvbjcVUe6c8dBz5yzMeAJ5lC9wAdiefRWzm77qFahht46MPeQGb3RB4BgJ3k SJj0fG/1ZIFidWVxPt41ydM6qpDpAZNCsEcmqQHAFuwcojAJRXe6CAFTN3O3dPzsbxcE KV9zTaJF5SWg6ppcAXfd+ix3833Fzcs4Ujx4VkTBcEJ3ZciYRFecf9krjeKvi+6I5c/0 1tavwKru+6btP5JvV37HFl9zjpz85AgWl7h7dmb1cHChkDuZoIV+G+a2Za24uBykEnD3 98ZQ== 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=xu2WbqOtjIaNPkWzajSd/btPcIUGKS2AHW1+gG8xXdc=; b=Bg4d1/qrq+mlnBt+JhlLvcTjqtAHQ5oovQBrBN44taUPql0kBUcch6WuhXnGq3y7lf szKmLHqN4hAgtPuHD94/DMHeDU2wUiY0c0XI14GsvkNG2SR+eFBejt23uLFXOSYJ0Jdj 9l+gj0ng5AGUWz9Yre9qTQrXTUZKyxPrP4HB3I3uaSWebOhCyuhLOK9YVw5D+1MzOxhR SvRIT3pdR9a2bE1yPmgPkHjBD0nZ0KBeQNrIm/b2aNOkADnZ1UC7tf6miMnb1QJTiHSg /fX0Am0nB7RgALUEJwQcyqsKCBaF/Til905AIa06WnEzF9y8wuGE4PF4adanSZIkl4eE CiVA== 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 34-v6si1668250pln.473.2018.03.27.10.56.04; Tue, 27 Mar 2018 10:56:19 -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 S1753401AbeC0Qbn (ORCPT + 99 others); Tue, 27 Mar 2018 12:31:43 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43036 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752027AbeC0Qbl (ORCPT ); Tue, 27 Mar 2018 12:31:41 -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 0E678F05; Tue, 27 Mar 2018 16:31:40 +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.9 31/67] drm: udl: Properly check framebuffer mmap offsets Date: Tue, 27 Mar 2018 18:27:23 +0200 Message-Id: <20180327162728.725387463@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162726.702411083@linuxfoundation.org> References: <20180327162726.702411083@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.9-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 @@ -158,10 +158,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;