From patchwork Mon Jan 14 08:44:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 10761749 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 985641390 for ; Mon, 14 Jan 2019 08:47:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89E2F28B8D for ; Mon, 14 Jan 2019 08:47:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E53928BA0; Mon, 14 Jan 2019 08:47:46 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 4852628B8D for ; Mon, 14 Jan 2019 08:47:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4B86A6E5F1; Mon, 14 Jan 2019 08:47:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by gabe.freedesktop.org (Postfix) with ESMTPS id 27A576E5F0 for ; Mon, 14 Jan 2019 08:47:42 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id g67so7911640wmd.2 for ; Mon, 14 Jan 2019 00:47:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pKIrytTacpK803OH2bbb69nNOo573DfkGqRxeyjdqTo=; b=ZpunYJywkWrsBs9kPGcK0mrpHLJuewpEhealcjrYWFJYpt9kdkfw4M376A3/omuh58 Qi4oc5PTl86YgnuNun84W0qC4h8p0/uqJe9YF0paubGVmSMCRAGFQDP2R9WCd2BwtON2 p6mA1PPI6kUlSbSKnC/Pik+1Pav0Mk/B67LepS2DqSA2axDTlkahZG+AQ4keQlDSw6eu ViGqzOPBCig1r1OH/d3LgFfb9gd3F0R6k9AN8g9VepwMgNWjwkKpXCWJuGIQkCRZLRRE zAHVBkbIM0TTsSYeHi5l0VpeuqyuEJEtYXb1TUz6K6G0gxANYOwxB6ONPrAZo68rMtDf x6OA== X-Gm-Message-State: AJcUukcYTcrRw1uAUkbnf1+M5fdmE+lF4l86T4J3KuZ5/tTBC0PlnPTq sXWob2mGqDZRnQoFJ4+eAB7VcJW4 X-Google-Smtp-Source: ALg8bN53++vL351fzZmMIvypyjzacdxNeCMruOMET/Qj2T2+sC2Ke42bzy5ITOtJLlaCNe9aqh0s+g== X-Received: by 2002:a1c:5dd1:: with SMTP id r200mr11325725wmb.93.1547455660537; Mon, 14 Jan 2019 00:47:40 -0800 (PST) Received: from localhost.localdomain (cpc91192-cmbg18-2-0-cust374.5-4.cable.virginm.net. [80.6.113.119]) by smtp.gmail.com with ESMTPSA id 60sm100671845wrb.81.2019.01.14.00.47.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Jan 2019 00:47:40 -0800 (PST) From: Emil Velikov To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/2] drm: plug memory leak on drm_setup() failure Date: Mon, 14 Jan 2019 08:44:10 +0000 Message-Id: <20190114084410.15266-2-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190114084410.15266-1-emil.l.velikov@gmail.com> References: <20190114084410.15266-1-emil.l.velikov@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emil.l.velikov@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Emil Velikov Currently we fail to free and detach the drm_file when drm_setup() fails. Use the drm_close_helper to do address that. Signed-off-by: Emil Velikov Reviewed-by: Daniel Vetter Reviewed-by: Daniel Vetter --- drivers/gpu/drm/drm_file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c index 149506a20bdc..871dcd8c7545 100644 --- a/drivers/gpu/drm/drm_file.c +++ b/drivers/gpu/drm/drm_file.c @@ -330,8 +330,10 @@ int drm_open(struct inode *inode, struct file *filp) goto err_undo; if (need_setup) { retcode = drm_setup(dev); - if (retcode) + if (retcode) { + drm_close_helper(filp); goto err_undo; + } } return 0;