From patchwork Thu Aug 8 13:41:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 2841242 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 6B87EBF546 for ; Thu, 8 Aug 2013 14:24:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E34FE204E2 for ; Thu, 8 Aug 2013 14:24:24 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D69D3204D7 for ; Thu, 8 Aug 2013 14:24:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0EBA7E689A for ; Thu, 8 Aug 2013 07:24:18 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ee0-f46.google.com (mail-ee0-f46.google.com [74.125.83.46]) by gabe.freedesktop.org (Postfix) with ESMTP id ED04DE6856 for ; Thu, 8 Aug 2013 06:42:11 -0700 (PDT) Received: by mail-ee0-f46.google.com with SMTP id c13so1516818eek.33 for ; Thu, 08 Aug 2013 06:42:11 -0700 (PDT) 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=bVxR/8GUTpO7qFxiyjkpra4zNqqt/EXGKZOwI1U8KTw=; b=dwkwjfXJ9R2kRtKAPhQwpFdSqUN1Qi4qwcZaZ1JdNeQdG2GEKmrPQPO5Mx+NR0YP+y uIIG1t4wXsoBgqa7bnSkpxa2+2N3t41Zu+ZjlklOTQuH/zKkY4n+IZp96slqmKXOpPqR rmnP/o/7CHDyyhmsp8s69GZk75pHEXR7yMxHA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bVxR/8GUTpO7qFxiyjkpra4zNqqt/EXGKZOwI1U8KTw=; b=NCKsGPB/5ShtT2hx2I+/hVJe1uiAstHrfB9MpOT+vKch6w7O5XEvBVaU+ymf/SSlsg PT9sy3BY3yq6kUz0/qU/zuIA6VvWtWGgi65M7ajrsApBARGzYsDtyoxG1ZMFAKYEnt3j Tph+wDCUpUJ2frNrBPWsrWhPd5QYSajtLJkjw+uFErYyRh7CIRtjomvFKIT27VyCSqMp nauMXM9maP57Dkx8+0rBm6fyhMu2rnTrw8Tk/5jb252Gv+w5QgCF+nO4Xj71fLpBKAts OXMD7vY65WTIn52hdyfefC8+dslv1MADtThByk9FAXgB3NTy7y5NDKSHRqsxJak91yV4 6a0Q== X-Gm-Message-State: ALoCoQk+h3Lx4JAhcT9fKjCO0erRe9Gz+Me5sKxMT/PitqlmYtc9lFD5fjV4r6wWPVMGuLLqRru+ X-Received: by 10.15.31.9 with SMTP id x9mr8285126eeu.103.1375969331232; Thu, 08 Aug 2013 06:42:11 -0700 (PDT) Received: from phenom.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPSA id bn13sm19282226eeb.11.2013.08.08.06.42.09 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 08 Aug 2013 06:42:10 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 23/25] drm: fix locking in gem debugfs/procfs file Date: Thu, 8 Aug 2013 15:41:33 +0200 Message-Id: <1375969295-18929-24-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1375969295-18929-1-git-send-email-daniel.vetter@ffwll.ch> References: <1375969295-18929-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+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.1 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 The idr is protected with our spinlock, if we don't hold that nothing prevents the gem objects from disappearing from under us. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_info.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c index d4b20ce..9f8fc4c 100644 --- a/drivers/gpu/drm/drm_info.c +++ b/drivers/gpu/drm/drm_info.c @@ -218,7 +218,11 @@ int drm_gem_name_info(struct seq_file *m, void *data) struct drm_device *dev = node->minor->dev; seq_printf(m, " name size handles refcount\n"); + + spin_lock(&dev->object_name_lock); idr_for_each(&dev->object_name_idr, drm_gem_one_name_info, m); + spin_unlock(&dev->object_name_lock); + return 0; }