[alsa-devel] [RFC PATCH 0/3] Fixes for component unregister and remove

Ranjani Sridharan ranjani.sridharan at linux.intel.com
Fri Apr 5 02:30:37 CEST 2019


This set of patches aims to fix the problems seen during
module unloading with the skylake driver and also with SOF.
The sequence seen during snd_soc_skl module unload is that the
machine driver in unregistered first which frees the snd_card.
When the component driver is unregistered following this
and the topology is unloaded, a null pointer dereference
is encountered while removing the kcontrols because the snd_card
has already been freed.

The first 2 patches fix this by removing the topology unloading
from component_unregister() and moving it to the component
remove() callback. This also makes the register_component()
and unregister_component() calls balanced.

But this still doesnt solve the problem entirely because
the component driver's remove() callback is invoked
after soc_cleanup_card_resources() which frees the snd_card.
And we encounter the same null pointer dereference seen
while remving the kcontrols added to the snd_card.

In order to avoid this problem, the third patch proposes to
remove the link components in snd_soc_unbind_card() before
soc_cleanup_card_resources(). This way, the snd_card()
will remain valid when the topology is unloaded.

Ranjani Sridharan (3):
  ASoC: core: do not unload topology in unregister_component()
  ASoC: intel: skylake: add remove() callback for component driver
  ASoC: core: remove link components before cleaning up card resources

 sound/soc/intel/skylake/skl-pcm.c |  7 +++++++
 sound/soc/soc-core.c              | 13 +++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

-- 
2.17.1



More information about the Alsa-devel mailing list