Skip to content

Commit 95cc637

Browse files
committed
ALSA: timer: Use deferred fasync helper
For avoiding the potential deadlock via kill_fasync() call, use the new fasync helpers to defer the invocation from PCI API. Note that it's merely a workaround. Reported-by: [email protected] Reported-by: [email protected] Reported-by: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent ef34a0a commit 95cc637

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

sound/core/timer.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ struct snd_timer_user {
8383
unsigned int filter;
8484
struct timespec64 tstamp; /* trigger tstamp */
8585
wait_queue_head_t qchange_sleep;
86-
struct fasync_struct *fasync;
86+
struct snd_fasync *fasync;
8787
struct mutex ioctl_lock;
8888
};
8989

@@ -1345,7 +1345,7 @@ static void snd_timer_user_interrupt(struct snd_timer_instance *timeri,
13451345
}
13461346
__wake:
13471347
spin_unlock(&tu->qlock);
1348-
kill_fasync(&tu->fasync, SIGIO, POLL_IN);
1348+
snd_kill_fasync(tu->fasync, SIGIO, POLL_IN);
13491349
wake_up(&tu->qchange_sleep);
13501350
}
13511351

@@ -1383,7 +1383,7 @@ static void snd_timer_user_ccallback(struct snd_timer_instance *timeri,
13831383
spin_lock_irqsave(&tu->qlock, flags);
13841384
snd_timer_user_append_to_tqueue(tu, &r1);
13851385
spin_unlock_irqrestore(&tu->qlock, flags);
1386-
kill_fasync(&tu->fasync, SIGIO, POLL_IN);
1386+
snd_kill_fasync(tu->fasync, SIGIO, POLL_IN);
13871387
wake_up(&tu->qchange_sleep);
13881388
}
13891389

@@ -1453,7 +1453,7 @@ static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri,
14531453
spin_unlock(&tu->qlock);
14541454
if (append == 0)
14551455
return;
1456-
kill_fasync(&tu->fasync, SIGIO, POLL_IN);
1456+
snd_kill_fasync(tu->fasync, SIGIO, POLL_IN);
14571457
wake_up(&tu->qchange_sleep);
14581458
}
14591459

@@ -1521,6 +1521,7 @@ static int snd_timer_user_release(struct inode *inode, struct file *file)
15211521
snd_timer_instance_free(tu->timeri);
15221522
}
15231523
mutex_unlock(&tu->ioctl_lock);
1524+
snd_fasync_free(tu->fasync);
15241525
kfree(tu->queue);
15251526
kfree(tu->tqueue);
15261527
kfree(tu);
@@ -2135,7 +2136,7 @@ static int snd_timer_user_fasync(int fd, struct file * file, int on)
21352136
struct snd_timer_user *tu;
21362137

21372138
tu = file->private_data;
2138-
return fasync_helper(fd, file, on, &tu->fasync);
2139+
return snd_fasync_helper(fd, file, on, &tu->fasync);
21392140
}
21402141

21412142
static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,

0 commit comments

Comments
 (0)