Skip to content

Commit 5d2560a

Browse files
takaswietiwai
authored andcommitted
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 <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 360a824 commit 5d2560a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sound/firewire/tascam/tascam-transaction.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ int snd_tscm_transaction_register(struct snd_tscm *tscm)
230230
return err;
231231
error:
232232
fw_core_remove_address_handler(&tscm->async_handler);
233+
tscm->async_handler.callback_data = NULL;
233234
return err;
234235
}
235236

@@ -276,6 +277,9 @@ void snd_tscm_transaction_unregister(struct snd_tscm *tscm)
276277
__be32 reg;
277278
unsigned int i;
278279

280+
if (tscm->async_handler.callback_data == NULL)
281+
return;
282+
279283
/* Turn off FireWire LED. */
280284
reg = cpu_to_be32(0x0000008e);
281285
snd_fw_transaction(tscm->unit, TCODE_WRITE_QUADLET_REQUEST,
@@ -297,6 +301,8 @@ void snd_tscm_transaction_unregister(struct snd_tscm *tscm)
297301
&reg, sizeof(reg), 0);
298302

299303
fw_core_remove_address_handler(&tscm->async_handler);
304+
tscm->async_handler.callback_data = NULL;
305+
300306
for (i = 0; i < TSCM_MIDI_OUT_PORT_MAX; i++)
301307
snd_fw_async_midi_port_destroy(&tscm->out_ports[i]);
302308
}

0 commit comments

Comments
 (0)