From patchwork Wed Oct 19 08:24:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4665 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212710wrs; Wed, 19 Oct 2022 02:08:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6JrTndWqG3dhUqUfD/8PiMt5Nnq6p3SiVm2JzUTCK+7s2TCVeSp3k5mgFMva1PeBN4Gr5p X-Received: by 2002:a17:906:cc0b:b0:78e:1d51:36ea with SMTP id ml11-20020a170906cc0b00b0078e1d5136eamr5929717ejb.408.1666170487239; Wed, 19 Oct 2022 02:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170487; cv=none; d=google.com; s=arc-20160816; b=nZZJIh/th2ZVXRJp0Z3IupRQDDh8X3p/o9rNef8/A7MQpjShVyR4HT8ysPDbUk8rFK 7D0b/fkzA1mHo8YwbSzJtLNAZ+mqeOq4Dl32Vs87HO8kJ8P87H1NxjuD5/Cq84TPxDjc YCPH3CkEg5zVs1SPCs5JdBc1I++GEzaV27f7Tkd7waiRQZXA6vwbu3L/pMIIKG8KvUQU ZTkB3f9zakL30YNyNZOYA9Dvz+053ZnDUdTCzV4ZNlTOT5mF1iSeBbZFkxeQZ8jjtlJ9 tqQWgS7wqFPPi98LjoHj/2JWf5L9QHCEQKI+IpA7Jl8370QezxuvjimNegxDf3xF0i3p 0CZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yylzRrqmCCn4p1s9eaVI5uw1JDzJiB63l3R028l55FM=; b=ZDeBjZF+/TS1fIflp2kr6YhkIY9dEaO0blqkGUQRZSTUbpBBXHNQAAzzqaj/eu4b1I zmGIZoUbvqbgPwIg+4HSDul0R7kz+YpElSZaWkUCDGwCu3DM2X6iHiH3GL6bphI4b0c9 4tjsBSgfsWw1RV6+FPWsnnIuCmwjli933uNcrhUUL4544bVHhk16stSo+AjQvEUIV2ux EgIA+McxXOcnC79Q3yOZdIX2k5tJgRIhgCA9wc4thQcLeid1f02XOvIbeTu3WCm9wwV7 PozEA4aYzW643Zv1fR8h+9WCl2wpmFlgWUGwXuujOR7wddWIgttNrXSjYOq1bKgAXlOg lEJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ry50gBDx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a056402519200b004597671e0ddsi13210416edd.338.2022.10.19.02.07.33; Wed, 19 Oct 2022 02:08:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ry50gBDx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232256AbiJSJBd (ORCPT + 99 others); Wed, 19 Oct 2022 05:01:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232211AbiJSI7Q (ORCPT ); Wed, 19 Oct 2022 04:59:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64DF5B1DB; Wed, 19 Oct 2022 01:54:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 88F7F61826; Wed, 19 Oct 2022 08:46:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 923C7C433D6; Wed, 19 Oct 2022 08:46:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169162; bh=qggspGbhOEEOUW1EbtqAEooo2tGTIcHxBbJIIDo0yxU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ry50gBDxajch4Qi/yys3d6u99hBIxkn/PWYehJmxTOSjW6A3fZHedaxDIMIww4Vzh jX2PvP4KqOcihShqpngxNNCsq253bFw2A1xUofW58SaQ4YyhXHs304OBsYIh+I2Pj7 YFEUwE9t5IQebfmXI0x6jrud4wV+fUDd20Y/dq8A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Alex Elder , stable Subject: [PATCH 6.0 179/862] staging: greybus: audio_helper: remove unused and wrong debugfs usage Date: Wed, 19 Oct 2022 10:24:26 +0200 Message-Id: <20221019083257.863955888@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106384627369477?= X-GMAIL-MSGID: =?utf-8?q?1747106384627369477?= From: Greg Kroah-Hartman commit d517cdeb904ddc0cbebcc959d43596426cac40b0 upstream. In the greybus audio_helper code, the debugfs file for the dapm has the potential to be removed and memory will be leaked. There is also the very real potential for this code to remove ALL debugfs entries from the system, and it seems like this is what will really happen if this code ever runs. This all is very wrong as the greybus audio driver did not create this debugfs file, the sound core did and controls the lifespan of it. So remove all of the debugfs logic from the audio_helper code as there's no way it could be correct. If this really is needed, it can come back with a fixup for the incorrect usage of the debugfs_lookup() call which is what caused this to be noticed at all. Cc: Johan Hovold Cc: Alex Elder Cc: Greg Kroah-Hartman Cc: stable Link: https://lore.kernel.org/r/20220902143715.320500-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/audio_helper.c | 11 ----------- 1 file changed, 11 deletions(-) --- a/drivers/staging/greybus/audio_helper.c +++ b/drivers/staging/greybus/audio_helper.c @@ -3,7 +3,6 @@ * Greybus Audio Sound SoC helper APIs */ -#include #include #include #include @@ -116,10 +115,6 @@ int gbaudio_dapm_free_controls(struct sn { int i; struct snd_soc_dapm_widget *w, *tmp_w; -#ifdef CONFIG_DEBUG_FS - struct dentry *parent = dapm->debugfs_dapm; - struct dentry *debugfs_w = NULL; -#endif mutex_lock(&dapm->card->dapm_mutex); for (i = 0; i < num; i++) { @@ -139,12 +134,6 @@ int gbaudio_dapm_free_controls(struct sn continue; } widget++; -#ifdef CONFIG_DEBUG_FS - if (!parent) - debugfs_w = debugfs_lookup(w->name, parent); - debugfs_remove(debugfs_w); - debugfs_w = NULL; -#endif gbaudio_dapm_free_widget(w); } mutex_unlock(&dapm->card->dapm_mutex);