Commit 90a409aa authored by Takashi Iwai's avatar Takashi Iwai

ALSA: info: Fix leaks of child entries at snd_info_free_entry()

snd_info_free_entry() releases the all children nodes as well, but due
to the wrong timing of releasing the link, the children nodes may be
disconnected but left unreleased.  This patch fixes it by moving the
link free at the right position.  Also it eases list_for_each_entry()
without _safe option in snd_info_disconnect() because it no longer
frees the children nodes there.

Fixes: c560a679 ('ALSA: core: Remove child proc file elements recursively')
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 1a5bc8d9
...@@ -738,13 +738,12 @@ EXPORT_SYMBOL(snd_info_create_card_entry); ...@@ -738,13 +738,12 @@ EXPORT_SYMBOL(snd_info_create_card_entry);
static void snd_info_disconnect(struct snd_info_entry *entry) static void snd_info_disconnect(struct snd_info_entry *entry)
{ {
struct snd_info_entry *p, *n; struct snd_info_entry *p;
if (!entry->p) if (!entry->p)
return; return;
list_for_each_entry_safe(p, n, &entry->children, list) list_for_each_entry(p, &entry->children, list)
snd_info_disconnect(p); snd_info_disconnect(p);
list_del_init(&entry->list);
proc_remove(entry->p); proc_remove(entry->p);
entry->p = NULL; entry->p = NULL;
} }
...@@ -771,6 +770,7 @@ void snd_info_free_entry(struct snd_info_entry * entry) ...@@ -771,6 +770,7 @@ void snd_info_free_entry(struct snd_info_entry * entry)
list_for_each_entry_safe(p, n, &entry->children, list) list_for_each_entry_safe(p, n, &entry->children, list)
snd_info_free_entry(p); snd_info_free_entry(p);
list_del(&entry->list);
kfree(entry->name); kfree(entry->name);
if (entry->private_free) if (entry->private_free)
entry->private_free(entry); entry->private_free(entry);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment