Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3414558rwa; Tue, 23 Aug 2022 04:30:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR7fbyE4jte+5CwgmupU7vDpn631W3EYBsBBiDTJy1uXf4vB4ETrs8/QLp4knswKjEYGuMkl X-Received: by 2002:a05:6402:1f02:b0:445:f674:eac0 with SMTP id b2-20020a0564021f0200b00445f674eac0mr3168763edb.370.1661254243023; Tue, 23 Aug 2022 04:30:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254243; cv=none; d=google.com; s=arc-20160816; b=sij9i+2vAUlNG22dkHetj7NH8+Z3dVhHy/430gxEu6XTn5/36tba98TV9c8XlBtAaf 9WejdsPMaK0rWDn21iyB/CFJIiEojZCk4UwPCSF7G/uEsTCFFQcBk/sFLe50O4Ndzlbi 9+HS3SuvQBMsOA8n7ku8s5VVUPt9cdEFFQBmP6HAdyIP1+C3xMyxj1eFVvXBwJ734/ZX fa2CWr8KkcW7k5NLn8EdWaJYEzrNOnCZTW8aoRZtD9ekj4T5xPP3nmw7uYk/vyLxEiZS x+HkrQCjGsxZCD8lQhOrdrTAGzqfJxWdBxu9GnUC5x17qMnpJqrE2nPYx1ZEYGHeE9xS JS3A== 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=oAgNfcJsACpIfpBgwBYqq94NN+s41sH7ANe+2reOIgE=; b=I2oYMKJ26jqjS9x46hsb9K8SPFnr0Fm2uw/eyZtax9x2+BzC5jLtI8iM5hVBaLNHEh ethCK7E0ta32j/YTWfY2eYxKLCnlVUBrlEg2D5XM8b0WPSeqDVXDEum2SmSzAy6d360M oBD+SoxbluxdE7lEM7wcoe5K3xAIhqT3IkT49QHB0O1AjcnsOIm+2+9qsI+ACqQNH1Pn tvY9Q90HSN2/y/8IUHKaLjqBM/fhmVGVwitgZzPcS3r5l2Zvb4SPKSbuGIgPNAUXgGzA yJsIuLp7ISqjobD1V4WF2qoLSr5Dbh3GIZdHRrXvhyXWb9t8c4snlEmb8ZqvE3ohdJ7t sIQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gjeN6iwc; 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 nc22-20020a1709071c1600b0073d92f83e06si2835284ejc.887.2022.08.23.04.30.17; Tue, 23 Aug 2022 04:30:43 -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=gjeN6iwc; 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 S1349438AbiHWLHD (ORCPT + 99 others); Tue, 23 Aug 2022 07:07:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356972AbiHWLEi (ORCPT ); Tue, 23 Aug 2022 07:04:38 -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 BE0BCB2769; Tue, 23 Aug 2022 02:15:18 -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 4BBF9B81C4E; Tue, 23 Aug 2022 09:15:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96E85C433D7; Tue, 23 Aug 2022 09:15:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661246110; bh=fkS0yNqWNFUiOtkYMouC7Nw4WkF0NzDt3nXIozKSnWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gjeN6iwcsiFlCyPI94xWydayo04FueqO4hScsfM+1pe3dB1WQ+DIBxiznaOXDpj/z JxmwHZLefVQzCRdKMzdoXfoDey1V28wqeE9ePyR6hLtrtC5zOXMdrfQr+dQCGg05Eh J2EH4CCyiwjTLskqsES+hqQ32On9No7jF7kv9Yjc= 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 4.19 278/287] ALSA: timer: Use deferred fasync helper Date: Tue, 23 Aug 2022 10:27:27 +0200 Message-Id: <20220823080110.795772629@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@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 4920ec4f4594..f0e8b98f346e 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -75,7 +75,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; }; @@ -1306,7 +1306,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); } @@ -1343,7 +1343,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); } @@ -1410,7 +1410,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); } @@ -1476,6 +1476,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); @@ -2027,7 +2028,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