staging: greybus: audio_helper: remove unused and wrong debugfs usage
Greg Kroah-Hartman
maintainerPATCH 1/1 staging: greybus: audio_helper: remove unused and wrong debugfs usage
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.
--- drivers/staging/greybus/audio_helper.c | 11 ----------- 1 file changed, 11 deletions(-)
drivers/staging/greybus/audio_helper.c +0 -11
@@ -3,7 +3,6 @@* Greybus Audio Sound SoC helper APIs */ -#include <linux/debugfs.h> #include <sound/core.h> #include <sound/soc.h> #include <sound/soc-dapm.h>
@@ -116,10 +115,6 @@ int gbaudio_dapm_free_controls(struct snd_soc_dapm_context *dapm, {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 snd_soc_dapm_context *dapm,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);
Signature · 1 line
2.37.3
Quoted 7 lines · Greg Kroah-Hartman
In the greybus
audio_helpercode, 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.
Yeah, this looks very broken indeed.
Quoted 5 lines
So remove all of the debugfs logic from the
audio_helpercode 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 thedebugfs_lookup()call which is what caused this to be noticed at all.
Quoted 7 lines
Cc Johan Hovold <[email protected]>Cc Alex Elder <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc stable <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
I know this has already been applied, but still:
Greg Kroah-Hartman
maintainerQuoted 24 lines · Johan Hovold
Quoted 7 lines · Greg Kroah-Hartman
In the greybus
audio_helpercode, 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.Yeah, this looks very broken indeed.
Quoted 5 lines
So remove all of the debugfs logic from the
audio_helpercode 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 thedebugfs_lookup()call which is what caused this to be noticed at all.Quoted 7 lines
Cc Johan Hovold <[email protected]>Cc Alex Elder <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc stable <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 3 lines
I know this has already been applied, but still:
Acked-by Johan Hovold <[email protected]>
Thanks for the review, much appreciated.
greg k-h