From patchwork Wed Dec 11 10:34:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 3324151 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AA901C0D4A for ; Wed, 11 Dec 2013 10:36:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8CBBE20729 for ; Wed, 11 Dec 2013 10:36:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id EA6B5206D7 for ; Wed, 11 Dec 2013 10:36:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9DB17105795; Wed, 11 Dec 2013 02:36:38 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by gabe.freedesktop.org (Postfix) with ESMTP id 8A21BFB51A for ; Wed, 11 Dec 2013 02:35:03 -0800 (PST) Received: by mail-ee0-f49.google.com with SMTP id c41so2784347eek.36 for ; Wed, 11 Dec 2013 02:35:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tbhz2oa3Tq9fL0JYPUGsHzigWD3iYHG6LHsZPZgKUQs=; b=eQsNHku5xcv4Uz+Zwvat2XXyLZHLV3v6bQLjgQx/VfJVilkrfAKSg6X+ipIJX4bENR SX+pnTdWqWWES8khRYPOyPGTBduICipBztK1DSbQsOVgalYdtmndFkRRjhzBNtJOOaJb sC9OQlssk8MYZFPTU6YdcStcjN9ZARcVWk+k0= 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=tbhz2oa3Tq9fL0JYPUGsHzigWD3iYHG6LHsZPZgKUQs=; b=A8PcR4iWjbif2CAVu/KMFrwrO4dHBwQbjWkkjjsDebxn6xxe2BAWu3SST1HIeP7An4 5o+RQeMIS8VL7RbYZjlYmiGdYo8CzB3psCtdgDuYUukuabsfLVZ3D8rssP4thlaIkoRC FoYHX/2rUkbJETU22P41TflWakM1NpR2I2xSd+1ZLKORhKVlIX+0OhEkK2Oxc5Ay6TSp 5Xk2ESXn4/Pv5MAVSgmZm6u4jREiSdsOUbTgOl6mX5zKZnC+sQQp0T+xsIkFDBIu+qGP d572ilhWOw9ANtiM0FZI/WTOkpCEQPD+l5/s6eGzoO/HAws0k+O7x2VTzYinOtVmp3HH LYbQ== X-Gm-Message-State: ALoCoQkdrdepJUfpcMAAIMUO+OGO0U3riwShEgpIw0fMBVWjdXoinhMWtxx2m6oxz1yCzne6Q9KM X-Received: by 10.14.105.7 with SMTP id j7mr806577eeg.95.1386758102901; Wed, 11 Dec 2013 02:35:02 -0800 (PST) Received: from phenom.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPSA id b41sm51932269eef.16.2013.12.11.02.35.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Dec 2013 02:35:02 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH 25/50] drm: Kill DRM_SUSER Date: Wed, 11 Dec 2013 11:34:46 +0100 Message-Id: <1386758111-3446-26-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1386758111-3446-1-git-send-email-daniel.vetter@ffwll.ch> References: <1386758111-3446-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Checking directly for the right capability is simpler. Also this rids us of a few places that use DRM_CURRENTPID. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +- drivers/gpu/drm/via/via_dma.c | 4 ++-- include/drm/drm_os_linux.h | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 15b86a94949d..99aab8639089 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -593,7 +593,7 @@ int ttm_bo_kmap(struct ttm_buffer_object *bo, if (start_page > bo->num_pages) return -EINVAL; #if 0 - if (num_pages > 1 && !DRM_SUSER(DRM_CURPROC)) + if (num_pages > 1 && !capable(CAP_SYS_ADMIN)) return -EPERM; #endif (void) ttm_mem_io_lock(man, false); diff --git a/drivers/gpu/drm/via/via_dma.c b/drivers/gpu/drm/via/via_dma.c index 5d4179284964..a18479c6b6da 100644 --- a/drivers/gpu/drm/via/via_dma.c +++ b/drivers/gpu/drm/via/via_dma.c @@ -234,13 +234,13 @@ static int via_dma_init(struct drm_device *dev, void *data, struct drm_file *fil switch (init->func) { case VIA_INIT_DMA: - if (!DRM_SUSER(DRM_CURPROC)) + if (!capable(CAP_SYS_ADMIN)) retcode = -EPERM; else retcode = via_initialize(dev, dev_priv, init); break; case VIA_CLEANUP_DMA: - if (!DRM_SUSER(DRM_CURPROC)) + if (!capable(CAP_SYS_ADMIN)) retcode = -EPERM; else retcode = via_dma_cleanup(dev); diff --git a/include/drm/drm_os_linux.h b/include/drm/drm_os_linux.h index 43008938b6b2..86ab99bc0ac5 100644 --- a/include/drm/drm_os_linux.h +++ b/include/drm/drm_os_linux.h @@ -21,7 +21,6 @@ static inline void writeq(u64 val, void __iomem *reg) /** Current process ID */ #define DRM_CURRENTPID task_pid_nr(current) -#define DRM_SUSER(p) capable(CAP_SYS_ADMIN) #define DRM_UDELAY(d) udelay(d) /** Read a byte from a MMIO region */ #define DRM_READ8(map, offset) readb(((void __iomem *)(map)->handle) + (offset))