From patchwork Thu Dec 5 14:42:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ilia Mirkin X-Patchwork-Id: 3288821 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 47FD09F373 for ; Thu, 5 Dec 2013 14:43:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 284EA2050E for ; Thu, 5 Dec 2013 14:43:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 74AB12050B for ; Thu, 5 Dec 2013 14:43:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 91822FBA4C; Thu, 5 Dec 2013 06:42:59 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qa0-f47.google.com (mail-qa0-f47.google.com [209.85.216.47]) by gabe.freedesktop.org (Postfix) with ESMTP id 08F7EFBA33 for ; Thu, 5 Dec 2013 06:42:55 -0800 (PST) Received: by mail-qa0-f47.google.com with SMTP id w5so7660929qac.20 for ; Thu, 05 Dec 2013 06:42:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=8xphFAtENoVB+tLczDYke2mZiQzsijqLzBRhS17NCiw=; b=1ApMk/bxYpo8UMuoE96nxvc0nxGOuHGdqEMFku5vo3/6DITvBiZCNd4y3rCBUQF2Jx 40lEdR0UbndRIKEb7pw1TkmqzGmKebc4Nkq8Y6nD6AQA0ZBHrUyNuyODs924IB96zfQe ztYZcTgsLM4rsNpoyGP5kjPiCk/stwhTopnI8Xiult6ftXxRKc5AOoA/rw76MIuBuUg6 sre+up80o/rH+kSOhSriKmId1So7hR45xmSrWnFFqrfBmoGWWElt6xOpSep+StaGJ3XG 51tK8YKFuTQQRYGWuminO3v8mY65baimhGHrYK9BJCNKQQ/iJ3hx8z/C6pErMCzSNCzw HDEQ== X-Received: by 10.224.34.71 with SMTP id k7mr147634912qad.15.1386254574416; Thu, 05 Dec 2013 06:42:54 -0800 (PST) Received: from localhost.localdomain (cpe-74-71-31-84.nyc.res.rr.com. [74.71.31.84]) by mx.google.com with ESMTPSA id o5sm29634927qeg.2.2013.12.05.06.42.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Dec 2013 06:42:53 -0800 (PST) From: Ilia Mirkin To: Dave Airlie Subject: [PATCH v2] drm: don't double-free on driver load error Date: Thu, 5 Dec 2013 09:42:49 -0500 Message-Id: <1386254569-28477-1-git-send-email-imirkin@alum.mit.edu> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: References: MIME-Version: 1.0 Cc: Bruno Premont , dri-devel@lists.freedesktop.org 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: , 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_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 All instances of drm_dev_register are followed by drm_dev_free on failure. Don't free dev->control/render/primary on failure, as they will be freed by drm_dev_free since commit 8f6599da8e (drm: delay minor destruction to drm_dev_free()). Instead unplug them. Reported-by: Bruno Prémont Signed-off-by: Ilia Mirkin Reviewed-by: David Herrmann --- v2: use drm_unplug_minor instead of just removing the puts, as suggested by David Herrman. drivers/gpu/drm/drm_stub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index f53d524..66dd3a0 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c @@ -566,11 +566,11 @@ err_unload: if (dev->driver->unload) dev->driver->unload(dev); err_primary_node: - drm_put_minor(dev->primary); + drm_unplug_minor(dev->primary); err_render_node: - drm_put_minor(dev->render); + drm_unplug_minor(dev->render); err_control_node: - drm_put_minor(dev->control); + drm_unplug_minor(dev->control); err_agp: if (dev->driver->bus->agp_destroy) dev->driver->bus->agp_destroy(dev);