From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH 0/4] ALSA: fireworks/bebob/dice/oxfw: fix kernel oops at unplugging during streaming Date: Mon, 23 Feb 2015 09:18:27 +0100 Message-ID: References: <1424530500-9116-1-git-send-email-o-takashi@sakamocchi.jp> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id CFDCD260437 for ; Mon, 23 Feb 2015 09:18:32 +0100 (CET) In-Reply-To: <1424530500-9116-1-git-send-email-o-takashi@sakamocchi.jp> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Takashi Sakamoto Cc: alsa-devel@alsa-project.org, linux1394-devel@lists.sourceforge.net, clemens@ladisch.de, ffado-devel@lists.sf.net List-Id: alsa-devel@alsa-project.org At Sat, 21 Feb 2015 23:54:56 +0900, Takashi Sakamoto wrote: > > Each FireWire sound driver causes kernel oops at unplugging during > streaming. This bug affects: > - snd-bebob (in 3.16 or later) > - snd-fireworks (in 3.16 or later) > - snd-dice (in 3.19 or later) > - snd-oxfw (in 3.19 or later) > > When streaming, any ALSA character devices are opened and sound card > object is referred. Then 'struct snd_card.private_free()' is not executed > in a context of 'struct fw_driver.remove()'. It's executed in a context of > an application process in which the last ALSA character device is closed. > In this case, any operation to instances of FireWire unit is invalid > because it's already released, and causes kernel oops. I confirm GPF or > Null-pointer-dereference. > > To fix this problem, this patchset do: > 1.delegate reference counting of an instance of FireWire unit from AMDTP > helper functions to each driver, then do it in > 'struct snd_card.private_free()'. > 2.move stream or transaction destructor from 'struct fw_driver.remove()' > to 'struct snd_card.private_free()'. > > With this patchset, each driver keeps a reference to FireWire unit till > all of ALSA applications close its character devices. This may be against > IEEE 1394 bus driver developers' expectation to high-level drivers. Thanks, now applied all four patches. Takashi > > Takashi Sakamoto (4): > ALSA: fireworks/bebob/dice/oxfw: add reference-counting for FireWire > unit > ALSA: firewire-lib: remove reference counting > ALSA: fireworks/bebob/dice/oxfw: allow stream destructor after > releasing runtime > ALSA: fireworks/bebob/dice/oxfw: make it possible to shutdown safely > > sound/firewire/amdtp.c | 3 +-- > sound/firewire/bebob/bebob.c | 20 ++++++++++++++++---- > sound/firewire/bebob/bebob_stream.c | 16 ++++------------ > sound/firewire/dice/dice-stream.c | 18 ++++++++++++------ > sound/firewire/dice/dice.c | 16 +++++++++++----- > sound/firewire/fireworks/fireworks.c | 20 ++++++++++++++------ > sound/firewire/fireworks/fireworks_stream.c | 19 ++++++++++--------- > sound/firewire/oxfw/oxfw-stream.c | 6 ++++-- > sound/firewire/oxfw/oxfw.c | 21 ++++++++++++++------- > 9 files changed, 86 insertions(+), 53 deletions(-) > > -- > 2.1.0 >