From patchwork Thu Sep 1 12:48:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 9309011 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0629960756 for ; Thu, 1 Sep 2016 12:48:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01DEB29382 for ; Thu, 1 Sep 2016 12:48:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EAC0729386; Thu, 1 Sep 2016 12:48:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A779729382 for ; Thu, 1 Sep 2016 12:48:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7C2D96E935; Thu, 1 Sep 2016 12:48:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 453706E93A for ; Thu, 1 Sep 2016 12:48:55 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id i138so12460479wmf.3 for ; Thu, 01 Sep 2016 05:48:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Y2vlS4prRarb5qSjIwDcpf7ky1FI+0DPOnSphTPU5h8=; b=wydHvqgbfxoFONSYRaWotktUszForF3TLvYAB9aHlPe/wFRJiVS0A1uUOpfIwyla4k bNPmVw90rqfyysbjWHic7dJJ7cQHBedB1r/fOwtQd+qUDZpCUpKMsj3la1rDZHFN6Izx VRcqQjmvLOjvDan6Xtg4zGp6jlQddpVjvR9NO3PjqiFmDd0R+Esi1VQkf+gPVofLnWmc VfQF0EBuXJ1DC4GRbKlRq2fMz18pXH6d/9/2hPuPgdZHwGaPpwriiT66fop4phWPa7P1 p+XebOMtLPo2Jhqb8/IYYQkk/ehNX3lw2ZVZICIY9PoY02x8y9D2ZV2ehH9IqjzcJH8r SdYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Y2vlS4prRarb5qSjIwDcpf7ky1FI+0DPOnSphTPU5h8=; b=AnjJntVu6lgFh8XdtOWlw9ZvBMDLmNbB5/riwRenn4xx0MNctTUoRU1rKy0P6kzmOd 8oAfabALMhNi07SUANkfD8v1Srs6vZDxgoKl+T+gSu6mB1ipzwsH7b9ffI1bX4LZ59Bb aS4k/R5T2/nWNrOUw7eIRg46chzvRMH+7qDBeic3j7zVBymMpOrC/EYdyjsnRzU4Avk1 bk4DNF22pikIKDuOdNRfYYeeqjOx1vxOqhzv2FZfNZa4o0HqZAkzxaRZ+0bEKfLQig32 GiKUxhBApHoxLsOmq968faWJgAyzinh76JT5TEWD49MiTiM119XXJqk4rO1y0jSxRMqx 1TDw== X-Gm-Message-State: AE9vXwM+3jXttrYilaXdHerHee1tjIVLSRoeokKjzLkzUVm5VlPrvCTvtv+BpbUXkZop9Q== X-Received: by 10.28.18.11 with SMTP id 11mr15357610wms.11.1472734133829; Thu, 01 Sep 2016 05:48:53 -0700 (PDT) Received: from localhost.localdomain ([37.120.86.93]) by smtp.gmail.com with ESMTPSA id i8sm14287786wmg.21.2016.09.01.05.48.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Sep 2016 05:48:53 -0700 (PDT) From: David Herrmann To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/6] drm: rename drm_file.filp to drm_file.legacy_filp Date: Thu, 1 Sep 2016 14:48:34 +0200 Message-Id: <20160901124837.680-4-dh.herrmann@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160901124837.680-1-dh.herrmann@gmail.com> References: <20160901124837.680-1-dh.herrmann@gmail.com> Cc: Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP We don't want anyone but legacy DRM1 code to use drm_file.filp. Especially for in-kernel contexts, this might be set to NULL, so lets make sure no-one accesses it, ever. Signed-off-by: David Herrmann --- drivers/gpu/drm/drm_bufs.c | 7 ++++--- drivers/gpu/drm/drm_fops.c | 2 +- include/drm/drmP.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index c3a12cd..d2803de 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -1456,7 +1456,7 @@ int drm_legacy_mapbufs(struct drm_device *dev, void *data, if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) return -EINVAL; - if (!dma) + if (!dma || !file_priv->legacy_filp) return -EINVAL; spin_lock(&dev->buf_lock); @@ -1478,12 +1478,13 @@ int drm_legacy_mapbufs(struct drm_device *dev, void *data, retcode = -EINVAL; goto done; } - virtual = vm_mmap(file_priv->filp, 0, map->size, + virtual = vm_mmap(file_priv->legacy_filp, 0, map->size, PROT_READ | PROT_WRITE, MAP_SHARED, token); } else { - virtual = vm_mmap(file_priv->filp, 0, dma->byte_count, + virtual = vm_mmap(file_priv->legacy_filp, 0, + dma->byte_count, PROT_READ | PROT_WRITE, MAP_SHARED, 0); } diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index e9d66f5..69ef23c 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -198,7 +198,7 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor) return -ENOMEM; filp->private_data = priv; - priv->filp = filp; + priv->legacy_filp = filp; priv->pid = get_pid(task_pid(current)); priv->minor = minor; diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 0f69f56..2197ab1 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -330,7 +330,7 @@ struct drm_file { /** Lock for synchronization of access to object_idr. */ spinlock_t table_lock; - struct file *filp; + struct file *legacy_filp; /* might be NULL! */ void *driver_priv; struct drm_master *master; /* master this node is currently associated with