Received: by 10.223.185.116 with SMTP id b49csp1016166wrg; Wed, 21 Feb 2018 10:36:48 -0800 (PST) X-Google-Smtp-Source: AH8x224P2dwd1uWqA4/ZYDXSBTlf/utlS4jjmFRPz6j4NRXAWsJF9NY63drCox7PCO7hMlQRVpAI X-Received: by 10.98.113.67 with SMTP id m64mr4140420pfc.223.1519238207908; Wed, 21 Feb 2018 10:36:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519238207; cv=none; d=google.com; s=arc-20160816; b=M7V6HGKmHFzp/dDKnqP3iXabXxUOb3mq8wgrKtmY5nv1LQOZB59TMBzYxHhZpId+Dk XVGk3cF51kWmeYlLHodJ/lcWPGXig428COVXanO5gVr0yzx2x8g9ZeHlLBAMFBgr5CMB 0kqispfG9XwsMvRsGVEvI38+2mj/bYsxN36fjdwR3X4a7FC/OxAKNRQGca3L9/td3Flh TPjMt4H+4RUW++f+MjUHPFVjQh4FyxPzrxp26SDPhKvt0nTlMxGTZ+o/eQPc9QiCKbo+ QXGk/pZFOmcuD3FbeRUTZ5kTnWCIiMfxvUB28Uj727xaQMAE7kkkm4TQkNebWgP7Jj7i BoqA== 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=3WF27ibOTssIxDxpMzhHALqjHU3hhHIOwk1ZwXwkSNE=; b=YSRhswQLXYzYsglahcHyrOXDfJN26epgosa3eBRSZvEhzlozkztyH6Y/fNy25REdaH WwYRJZxzpcqIXqMux9JtAEfVudLe2Nz+mepP95i1SEP5L9Hd4KfXUzDkdThrfhCVmnUQ BSJjsil5eSUjJYmjHA5wfx/nUuuAGAhnxWZpM2P0guxQif9qqzj6/lI5Pv3xMr5OJ4Gm Z1BXaKCgOHzsky0W1jsc/eTabXfmFKsF3QF2MNzem7ued7tXNRpPY1HWbyeGxQmJnNPi MoAlyygdGNWTUJn5frX9ycwSgVDzi2zACJWr2YUz1nDJSbL+U6fRuTUzCq4nE4QQ5wix H6OQ== 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 c3-v6si1470406plo.708.2018.02.21.10.36.33; Wed, 21 Feb 2018 10:36:47 -0800 (PST) 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 S936311AbeBUNLN (ORCPT + 99 others); Wed, 21 Feb 2018 08:11:13 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:44488 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936292AbeBUNLK (ORCPT ); Wed, 21 Feb 2018 08:11:10 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 620CA1237; Wed, 21 Feb 2018 13:10:39 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Keith Packard , Daniel Vetter Subject: [PATCH 4.15 094/163] drm: Check for lessee in DROP_MASTER ioctl Date: Wed, 21 Feb 2018 13:48:43 +0100 Message-Id: <20180221124535.525590662@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124529.931834518@linuxfoundation.org> References: <20180221124529.931834518@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: Keith Packard commit 761e05a702f5d537ffcca1ba933f9f0a968aa022 upstream. Don't let a lessee control what the current DRM master is set to; that's the job of the "real" master. Otherwise, the lessee would disable all access to master operations for the owner and all lessees under it. This matches the same check made in the SET_MASTER ioctl. Signed-off-by: Keith Packard Fixes: 2ed077e467ee ("drm: Add drm_object lease infrastructure [v5]") Cc: # v4.15+ Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20180119015159.1606-1-keithp@keithp.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/drm_auth.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/gpu/drm/drm_auth.c +++ b/drivers/gpu/drm/drm_auth.c @@ -230,6 +230,12 @@ int drm_dropmaster_ioctl(struct drm_devi if (!dev->master) goto out_unlock; + if (file_priv->master->lessor != NULL) { + DRM_DEBUG_LEASE("Attempt to drop lessee %d as master\n", file_priv->master->lessee_id); + ret = -EINVAL; + goto out_unlock; + } + ret = 0; drm_drop_master(dev, file_priv); out_unlock: