mirror of
https://github.com/torvalds/linux.git
synced 2026-11-09 13:44:03 +01:00
ALSA: info: Fix memory leak at card removal
The fix for potential deadlock at disconnection by the commitc7a6065195("ALSA: info: Fix potential deadlock at disconnection") clears card->proc_root pointer at snd_info_card_disconnect(), in order just to be sure. But this leads to a memory leak of card->proc_root content that should have been released at a later call of snd_info_card_free(). For addressing the memory leak, simply drop the card->proc_root clearance at snd_info_card_disconnect(). Since card->proc_root might be still looked at in snd_info_card_id_change() that may be running concurrently during the connection procedure, add a sanity check there, too. Fixes:c7a6065195("ALSA: info: Fix potential deadlock at disconnection") Reported-by: Sashiko <sashiko-bot@kernel.org> Closes: https://sashiko.dev/#/patchset/20261006174002.703431-1-tiwai%40suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20261007172533.14667-5-tiwai@suse.de
This commit is contained in:
parent
7973a5fb95
commit
a3e8eec769
|
|
@ -528,6 +528,8 @@ int snd_info_card_register(struct snd_card *card)
|
|||
void snd_info_card_id_change(struct snd_card *card)
|
||||
{
|
||||
guard(mutex)(&info_mutex);
|
||||
if (card->shutdown)
|
||||
return;
|
||||
if (card->proc_root_link) {
|
||||
proc_remove(card->proc_root_link);
|
||||
card->proc_root_link = NULL;
|
||||
|
|
@ -555,7 +557,6 @@ void snd_info_card_disconnect(struct snd_card *card)
|
|||
if (card->proc_root)
|
||||
snd_info_clear_entries(card->proc_root);
|
||||
card->proc_root_link = NULL;
|
||||
card->proc_root = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user