Skip to content

Commit f44e767

Browse files
stargosashalevin
authored andcommitted
ALSA: emu10k1: don't deadlock in proc-functions
[ Upstream commit 91bf0c2 ] The functions snd_emu10k1_proc_spdif_read and snd_emu1010_fpga_read acquire the emu_lock before accessing the FPGA. The function used to access the FPGA (snd_emu1010_fpga_read) also tries to take the emu_lock which causes a deadlock. Remove the outer locking in the proc-functions (guarding only the already safe fpga read) to prevent this deadlock. [removed superfluous flags variables too -- tiwai] Signed-off-by: Michael Gernoth <michael@gernoth.net> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
1 parent ef1eaae commit f44e767

1 file changed

Lines changed: 0 additions & 12 deletions

File tree

‎sound/pci/emu10k1/emuproc.c‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -241,31 +241,22 @@ static void snd_emu10k1_proc_spdif_read(struct snd_info_entry *entry,
241241
struct snd_emu10k1 *emu = entry->private_data;
242242
u32 value;
243243
u32 value2;
244-
unsigned long flags;
245244
u32 rate;
246245

247246
if (emu->card_capabilities->emu_model) {
248-
spin_lock_irqsave(&emu->emu_lock, flags);
249247
snd_emu1010_fpga_read(emu, 0x38, &value);
250-
spin_unlock_irqrestore(&emu->emu_lock, flags);
251248
if ((value & 0x1) == 0) {
252-
spin_lock_irqsave(&emu->emu_lock, flags);
253249
snd_emu1010_fpga_read(emu, 0x2a, &value);
254250
snd_emu1010_fpga_read(emu, 0x2b, &value2);
255-
spin_unlock_irqrestore(&emu->emu_lock, flags);
256251
rate = 0x1770000 / (((value << 5) | value2)+1);
257252
snd_iprintf(buffer, "ADAT Locked : %u\n", rate);
258253
} else {
259254
snd_iprintf(buffer, "ADAT Unlocked\n");
260255
}
261-
spin_lock_irqsave(&emu->emu_lock, flags);
262256
snd_emu1010_fpga_read(emu, 0x20, &value);
263-
spin_unlock_irqrestore(&emu->emu_lock, flags);
264257
if ((value & 0x4) == 0) {
265-
spin_lock_irqsave(&emu->emu_lock, flags);
266258
snd_emu1010_fpga_read(emu, 0x28, &value);
267259
snd_emu1010_fpga_read(emu, 0x29, &value2);
268-
spin_unlock_irqrestore(&emu->emu_lock, flags);
269260
rate = 0x1770000 / (((value << 5) | value2)+1);
270261
snd_iprintf(buffer, "SPDIF Locked : %d\n", rate);
271262
} else {
@@ -410,14 +401,11 @@ static void snd_emu_proc_emu1010_reg_read(struct snd_info_entry *entry,
410401
{
411402
struct snd_emu10k1 *emu = entry->private_data;
412403
u32 value;
413-
unsigned long flags;
414404
int i;
415405
snd_iprintf(buffer, "EMU1010 Registers:\n\n");
416406

417407
for(i = 0; i < 0x40; i+=1) {
418-
spin_lock_irqsave(&emu->emu_lock, flags);
419408
snd_emu1010_fpga_read(emu, i, &value);
420-
spin_unlock_irqrestore(&emu->emu_lock, flags);
421409
snd_iprintf(buffer, "%02X: %08X, %02X\n", i, value, (value >> 8) & 0x7f);
422410
}
423411
}

0 commit comments

Comments
 (0)