Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3467783rwa; Tue, 23 Aug 2022 05:22:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR5TCrk9DKcBIE9jR+6xQfOMNJhdMWbKg891f91W4gGiuRY82Zp3hZ4oLdfaB8nJytJgcUqe X-Received: by 2002:a63:d10f:0:b0:429:e6ee:780a with SMTP id k15-20020a63d10f000000b00429e6ee780amr20728026pgg.31.1661257356058; Tue, 23 Aug 2022 05:22:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661257356; cv=none; d=google.com; s=arc-20160816; b=CVJEgVm63aOhvrLimBICp3XMk1UKevQaJewtxOBERqdTM/UJjTUeROEvBJbXaQbAML YnqgpLTZ4u5rvmHXikwMSuRUnEaYBB3nz7EhnXNVBT1fdHF3kFRk4qcJVI5S+3USDXyh zHzs1b9uZXatwk5xdPMTtDE2yrTCy5Mig2yBg/AvUDEXgdF4odU5Mr29EHM/5hmRebl3 1CvHOjpN6WPVXGyIuQOlstsNtrRgqm5lFAaRcEn2VwbNxTq6rhDZSZFiGWRxc5t7+48r C2aKqinaZ57ABgdFqM5JKMkCkO5g+OvE0HBYk03v1apbrLDsNFRPCNmT5y33BRaJ38eU +/fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oSPL4avk8kzW99AGIrnUbaT5ino7DW3aEHIn8xMDflA=; b=necMeWP6Jw9WcKZHBhMiZEqoGIpUew1L13X1DkE6HrS+KAwlmiYVlz0pz+i0CBT4zm rD2mIE44U9jIUMaL8HXcmZhKMAUjUijoUA44Lb/kWjOUl+PrnrYV93WdJnsukcIW7nzt IFccDdKCfhmm6gEEN68TAhEqbAFkkYAsGbwtgyhD8AitLq9xnQSNdJCbcDALAfpKXaYh 6VzD8OJI1WPLTcn4LBYxtSuB5t00htS61qIiYZqdhVqJ5MKlPtZB5hJUidaGgRl3ybo0 qwKFsOOzsncaXme0qZRBdd8SRvEfnOR2ou6qLT5c6v2a0QMZvbKjMkVHpZU5iB20pzML 9rnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EfzoZtRn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q196-20020a632acd000000b0042aaf5038easi6377917pgq.92.2022.08.23.05.22.16; Tue, 23 Aug 2022 05:22:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EfzoZtRn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354598AbiHWK2Y (ORCPT + 99 others); Tue, 23 Aug 2022 06:28:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353986AbiHWKMX (ORCPT ); Tue, 23 Aug 2022 06:12:23 -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 24C9F3AB0D; Tue, 23 Aug 2022 01:58:49 -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 D2525B81C28; Tue, 23 Aug 2022 08:58:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4203CC433B5; Tue, 23 Aug 2022 08:58:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245126; bh=dJICxAXUVqoAvRcs1iEYL7jr+zKhXIpbPrZJ96/wyv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EfzoZtRnIENOkM/9s12PURk2/zcDKlcz60l3dI114Z72XB6WfQ4x3kyjbHYU+WQq+ wZuFsEaZT88IoPR3FhKRNJrNajcnrLX2sC/jzXxfJZoaykw/Dg+eoYtbzM8anARH+O 4gigiMX2umnWH5gmWW4FdwEbPBAZO4xK4dm5w29k= 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.15 225/244] ALSA: timer: Use deferred fasync helper Date: Tue, 23 Aug 2022 10:26:24 +0200 Message-Id: <20220823080107.054177105@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080059.091088642@linuxfoundation.org> References: <20220823080059.091088642@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 b3214baa8919..e08a37c23add 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -83,7 +83,7 @@ struct snd_timer_user { unsigned int filter; struct timespec64 tstamp; /* trigger tstamp */ wait_queue_head_t qchange_sleep; - struct fasync_struct *fasync; + struct snd_fasync *fasync; struct mutex ioctl_lock; }; @@ -1345,7 +1345,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); } @@ -1383,7 +1383,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); } @@ -1453,7 +1453,7 @@ 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); + snd_kill_fasync(tu->fasync, SIGIO, POLL_IN); wake_up(&tu->qchange_sleep); } @@ -1521,6 +1521,7 @@ static int snd_timer_user_release(struct inode *inode, struct file *file) snd_timer_instance_free(tu->timeri); } mutex_unlock(&tu->ioctl_lock); + snd_fasync_free(tu->fasync); kfree(tu->queue); kfree(tu->tqueue); kfree(tu); @@ -2135,7 +2136,7 @@ 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); + return snd_fasync_helper(fd, file, on, &tu->fasync); } static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, -- 2.35.1