Skip to content

Commit

Permalink
ALSA: firewire-tascam: fix NULL pointer dereference when model identi…
Browse files Browse the repository at this point in the history
…fication 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 <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
takaswie authored and tiwai committed Feb 5, 2016
1 parent 360a824 commit 5d2560a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sound/firewire/tascam/tascam-transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ int snd_tscm_transaction_register(struct snd_tscm *tscm)
return err;
error:
fw_core_remove_address_handler(&tscm->async_handler);
tscm->async_handler.callback_data = NULL;
return err;
}

Expand Down Expand Up @@ -276,6 +277,9 @@ void snd_tscm_transaction_unregister(struct snd_tscm *tscm)
__be32 reg;
unsigned int i;

if (tscm->async_handler.callback_data == NULL)
return;

/* Turn off FireWire LED. */
reg = cpu_to_be32(0x0000008e);
snd_fw_transaction(tscm->unit, TCODE_WRITE_QUADLET_REQUEST,
Expand All @@ -297,6 +301,8 @@ void snd_tscm_transaction_unregister(struct snd_tscm *tscm)
&reg, sizeof(reg), 0);

fw_core_remove_address_handler(&tscm->async_handler);
tscm->async_handler.callback_data = NULL;

for (i = 0; i < TSCM_MIDI_OUT_PORT_MAX; i++)
snd_fw_async_midi_port_destroy(&tscm->out_ports[i]);
}

0 comments on commit 5d2560a

Please sign in to comment.