From patchwork Fri Jul 15 10:29:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 591501 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A875DC433EF for ; Fri, 15 Jul 2022 10:30:41 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 22F5B1890; Fri, 15 Jul 2022 12:29:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 22F5B1890 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1657881039; bh=Gd4Jyoo3B4R2r1nDJWUOLBOFwkZemzHMKyFlgLnedTs=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=mmoKv68pcvjDSL5shKIgCLzxdDIB/4u6xyMlcgu7Ctz6Hk2k47RJSMPvaffA827R7 XNnCoUEvWcS4gV6llLU0tKG82b/z/Okv7KWbRj2JCQKzcmaudvUqWpqpRn/2u68bV+ jVoStXReFVd1rIc3fMUkEGHim0fzifFrhUnZpZJ0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A27A6F804FD; Fri, 15 Jul 2022 12:29:48 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 83B40F80153; Fri, 15 Jul 2022 12:29:45 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id DC9EFF8014E for ; Fri, 15 Jul 2022 12:29:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DC9EFF8014E Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Zqdrid3Y"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="GgdAs6bO" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4A2F91FA89; Fri, 15 Jul 2022 10:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657880978; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MGy8ZzpyH9uJRkZOdNs/yppyPP8ZQ6qKlUm4VrMnTa0=; b=Zqdrid3YiqchI0y+E8Y/Yo5v2LBuaycywPielJlv1fcevfTjlTMQDCu6KeExqNd+ZVwxYB I7x5g9WhekJ8zKA/6Ix8IxaIX3TTFGWvThXw+2Yo8lWnZ1M3J87OH+JSw8y/r5ERy3+LFQ CExIWw6zQc7Ply4TP3lGK79UjwlgDus= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657880978; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MGy8ZzpyH9uJRkZOdNs/yppyPP8ZQ6qKlUm4VrMnTa0=; b=GgdAs6bOpuz4cye4oB0tGxsPPBu3i0/31F8C5Z6i7Qvd5UInS100xAVTd7HBxGtz7th3Ox x0b7Q2bAFcCdOyDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3218E13B28; Fri, 15 Jul 2022 10:29:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8GxMC5JB0WI+WwAAMHmgww (envelope-from ); Fri, 15 Jul 2022 10:29:38 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 1/5] ALSA: timer: Drop async signal support Date: Fri, 15 Jul 2022 12:29:31 +0200 Message-Id: <20220715102935.4695-2-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220715102935.4695-1-tiwai@suse.de> References: <20220715102935.4695-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The async signal (SIGIO) support for ALSA timer API has been never used by real applications, but yet it can be a cause of various potential deadlocks, as spotted by syzkaller. Let's drop the feature as the simplest solution. Reported-by: syzbot+1ee0910eca9c94f71f25@syzkaller.appspotmail.com Reported-by: syzbot+49b10793b867871ee26f@syzkaller.appspotmail.com Reported-by: syzbot+8285e973a41b5aa68902@syzkaller.appspotmail.com Signed-off-by: Takashi Iwai --- sound/core/timer.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/sound/core/timer.c b/sound/core/timer.c index b3214baa8919..4ac3ab2cf575 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -83,7 +83,6 @@ struct snd_timer_user { unsigned int filter; struct timespec64 tstamp; /* trigger tstamp */ wait_queue_head_t qchange_sleep; - struct fasync_struct *fasync; struct mutex ioctl_lock; }; @@ -1345,7 +1344,6 @@ static void snd_timer_user_interrupt(struct snd_timer_instance *timeri, } __wake: spin_unlock(&tu->qlock); - kill_fasync(&tu->fasync, SIGIO, POLL_IN); wake_up(&tu->qchange_sleep); } @@ -1383,7 +1381,6 @@ static void snd_timer_user_ccallback(struct snd_timer_instance *timeri, spin_lock_irqsave(&tu->qlock, flags); snd_timer_user_append_to_tqueue(tu, &r1); spin_unlock_irqrestore(&tu->qlock, flags); - kill_fasync(&tu->fasync, SIGIO, POLL_IN); wake_up(&tu->qchange_sleep); } @@ -1453,7 +1450,6 @@ static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri, spin_unlock(&tu->qlock); if (append == 0) return; - kill_fasync(&tu->fasync, SIGIO, POLL_IN); wake_up(&tu->qchange_sleep); } @@ -2130,14 +2126,6 @@ static long snd_timer_user_ioctl(struct file *file, unsigned int cmd, return ret; } -static int snd_timer_user_fasync(int fd, struct file * file, int on) -{ - struct snd_timer_user *tu; - - tu = file->private_data; - return fasync_helper(fd, file, on, &tu->fasync); -} - static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, size_t count, loff_t *offset) { @@ -2280,7 +2268,6 @@ static const struct file_operations snd_timer_f_ops = .poll = snd_timer_user_poll, .unlocked_ioctl = snd_timer_user_ioctl, .compat_ioctl = snd_timer_user_ioctl_compat, - .fasync = snd_timer_user_fasync, }; /* unregister the system timer */ From patchwork Fri Jul 15 10:29:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 590868 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 06BC7C43334 for ; Fri, 15 Jul 2022 10:31:10 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1CD3B18C7; Fri, 15 Jul 2022 12:30:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1CD3B18C7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1657881069; bh=9xOIKv/fZBVX5TnKf9pT+kTzOAegZnIddrYXdjI/zUE=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=NZloTS837cQpOJYu78RrOZYVjSC2T2hme+VZkFoyPZugg4WSBFdtV2pY8DpQ7RPiz buj9vOhERncF7knhJUr257Fw8r2FZwEGlWusPLilJjPmtWu3o1rZ7OdUNm0oCILy3V zKonJkzR8R3kf2EcJyfKVxRAHTfsduivOeZhN/Og= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 56659F80542; Fri, 15 Jul 2022 12:29:49 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 520A6F8053D; Fri, 15 Jul 2022 12:29:45 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9E6FFF80153 for ; Fri, 15 Jul 2022 12:29:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9E6FFF80153 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="bfjAqgsi"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="yohLoyhH" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 705E81FB39; Fri, 15 Jul 2022 10:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657880978; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yGVz3f4YEWYWzCw5t3v/ARD34LQAWDWlEvZkjgyvp6c=; b=bfjAqgsieVAHRUPSjKTr2EtuJVUzFcTjT6wKJHVR4YlezVeof/+lE1EYCkSmeqgpdyZ+yP qUVjUHSmx3BXphvOB/bzwLFWh0s6PN1FitokxKM8W9WII0bfRKfhTNkzJvvrMGseGZfKqs NSdTV2nn8z2Fq3QJgpdRG8G+2OOMc50= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657880978; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yGVz3f4YEWYWzCw5t3v/ARD34LQAWDWlEvZkjgyvp6c=; b=yohLoyhHJ/rpLp54JrEAxthT3shb3/HY3bbe96kuzy3nL+aC0xE3FlpU2zgkI79js2DqrY Aqnq5/xyKtyjrDBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4C42E13AC3; Fri, 15 Jul 2022 10:29:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id oCL5EZJB0WI+WwAAMHmgww (envelope-from ); Fri, 15 Jul 2022 10:29:38 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 2/5] ALSA: pcm: Drop async signal support Date: Fri, 15 Jul 2022 12:29:32 +0200 Message-Id: <20220715102935.4695-3-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220715102935.4695-1-tiwai@suse.de> References: <20220715102935.4695-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The async signal (SIGIO) support for ALSA PCM API has been never used by real applications, but yet it can be a cause of various potential deadlocks, as spotted by syzkaller. Let's drop the feature as the simplest solution. Reported-by: syzbot+8285e973a41b5aa68902@syzkaller.appspotmail.com Reported-by: syzbot+669c9abf11a6a011dd09@syzkaller.appspotmail.com Signed-off-by: Takashi Iwai Reported-by: kernel test robot Reported-by: kernel test robot --- include/sound/pcm.h | 1 - sound/core/pcm_lib.c | 4 +--- sound/core/pcm_native.c | 18 ------------------ 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 08cf4a5801f3..9bbd3742ef59 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -399,7 +399,6 @@ struct snd_pcm_runtime { snd_pcm_uframes_t twake; /* do transfer (!poll) wakeup if non-zero */ wait_queue_head_t sleep; /* poll sleep */ wait_queue_head_t tsleep; /* transfer sleep */ - struct fasync_struct *fasync; bool stop_operating; /* sync_stop will be called */ struct mutex buffer_mutex; /* protect for buffer changes */ atomic_t buffer_accessing; /* >0: in r/w operation, <0: blocked */ diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 1fc7c50ffa62..a7b10ee5d57d 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -1815,14 +1815,12 @@ void snd_pcm_period_elapsed_under_stream_lock(struct snd_pcm_substream *substrea if (!snd_pcm_running(substream) || snd_pcm_update_hw_ptr0(substream, 1) < 0) - goto _end; + return; #ifdef CONFIG_SND_PCM_TIMER if (substream->timer_running) snd_timer_interrupt(substream->timer, 1); #endif - _end: - kill_fasync(&runtime->fasync, SIGIO, POLL_IN); } EXPORT_SYMBOL(snd_pcm_period_elapsed_under_stream_lock); diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index aa0453e51595..c8e340b97277 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -3938,22 +3938,6 @@ static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area) return 0; } -static int snd_pcm_fasync(int fd, struct file * file, int on) -{ - struct snd_pcm_file * pcm_file; - struct snd_pcm_substream *substream; - struct snd_pcm_runtime *runtime; - - pcm_file = file->private_data; - substream = pcm_file->substream; - if (PCM_RUNTIME_CHECK(substream)) - return -ENXIO; - runtime = substream->runtime; - if (runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) - return -EBADFD; - return fasync_helper(fd, file, on, &runtime->fasync); -} - /* * ioctl32 compat */ @@ -4118,7 +4102,6 @@ const struct file_operations snd_pcm_f_ops[2] = { .unlocked_ioctl = snd_pcm_ioctl, .compat_ioctl = snd_pcm_ioctl_compat, .mmap = snd_pcm_mmap, - .fasync = snd_pcm_fasync, .get_unmapped_area = snd_pcm_get_unmapped_area, }, { @@ -4132,7 +4115,6 @@ const struct file_operations snd_pcm_f_ops[2] = { .unlocked_ioctl = snd_pcm_ioctl, .compat_ioctl = snd_pcm_ioctl_compat, .mmap = snd_pcm_mmap, - .fasync = snd_pcm_fasync, .get_unmapped_area = snd_pcm_get_unmapped_area, } }; From patchwork Fri Jul 15 10:29:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 591500 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 25F9EC433EF for ; Fri, 15 Jul 2022 10:31:31 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id ABB6018C2; Fri, 15 Jul 2022 12:30:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz ABB6018C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1657881089; bh=4LA61HFUZ5ylMHpHwi4q2rPcuHJOpqDKc4aP+W9+5dY=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=B0ioPFjQQ5VaeHhKfVfBx1qXRspV/oLxrqPmCYoqIxes/xKtsrFSUwrz1bFf3KV4O Ef5aeTzkClFbz06x67mPaPFzgtw9bJ7xjkuswglIXGxH+bkqG3oG+QUqRQOVvqSEnd W6ZC2G42JhVrxgqxQ+ZezC4BXCKWbrXNqkkbU1xs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E184EF804B2; Fri, 15 Jul 2022 12:29:53 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6D096F80543; Fri, 15 Jul 2022 12:29:50 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 01183F8012F for ; Fri, 15 Jul 2022 12:29:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 01183F8012F Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="xIIFgKf2"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Rp+RDeCh" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 8E5C11FB4C; Fri, 15 Jul 2022 10:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657880978; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IGZaCnSkWhN5wCIw32VPguw+G/ThT1KI9AXF1wzopkM=; b=xIIFgKf2HJBboXWwM8xQahVPbBaBiZf56cBmLMf5aBZz3fABUvW1silIYRk7CSNxIG3113 6Axp6N32byjlt6PbkOF7QSj944wKRj85YqWVrVXNAJDWWwll+lBe43zP3rXLnQg+67N4fH PLTFb/K/Lxb5LXWccvPC6wWn8NQcf1M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657880978; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IGZaCnSkWhN5wCIw32VPguw+G/ThT1KI9AXF1wzopkM=; b=Rp+RDeChznhExjXvlCcDi4p1Wpdcuum0e2Ws9NdwRy1DqAOmeirUAdgJP6bIi/bEN1Bt01 mLT7/zriCCetDXAQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6646913B28; Fri, 15 Jul 2022 10:29:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qANQGJJB0WI+WwAAMHmgww (envelope-from ); Fri, 15 Jul 2022 10:29:38 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 3/5] ALSA: control: Drop async signal support Date: Fri, 15 Jul 2022 12:29:33 +0200 Message-Id: <20220715102935.4695-4-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220715102935.4695-1-tiwai@suse.de> References: <20220715102935.4695-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The async signal (SIGIO) support for ALSA control API has been never used by real applications, but yet it can be a cause of various potential deadlocks (although there hasn't been a bug report in this code path unlike timer and PCM). Let's drop the feature as the simplest solution to align with other APIs. Signed-off-by: Takashi Iwai --- include/sound/control.h | 1 - sound/core/control.c | 11 ----------- 2 files changed, 12 deletions(-) diff --git a/include/sound/control.h b/include/sound/control.h index fcd3cce673ec..0390d4952dac 100644 --- a/include/sound/control.h +++ b/include/sound/control.h @@ -109,7 +109,6 @@ struct snd_ctl_file { int preferred_subdevice[SND_CTL_SUBDEV_ITEMS]; wait_queue_head_t change_sleep; spinlock_t read_lock; - struct fasync_struct *fasync; int subscribed; /* read interface is activated */ struct list_head events; /* waiting events for read */ }; diff --git a/sound/core/control.c b/sound/core/control.c index 4dba3a342458..3d3b8bf93f80 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -181,7 +181,6 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask, _found: wake_up(&ctl->change_sleep); spin_unlock(&ctl->read_lock); - kill_fasync(&ctl->fasync, SIGIO, POLL_IN); } read_unlock_irqrestore(&card->ctl_files_rwlock, flags); } @@ -2129,14 +2128,6 @@ int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn) EXPORT_SYMBOL(snd_ctl_unregister_ioctl_compat); #endif -static int snd_ctl_fasync(int fd, struct file * file, int on) -{ - struct snd_ctl_file *ctl; - - ctl = file->private_data; - return fasync_helper(fd, file, on, &ctl->fasync); -} - /* return the preferred subdevice number if already assigned; * otherwise return -1 */ @@ -2264,7 +2255,6 @@ static const struct file_operations snd_ctl_f_ops = .poll = snd_ctl_poll, .unlocked_ioctl = snd_ctl_ioctl, .compat_ioctl = snd_ctl_ioctl_compat, - .fasync = snd_ctl_fasync, }; /* @@ -2302,7 +2292,6 @@ static int snd_ctl_dev_disconnect(struct snd_device *device) read_lock_irqsave(&card->ctl_files_rwlock, flags); list_for_each_entry(ctl, &card->ctl_files, list) { wake_up(&ctl->change_sleep); - kill_fasync(&ctl->fasync, SIGIO, POLL_ERR); } read_unlock_irqrestore(&card->ctl_files_rwlock, flags); From patchwork Fri Jul 15 10:29:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 591499 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C7E2AC433EF for ; Fri, 15 Jul 2022 10:32:02 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 00B9D18DE; Fri, 15 Jul 2022 12:31:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 00B9D18DE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1657881121; bh=1mp7zjznDtY2bDiu5AQR1NcrSYxpNvQ8cufvuEFXF1Y=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Lnaf2PMKGiHxeV3M7KKls+gM1bb4cpQDXbOlic7UpmuI8hVZV9oHtpglZSrYYEhwT MOwtkSEIhYZ7rDOCwwsAiKPgErW9MMCEhJ80zCh/9F7qmNfIKEczcnYgIxJ8CLubxD 8GsGl38ypZi9Rlh3bYa+xVueDJZngEcGhvESpn1s= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 63C61F8055B; Fri, 15 Jul 2022 12:29:57 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id ACD15F8055C; Fri, 15 Jul 2022 12:29:55 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2B951F8015B for ; Fri, 15 Jul 2022 12:29:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2B951F8015B Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="VQMNUdS6"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="L8phx62L" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A0DFA1FB8D; Fri, 15 Jul 2022 10:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657880978; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BZ7EkE8hMGx2fYCUAZQnWtSmYzro4b8woBAPzMUPSIM=; b=VQMNUdS6FaPmvDB7qWXmOCv0mApTkaY7ddGR5mZzWAJAc6S2Wy1Cs4HE6OU4o11Nd6IKMX rftM4ZbpX7knS43izoq9knE4c+63/yW9Cwmm9EWy5Iqov99CLBkBr0lqdstSSMy5Ve7/gK xZS2dUYPW3/xI+2evBIRG5Lb6nFPNVk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657880978; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BZ7EkE8hMGx2fYCUAZQnWtSmYzro4b8woBAPzMUPSIM=; b=L8phx62LVdkz+hil2gfsGyawH59R69K3W/p7lKNinavBHSgjhtiXOm0UmaUQ5J83Y8zUUF xje3GopuXl9bLtCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 847F213AC3; Fri, 15 Jul 2022 10:29:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id iCalH5JB0WI+WwAAMHmgww (envelope-from ); Fri, 15 Jul 2022 10:29:38 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 4/5] ALSA: core: Drop async signal support Date: Fri, 15 Jul 2022 12:29:34 +0200 Message-Id: <20220715102935.4695-5-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220715102935.4695-1-tiwai@suse.de> References: <20220715102935.4695-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Now fasync support is dropped from all ALSA interfaces, and we can drop the fasync workaround at the card disconnection code, too. Signed-off-by: Takashi Iwai --- sound/core/init.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/sound/core/init.c b/sound/core/init.c index 3ac95c66a4b5..899bfe838a91 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -432,11 +432,8 @@ static int snd_disconnect_release(struct inode *inode, struct file *file) } spin_unlock(&shutdown_lock); - if (likely(df)) { - if ((file->f_flags & FASYNC) && df->disconnected_f_op->fasync) - df->disconnected_f_op->fasync(-1, file, 0); + if (likely(df)) return df->disconnected_f_op->release(inode, file); - } panic("%s(%p, %p) failed!", __func__, inode, file); } @@ -457,11 +454,6 @@ static int snd_disconnect_mmap(struct file *file, struct vm_area_struct *vma) return -ENODEV; } -static int snd_disconnect_fasync(int fd, struct file *file, int on) -{ - return -ENODEV; -} - static const struct file_operations snd_shutdown_f_ops = { .owner = THIS_MODULE, @@ -475,7 +467,6 @@ static const struct file_operations snd_shutdown_f_ops = .compat_ioctl = snd_disconnect_ioctl, #endif .mmap = snd_disconnect_mmap, - .fasync = snd_disconnect_fasync }; /** From patchwork Fri Jul 15 10:29:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 590867 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 125C5C43334 for ; Fri, 15 Jul 2022 10:31:42 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0CB771651; Fri, 15 Jul 2022 12:30:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0CB771651 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1657881100; bh=hLFkk5BxM0L4Xp982xW3TBQk+PTrRudE1Ap9VQgMTzE=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=sjzcYjPMI7gW5d5R1aYWZjCxYkPpqbUi0p2uZBt2a2KDNrMw3Tg3hkjRcFRpLxcxQ /r9m5J6lZlqQcqWNurzxxVP+asNAyIscXwMNQneLGthaddLtGcg757KFstpVa67KoX C9FJAO5p06Xs0LUexVpicSPrWhfcck1YK/0jLzrw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7B363F80548; Fri, 15 Jul 2022 12:29:54 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A4556F80548; Fri, 15 Jul 2022 12:29:50 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 682B6F804B2 for ; Fri, 15 Jul 2022 12:29:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 682B6F804B2 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="LeSXbx7L"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="0RytEMNn" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id C720634136; Fri, 15 Jul 2022 10:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657880978; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dt+1QCRZ2XSmqOkJwPq4z4lw5/QFdsDsZDcIDJQkFcE=; b=LeSXbx7Lkl3NjZu3Qt6xY7vQTH/cohskfISDk5ZPeZMRMt3tG7IFvV5OHDiSVn1ItHZSFl uMJSO8sAnfGn2CWCd2Y0He+yzWQsHAEiWoNplVeLAk5qLNtiGZIjS0d/vbIHu/xGZQbtL4 TNLyi3kgCowgyl3LMLDCrvbccauEr3w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657880978; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dt+1QCRZ2XSmqOkJwPq4z4lw5/QFdsDsZDcIDJQkFcE=; b=0RytEMNnleF0i6KuDmNRDw/jVGRlTs9NaB7y5m/Ni6bW8hx5h7ko2ecgOcSR/3Vyp5Pka+ 3U2olGTnrwyFTfAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A2FE013B28; Fri, 15 Jul 2022 10:29:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id APoQJ5JB0WI+WwAAMHmgww (envelope-from ); Fri, 15 Jul 2022 10:29:38 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 5/5] ALSA: doc: Drop stale fasync entry Date: Fri, 15 Jul 2022 12:29:35 +0200 Message-Id: <20220715102935.4695-6-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220715102935.4695-1-tiwai@suse.de> References: <20220715102935.4695-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The fasync entry has been dropped recently. Update the documentation as well. Signed-off-by: Takashi Iwai --- Documentation/sound/kernel-api/writing-an-alsa-driver.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/Documentation/sound/kernel-api/writing-an-alsa-driver.rst b/Documentation/sound/kernel-api/writing-an-alsa-driver.rst index 176b73583b7a..84b4ecae1485 100644 --- a/Documentation/sound/kernel-api/writing-an-alsa-driver.rst +++ b/Documentation/sound/kernel-api/writing-an-alsa-driver.rst @@ -1597,7 +1597,6 @@ are the contents of this file: spinlock_t lock; wait_queue_head_t sleep; struct timer_list tick_timer; - struct fasync_struct *fasync; /* -- private section -- */ void *private_data;