From patchwork Fri Nov 20 11:03:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 329892 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08974C64E7C for ; Fri, 20 Nov 2020 11:05:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8B8D206E3 for ; Fri, 20 Nov 2020 11:05:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Un8wmgwk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728065AbgKTLFB (ORCPT ); Fri, 20 Nov 2020 06:05:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:52500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726460AbgKTLFA (ORCPT ); Fri, 20 Nov 2020 06:05:00 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5396A2245A; Fri, 20 Nov 2020 11:04:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1605870300; bh=bG11z9d9Iux42UdMLwXXlg6Ly5O/9t6T0TpysOcERLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Un8wmgwk/WC0vxHXVOSNJZVhJ6dXizBAUnRw5dX/6fgkYoAfhCOGa/j4Xv3/GG5ZU JpCE9n14cegbOv+/W4I7Ju0LL00NjehXqOm6UQgkzJ6OVxDLG1hVKL/0KZxmmmvHy2 zS2GZLNiTbrTQrQ3tM1s+azeGll9gyXHAjvdVB50= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bartosz Golaszewski , Andy Shevchenko , Sudip Mukherjee Subject: [PATCH 4.14 11/17] gpio: mockup: fix resource leak in error path Date: Fri, 20 Nov 2020 12:03:22 +0100 Message-Id: <20201120104540.973074513@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201120104540.414709708@linuxfoundation.org> References: <20201120104540.414709708@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Bartosz Golaszewski commit 1b02d9e770cd7087f34c743f85ccf5ea8372b047 upstream If the module init function fails after creating the debugs directory, it's never removed. Add proper cleanup calls to avoid this resource leak. Fixes: 9202ba2397d1 ("gpio: mockup: implement event injecting over debugfs") Cc: Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko [sudip: adjust context] Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpio-mockup.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/gpio/gpio-mockup.c +++ b/drivers/gpio/gpio-mockup.c @@ -350,6 +350,7 @@ static int __init mock_device_init(void) err = platform_driver_register(&gpio_mockup_driver); if (err) { platform_device_unregister(pdev); + debugfs_remove_recursive(gpio_mockup_dbg_dir); return err; }