From patchwork Mon Oct 24 11:28:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8861 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433072wru; Mon, 24 Oct 2022 05:48:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5bZQrBYL/0lf1nHzSohvvE1BG7ApLjTD8yh+6fiG39kbxQOsjc3I26PRi3IWf+0PtKWu9u X-Received: by 2002:a17:903:2307:b0:17f:78a5:5484 with SMTP id d7-20020a170903230700b0017f78a55484mr33518395plh.15.1666615711223; Mon, 24 Oct 2022 05:48:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615711; cv=none; d=google.com; s=arc-20160816; b=dchAl0kgqGJaE7r3LLna94ccceFoLs1YFWADwhDLvrL6WQ5LTUzMV/TY/PFGKcEjY8 QGvQi1aScSInNEOwQjNxYXgyLB1x5R4YiQOCTGhlmAm7LAftvslIYnmhgY+euthoHMQJ 6njVTJcmiRMWSe1asTupmhgJikuZPRMk1YLCLadARJlD9ez6bHS8pOPyryfSXKr6tJhf asN8TJAW3qouZCPsdRp08MZBH88jzrW5+TY6+IFg+aihaJcNob32gZz+fF6HtNLjfFee eArcbTRl3pdiPH3jDv9JqlsRthYUNMB7CdCygOyjRpS8qaWOH+063Cqlqbq3trPCqZRN of+Q== 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=fMTU+Kggvvg7kvqlunqAQMIKM1MWqcAMka+GLX5vcTc=; b=ZXZ4p899O1Sr2dnKxYuwk9WnsdmopRV0t3Kd/U3j+xWNsiQFnvAqbXjAF0i00vtRME TJWe1LNLwZFdpe4djizjw188lRt4R1bapfjUS3/TqH6us/QqpAhfb6cAj5s4Fasxi1Fp 637dDan16KTAyFjGAWSZ2I3kfWNAtuX0ElE8nya83H/glnZ4UD2jb+uvIu/tCTM5zm0m JjonUgzLlatFLRlIu3IKMpySi1JpYI/hDAluGiFrTA8NHPpYKD7PjJtaCv64epMlrkJQ 8KZuj5TWBq8tGCO1PpnvhjIDpOd/AKcvLlWEOI5ZfH6WV+qcYmhcN0ZtcH4C+6ekBZjP LafA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hXzecuUr; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f15-20020a056a00228f00b00556c1c66b61si3090063pfe.143.2022.10.24.05.48.14; Mon, 24 Oct 2022 05:48:31 -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=hXzecuUr; 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 S231584AbiJXMkt (ORCPT + 99 others); Mon, 24 Oct 2022 08:40:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232017AbiJXMgv (ORCPT ); Mon, 24 Oct 2022 08:36:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0421C89830; Mon, 24 Oct 2022 05:06:10 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 38D33612D2; Mon, 24 Oct 2022 12:05:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A7DEC433C1; Mon, 24 Oct 2022 12:05:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613129; bh=WPMtADYKcNR6ClKvdDNddtOONdzXkZDJTJ5hrPhY3hM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hXzecuUra+DX0jTjeI6gB5yEftan+4Ho+NnuYjTZmgUpUNtFBbF1P/It9yvb4xCX3 uPcReAGXCyAX+GOKbkXmWF6+M1R6OVVD9Kx5IXj5OdBU1peP+hGAJ1AdFkcVCMn33A q6rT9AIgveEj96FrGBEKeGNh7D/NBYxF8F2lksKU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.4 002/255] ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() Date: Mon, 24 Oct 2022 13:28:32 +0200 Message-Id: <20221024113002.546814497@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573235798537291?= X-GMAIL-MSGID: =?utf-8?q?1747573235798537291?= From: Takashi Iwai commit a70aef7982b012e86dfd39fbb235e76a21ae778a upstream. The register_mutex taken around the dev_unregister callback call in snd_rawmidi_free() may potentially lead to a mutex deadlock, when OSS emulation and a hot unplug are involved. Since the mutex doesn't protect the actual race (as the registration itself is already protected by another means), let's drop it. Link: https://lore.kernel.org/r/CAB7eexJP7w1B0mVgDF0dQ+gWor7UdkiwPczmL7pn91xx8xpzOA@mail.gmail.com Cc: Link: https://lore.kernel.org/r/20221011070147.7611-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/core/rawmidi.c | 2 -- 1 file changed, 2 deletions(-) --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -1662,10 +1662,8 @@ static int snd_rawmidi_free(struct snd_r snd_info_free_entry(rmidi->proc_entry); rmidi->proc_entry = NULL; - mutex_lock(®ister_mutex); if (rmidi->ops && rmidi->ops->dev_unregister) rmidi->ops->dev_unregister(rmidi); - mutex_unlock(®ister_mutex); snd_rawmidi_free_substreams(&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT]); snd_rawmidi_free_substreams(&rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT]);