Received: by 10.213.65.68 with SMTP id h4csp839353imn; Tue, 27 Mar 2018 09:44:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+suzHCn+HmAsvWyk1MnimeyYjNR5xIeeTheKbVjhV0JW6J50wtKD59QsfkNvLUF3/w233B X-Received: by 2002:a17:902:8f97:: with SMTP id z23-v6mr83377plo.162.1522169041038; Tue, 27 Mar 2018 09:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522169040; cv=none; d=google.com; s=arc-20160816; b=S/ZahVAOZ10QnvY/F6gx92G3Z2Eu66SyiSV6mbBr2hBe67B89phb2n1QHx2u+g1+Yh 8bzCnMC7rXaM4gzfWfyJ9NJ0L7h6aKrn6eCTZxcF9RZAOBRy4eP/EYf50lcZ06n/Df/j S9etq2lF4Ax1dD7V5f9XwPEwsyPRLQmFK+PScE1QphnrRaKz+/EGfqRMoRXOWplggvof dLW3od8+cfP5bIvtIGCWbiDC+DgHh5S2dJUlsIrGOd77U5CN681c/kHgVIxdunneH/r7 ioIdztlMt7xKIv1TWINx8wkKhq7fOcEwXDAyVT/HpwVU8Z7BGbF0w20yUQhOTBTZLReh JlWg== 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=TJ15ybpqN6vWDX8f5b1sjuu5j9ffWZGGWJhjLtiGaCM=; b=iyFM4jE0ctGvpyuOquxOO40BrGj2TPyUCBpPelZAcqgX0YQm6JAuhBzklIziCTpF2H vW6cMfEIET53g80fheDKxyTxorkizzHI4QQqMtTTDai6nmuNnp1KTAtRUGDRY/woFAmM 1G87K/EKRG6sL00UpEBDRq+PW8gXATzthwp72LYxnqtnOwC01MN96twe3qyoJkN/137k lmvYbRIg6nr+dVSzavOX5Y7u1uK3oB1+/wy26ILkJ8LVAW1b71bdTmzFAaVJ39WDVOOi +gxovWvfg9LPIzYJ1ozreXFUpuod0gvOsq1yQajbY83jYsNPeB2dpw0j+BjmWOJxFfOi z1DA== 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 s3si1261150pfj.50.2018.03.27.09.43.46; Tue, 27 Mar 2018 09:44:00 -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 S932504AbeC0QlK (ORCPT + 99 others); Tue, 27 Mar 2018 12:41:10 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48592 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932217AbeC0QlG (ORCPT ); Tue, 27 Mar 2018 12:41: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 344637A8; Tue, 27 Mar 2018 16:41:06 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Stone , Daniel van Vugt , Rob Clark , Daniel Vetter Subject: [PATCH 4.15 060/105] drm: Reject getfb for multi-plane framebuffers Date: Tue, 27 Mar 2018 18:27:40 +0200 Message-Id: <20180327162801.223025067@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162757.813009222@linuxfoundation.org> References: <20180327162757.813009222@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: Daniel Stone commit b24791fe00f8b089d5b10cb7bcc4e1ae88b4831b upstream. getfb can only return a single plane, so reject attempts to use it with multi-plane framebuffers. Signed-off-by: Daniel Stone Reported-by: Daniel van Vugt Reviewed-by: Rob Clark Reviewed-by: Daniel Vetter Fixes: 308e5bcbdb10 ("drm: add an fb creation ioctl that takes a pixel format v5") Cc: stable@vger.kernel.org # v3.3+ Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105518 Link: https://patchwork.freedesktop.org/patch/msgid/20180320225839.30905-1-daniels@collabora.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/drm_framebuffer.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -458,6 +458,12 @@ int drm_mode_getfb(struct drm_device *de if (!fb) return -ENOENT; + /* Multi-planar framebuffers need getfb2. */ + if (fb->format->num_planes > 1) { + ret = -EINVAL; + goto out; + } + r->height = fb->height; r->width = fb->width; r->depth = fb->format->depth; @@ -481,6 +487,7 @@ int drm_mode_getfb(struct drm_device *de ret = -ENODEV; } +out: drm_framebuffer_put(fb); return ret;