From patchwork Thu Dec 12 17:07:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 3333341 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EE3FA9F243 for ; Thu, 12 Dec 2013 17:07:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AE65F206DD for ; Thu, 12 Dec 2013 17:07:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9D73C206CB for ; Thu, 12 Dec 2013 17:07:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D0C4FB721; Thu, 12 Dec 2013 09:07:46 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qe0-f44.google.com (mail-qe0-f44.google.com [209.85.128.44]) by gabe.freedesktop.org (Postfix) with ESMTP id E0EBFFB721 for ; Thu, 12 Dec 2013 09:07:43 -0800 (PST) Received: by mail-qe0-f44.google.com with SMTP id nd7so576499qeb.17 for ; Thu, 12 Dec 2013 09:07:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=55d7KRfX1cwSOTmrfqw5cVzD9wZtv852122OoUKBbqo=; b=XfNJNbVRa34K66FjMkTnwEudkzO6rN6s4pYfOAD5BdDZXJLvMCH0mXZBBswaWDTmxm 0gwZZnmHN6WvKJQjPQh3UD8dQjNoKZaj2ijFWAPdFe8HuAlFGiA+65utdN2cBjzdTaCR 8q6A0DRjZkx6ms8VKd7MoD0jeeofZ/iPeXmUg5MORQPqEj6I2+ML7HrfhiX0fcWcsdGW zcYS1n0VUXc2v+ZLc6BQWu37yWzGEsJaE1/pnen8WksevCSkcQvdE9y3obtpFwgZ0uCT t1i1eJEgTccWi6Z/uQjT61A0DcsN3LR68dyBTXnn8DXmQfCp1OWGUpOggQlOR9EoMvZn 0UMA== X-Received: by 10.224.156.77 with SMTP id v13mr4581841qaw.80.1386868062269; Thu, 12 Dec 2013 09:07:42 -0800 (PST) Received: from localhost (nat-pool-bos-t.redhat.com. [66.187.233.206]) by mx.google.com with ESMTPSA id i7sm65354042qeo.7.2013.12.12.09.07.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2013 09:07:41 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm: fix double drm_put_minor() in fail paths Date: Thu, 12 Dec 2013 12:07:39 -0500 Message-Id: <1386868059-30511-1-git-send-email-robdclark@gmail.com> X-Mailer: git-send-email 1.8.4.2 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.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 If driver failed to load (for example, -EPROBE_DEFER), we'd end up doing drm_put_minor() both from drm_dev_register() and drm_dev_free(), the second time with a bogus pointer. Signed-off-by: Rob Clark --- drivers/gpu/drm/drm_stub.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index f53d524..f245d99 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c @@ -567,10 +567,13 @@ err_unload: dev->driver->unload(dev); err_primary_node: drm_put_minor(dev->primary); + dev->primary = NULL; err_render_node: drm_put_minor(dev->render); + dev->render = NULL; err_control_node: drm_put_minor(dev->control); + dev->control = NULL; err_agp: if (dev->driver->bus->agp_destroy) dev->driver->bus->agp_destroy(dev);