From nobody Fri Sep 5 20:23:14 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BC2BC32772 for ; Tue, 23 Aug 2022 12:04:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358951AbiHWMER (ORCPT ); Tue, 23 Aug 2022 08:04:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359171AbiHWMAM (ORCPT ); Tue, 23 Aug 2022 08:00:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BC35D8E13; Tue, 23 Aug 2022 02:35:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D5C94B81C65; Tue, 23 Aug 2022 09:34:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3141FC433C1; Tue, 23 Aug 2022 09:34:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661247293; bh=Nned1RlZpWiZahe4FRxH3L5S5eEsVREKwZPn00BfNAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lqe4YR5iLzQLXJKgbQSbsXr6yoQ3amH2cqPH+YUlscPGyA+HX3Xqh9maW5u/SHl76 xkqsJZL1G4DDdj1LNsejhQAibWAtc2kJawfoKQ9VQH7cKb0gsLbF4268Xf6ChOIQ5F tYjirOiXSE6ibOcVBmri5kUZOJCTegeJMVj3LoyU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+1ee0910eca9c94f71f25@syzkaller.appspotmail.com, syzbot+49b10793b867871ee26f@syzkaller.appspotmail.com, syzbot+8285e973a41b5aa68902@syzkaller.appspotmail.com, Takashi Iwai , Sasha Levin Subject: [PATCH 5.4 379/389] ALSA: timer: Use deferred fasync helper Date: Tue, 23 Aug 2022 10:27:37 +0200 Message-Id: <20220823080131.396076522@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080115.331990024@linuxfoundation.org> References: <20220823080115.331990024@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai [ Upstream commit 95cc637c1afd83fb7dd3d7c8a53710488f4caf9c ] 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: syzbot+1ee0910eca9c94f71f25@syzkaller.appspotmail.com Reported-by: syzbot+49b10793b867871ee26f@syzkaller.appspotmail.com Reported-by: syzbot+8285e973a41b5aa68902@syzkaller.appspotmail.com Link: https://lore.kernel.org/r/20220728125945.29533-3-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/core/timer.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sound/core/timer.c b/sound/core/timer.c index d684aa4150aa..420cc07a7f88 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -61,7 +61,7 @@ struct snd_timer_user { unsigned int filter; struct timespec tstamp; /* trigger tstamp */ wait_queue_head_t qchange_sleep; - struct fasync_struct *fasync; + struct snd_fasync *fasync; struct mutex ioctl_lock; }; =20 @@ -1317,7 +1317,7 @@ static void snd_timer_user_interrupt(struct snd_timer= _instance *timeri, } __wake: spin_unlock(&tu->qlock); - kill_fasync(&tu->fasync, SIGIO, POLL_IN); + snd_kill_fasync(tu->fasync, SIGIO, POLL_IN); wake_up(&tu->qchange_sleep); } =20 @@ -1354,7 +1354,7 @@ 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); + snd_kill_fasync(tu->fasync, SIGIO, POLL_IN); wake_up(&tu->qchange_sleep); } =20 @@ -1421,7 +1421,7 @@ static void snd_timer_user_tinterrupt(struct snd_time= r_instance *timeri, spin_unlock(&tu->qlock); if (append =3D=3D 0) return; - kill_fasync(&tu->fasync, SIGIO, POLL_IN); + snd_kill_fasync(tu->fasync, SIGIO, POLL_IN); wake_up(&tu->qchange_sleep); } =20 @@ -1487,6 +1487,7 @@ static int snd_timer_user_release(struct inode *inode= , struct file *file) if (tu->timeri) snd_timer_close(tu->timeri); mutex_unlock(&tu->ioctl_lock); + snd_fasync_free(tu->fasync); kfree(tu->queue); kfree(tu->tqueue); kfree(tu); @@ -2050,7 +2051,7 @@ static int snd_timer_user_fasync(int fd, struct file = * file, int on) struct snd_timer_user *tu; =20 tu =3D file->private_data; - return fasync_helper(fd, file, on, &tu->fasync); + return snd_fasync_helper(fd, file, on, &tu->fasync); } =20 static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, --=20 2.35.1