diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2016-02-04 19:56:05 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-02-05 06:45:59 -0500 |
commit | 5d2560a427fc7c4050a320be62c4994705ca81b1 (patch) | |
tree | 6c21aa2c9b4f5414faff3f3d46ed46cfbfe48814 | |
parent | 360a8245680053619205a3ae10e6bfe624a5da1d (diff) |
ALSA: firewire-tascam: fix NULL pointer dereference when model identification fails
When unsupported models are connected, snd-firewire-tascam module causes
NULL pointer dereference in fw_core_remove_address_handler() (due to
list_del_rcu()).
This commit prevents this bug.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/firewire/tascam/tascam-transaction.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sound/firewire/tascam/tascam-transaction.c b/sound/firewire/tascam/tascam-transaction.c index 904ce0329fa1..040a96d1ba8e 100644 --- a/sound/firewire/tascam/tascam-transaction.c +++ b/sound/firewire/tascam/tascam-transaction.c | |||
@@ -230,6 +230,7 @@ int snd_tscm_transaction_register(struct snd_tscm *tscm) | |||
230 | return err; | 230 | return err; |
231 | error: | 231 | error: |
232 | fw_core_remove_address_handler(&tscm->async_handler); | 232 | fw_core_remove_address_handler(&tscm->async_handler); |
233 | tscm->async_handler.callback_data = NULL; | ||
233 | return err; | 234 | return err; |
234 | } | 235 | } |
235 | 236 | ||
@@ -276,6 +277,9 @@ void snd_tscm_transaction_unregister(struct snd_tscm *tscm) | |||
276 | __be32 reg; | 277 | __be32 reg; |
277 | unsigned int i; | 278 | unsigned int i; |
278 | 279 | ||
280 | if (tscm->async_handler.callback_data == NULL) | ||
281 | return; | ||
282 | |||
279 | /* Turn off FireWire LED. */ | 283 | /* Turn off FireWire LED. */ |
280 | reg = cpu_to_be32(0x0000008e); | 284 | reg = cpu_to_be32(0x0000008e); |
281 | snd_fw_transaction(tscm->unit, TCODE_WRITE_QUADLET_REQUEST, | 285 | snd_fw_transaction(tscm->unit, TCODE_WRITE_QUADLET_REQUEST, |
@@ -297,6 +301,8 @@ void snd_tscm_transaction_unregister(struct snd_tscm *tscm) | |||
297 | ®, sizeof(reg), 0); | 301 | ®, sizeof(reg), 0); |
298 | 302 | ||
299 | fw_core_remove_address_handler(&tscm->async_handler); | 303 | fw_core_remove_address_handler(&tscm->async_handler); |
304 | tscm->async_handler.callback_data = NULL; | ||
305 | |||
300 | for (i = 0; i < TSCM_MIDI_OUT_PORT_MAX; i++) | 306 | for (i = 0; i < TSCM_MIDI_OUT_PORT_MAX; i++) |
301 | snd_fw_async_midi_port_destroy(&tscm->out_ports[i]); | 307 | snd_fw_async_midi_port_destroy(&tscm->out_ports[i]); |
302 | } | 308 | } |