From patchwork Sun Jul 17 07:05:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 12920442 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 0126EC43334 for ; Sun, 17 Jul 2022 07:07:22 +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 F04CA18DA; Sun, 17 Jul 2022 09:06:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz F04CA18DA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1658041641; 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=jffBTFvi7EGgebFWaul2U5/qIF1jaodGWVOmlIZhTlPIUgQN/WmmZ6T1X3gAKTkUo 9cAXxMSLvtQQ6737MtkiqSK87J/hS9BVAl7Jt6tmFKjiwy9GGBg7H9IkOL5hXr9Bew bVSx5JJ2zHT18VIi3ioNunqhebM9IiymzOtAEFp4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7BC3CF804DA; Sun, 17 Jul 2022 09:06:03 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0787EF804FB; Sun, 17 Jul 2022 09:06:00 +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 D6139F800CB for ; Sun, 17 Jul 2022 09:05:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D6139F800CB Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="KwvwA6li"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="7yvOoXNK" 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 0AEF03438F; Sun, 17 Jul 2022 07:05:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1658041554; 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=KwvwA6liKIrnmPAlanIIuJRNQAiam9unJocjDXZlRlOUdnv6uh2jq2Ld4vg5GnilfCMAiq +ulwTVkboxIKeiT0M2SDAhddyNK/f5E5QCsJkZHNDqfImknm/CJtam/rOz5mW7GY2vbfDi V2HRDIJfTxyxrqN2vpYKqTB99nxGBOM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1658041554; 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=7yvOoXNKGWmyc1xvj4L+tcCG8pMZ4OtRlM92+fOmv4ldJVvHlBwLGuFXxDY8c83YzpJBKk +tvsWv2O63fJrsBg== 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 E5B1113A89; Sun, 17 Jul 2022 07:05:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eJoQN9G002LDawAAMHmgww (envelope-from ); Sun, 17 Jul 2022 07:05:53 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH v2 1/5] ALSA: timer: Drop async signal support Date: Sun, 17 Jul 2022 09:05:45 +0200 Message-Id: <20220717070549.5993-2-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220717070549.5993-1-tiwai@suse.de> References: <20220717070549.5993-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 Sun Jul 17 07:05:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 12920444 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 29068C433EF for ; Sun, 17 Jul 2022 07:07:54 +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 10A9618E8; Sun, 17 Jul 2022 09:07:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 10A9618E8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1658041672; bh=tpTJAEUclKTqtJ7NzY7AVHJU8IdYP7J4Rp2bh0UVH3o=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=M5u2XlIVDoSJGOO9Uc2SQSIoi3baTvdkQsfK06ndFVHqNZBSDFSYOIbLUOq6ABjJ3 A4QjxJS+26uv3f/FmHKgipkEH/rpbVtnnCGIBBT0Bz9NogfNUJ8/tUBX7adTyf15Pm mmWyuTMA6rtVAMLkGjyJ1nTN12VaZsZPIp+sSRvA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AE352F8054A; Sun, 17 Jul 2022 09:06:16 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0CA4BF80171; Sun, 17 Jul 2022 09:06:06 +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 C6C32F80171 for ; Sun, 17 Jul 2022 09:05:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C6C32F80171 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="hse9akEQ"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="6FnWojvv" 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 B6A1D1F96E; Sun, 17 Jul 2022 07:05:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1658041554; 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=1DsHLYF7nQ5WhhAycjEQzo6YSjaCkaTIOWB+nLJG/Kk=; b=hse9akEQ4NOakwj7XGEFHM6tZAyCS8Tg7JVqa0RbWzJKeGSj1DppNhkuXxW3DZ2/mOaY60 fF1ebBNnmrBF1cn/vEYY+YyZrWqtwYRi/ispRDuwTlfTnkd2/vfFOF39FI7PBrKTQij8vn FdpZyHciCXdg2fxSmvWLoR5WDWMRRZg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1658041554; 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=1DsHLYF7nQ5WhhAycjEQzo6YSjaCkaTIOWB+nLJG/Kk=; b=6FnWojvvNCO/C9W3Pkq0k/tPjX/SwVxk6stjs55tjcEQVbn2Ch+/uQyrKTqG1cZzDRo3Cd 8KIFjxktHIU4dBDw== 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 9B2F813A89; Sun, 17 Jul 2022 07:05:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SM3jJNK002LDawAAMHmgww (envelope-from ); Sun, 17 Jul 2022 07:05:54 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH v2 2/5] ALSA: pcm: Drop async signal support Date: Sun, 17 Jul 2022 09:05:46 +0200 Message-Id: <20220717070549.5993-3-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220717070549.5993-1-tiwai@suse.de> References: <20220717070549.5993-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 --- include/sound/pcm.h | 1 - sound/core/pcm_lib.c | 8 +------- sound/core/pcm_native.c | 18 ------------------ 3 files changed, 1 insertion(+), 26 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..e490a575aa03 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -1807,22 +1807,16 @@ EXPORT_SYMBOL(snd_pcm_lib_ioctl); */ void snd_pcm_period_elapsed_under_stream_lock(struct snd_pcm_substream *substream) { - struct snd_pcm_runtime *runtime; - if (PCM_RUNTIME_CHECK(substream)) return; - runtime = substream->runtime; - 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 Sun Jul 17 07:05:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 12920445 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 AE318C433EF for ; Sun, 17 Jul 2022 07:08:14 +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 E8785190C; Sun, 17 Jul 2022 09:07:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E8785190C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1658041693; 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=NflqOZeVueXWEH1EFGgrd0TIgpwNBEkvkdktNcirvkViazLECF7XFyFnHViVqkQyB CyDBdIvYnRqvjfEECHbzHkk2gRPfCYX4pfqPn1MBKfLgJCqik/RCEJK7G/bbXElXmb 9LjLcSXAd7TXJDgtC5oMIqY4AduMHbgF1jpK4n5Y= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B163BF804D2; Sun, 17 Jul 2022 09:06:51 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 997ADF8055C; Sun, 17 Jul 2022 09:06:50 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (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 9DC96F804D2 for ; Sun, 17 Jul 2022 09:05:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9DC96F804D2 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="habT3dOt"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="H3/ohKmM" 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 4F13D34490; Sun, 17 Jul 2022 07:05:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1658041555; 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=habT3dOto5TkuPYRtdXVlRcwV7lpDmptAmzpTXJrq4qyq8T/lQWKAucWeC/CsobPLyfKHv oJkGy/KsHy04++ZebrTOsraEiSLpwDBWnFcRR1VLcBKJQrm+mGVaZwamWI61HDLWgZvAX5 quCkcfqcVNa5aMHSKTLQGqkzbxv1m7w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1658041555; 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=H3/ohKmMR64ElzFBxPTMWxqOKcK2OlIbQhSD8wmKQfqv5nyaTpxxUT7dgsoxKGN30Eh4G0 IrKpmHQ43nbh7lDQ== 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 34C2213A89; Sun, 17 Jul 2022 07:05:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id aE8eDNO002LDawAAMHmgww (envelope-from ); Sun, 17 Jul 2022 07:05:55 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH v2 3/5] ALSA: control: Drop async signal support Date: Sun, 17 Jul 2022 09:05:47 +0200 Message-Id: <20220717070549.5993-4-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220717070549.5993-1-tiwai@suse.de> References: <20220717070549.5993-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 Sun Jul 17 07:05:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 12920446 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 53B48C433EF for ; Sun, 17 Jul 2022 07:08:29 +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 8BB5518C1; Sun, 17 Jul 2022 09:07:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8BB5518C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1658041707; 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=R8TFdebZybOqTP+gveEBopvGiBkkw+yOr387pu5I6qsS7U0Yz5v4nFoAAyfZeLHOr xkLpvmaSpX0HJD4aLAv2iix4cUrTFbhpZ6k9e+vcY9rLl2/S+3LuVkFPlirTgELeOU bfIZ0tCy9coavAsMwC5cuEXQFxNZ1pdUtWqG13mg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 32119F8055C; Sun, 17 Jul 2022 09:06:52 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9D3A8F800CB; Sun, 17 Jul 2022 09:06:50 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (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 B5205F804D8 for ; Sun, 17 Jul 2022 09:05:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B5205F804D8 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="ptAF0xEm"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="0M+Sz2nC" 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 D9208344A8; Sun, 17 Jul 2022 07:05:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1658041555; 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=ptAF0xEmSmoq1Lv/qq2Pr88wb/20RlzSfZ5QqNE/21YkRS+mmUBciOra9oYGdti5lhhaPR iKZB7UKUQKPtuFGE6RSPmlQ1a3kZFCa7A8j9si6oa4ZPEP5tZ2bn2VOR655hX0F51y9x9M iFppxzOPEOSOejKZwTqrlo96BIB3HcQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1658041555; 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=0M+Sz2nCmKAiGKLWpZIdo9jHgoFa4WNlQwaxp/MDRVWj8qPud7wSo09IfYVIXpzJ7rPylC UmHYlmRrtpOnp6Bg== 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 BE52A13A89; Sun, 17 Jul 2022 07:05:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id sNuMLdO002LDawAAMHmgww (envelope-from ); Sun, 17 Jul 2022 07:05:55 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH v2 4/5] ALSA: core: Drop async signal support Date: Sun, 17 Jul 2022 09:05:48 +0200 Message-Id: <20220717070549.5993-5-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220717070549.5993-1-tiwai@suse.de> References: <20220717070549.5993-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 Sun Jul 17 07:05:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 12920443 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 C8DFEC433EF for ; Sun, 17 Jul 2022 07:07:43 +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 D68F118DE; Sun, 17 Jul 2022 09:06:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D68F118DE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1658041661; 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=hixMZfZLYxm1L/j0h3rPdMI8MZjHTMl9dPbmSIardlMqaY7FMe+LXNoosRFhN5VSi n7xv3rhun3yyegHNX6t2p597/Cv1bhH89AXcRk+IJOZQSsIGGzO5VgfzajKRDxxGzQ nfNu0vxe6fe4sCNi46I5LBeAnNuDKiZ0HVmdHt0Q= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 05976F804FB; Sun, 17 Jul 2022 09:06:16 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 028F9F804FB; Sun, 17 Jul 2022 09:06:03 +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 C4BB8F8012A for ; Sun, 17 Jul 2022 09:05:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C4BB8F8012A Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="M9dXj/ri"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="PZJ0nQ0I" 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 6B2C31F983; Sun, 17 Jul 2022 07:05:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1658041556; 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=M9dXj/riP4INPSUe1OMZNpqzlN/uyyVE/dPIgodoRNzUPS5RpkzXeNT7qC3ds6hYzddEVS Fj+64u9kDO9YG0QMyH0qSYdlmmhjdZLRUk1u0nm6jp2Hj1bpOwh5OycNCrl/ENVr29CEhX cM8ZdNNO79zTx2Q/OX3A9MDPfQ+bPpQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1658041556; 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=PZJ0nQ0IB9LrPSC9HQyh+KwKGFQV7TY/MKltwyWc/gOdm9a91HwkmpAcijknN84Vd+mW93 ZYfhc2wWt3vMmVCA== 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 458A513A89; Sun, 17 Jul 2022 07:05:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mMkaENS002LDawAAMHmgww (envelope-from ); Sun, 17 Jul 2022 07:05:56 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH v2 5/5] ALSA: doc: Drop stale fasync entry Date: Sun, 17 Jul 2022 09:05:49 +0200 Message-Id: <20220717070549.5993-6-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220717070549.5993-1-tiwai@suse.de> References: <20220717070549.5993-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;