From patchwork Mon Oct 24 11:26:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9707 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp544929wru; Mon, 24 Oct 2022 09:33:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5xAtP8n3bqbQHyAzx2lw8QXh78rLs8wB6KtowluA+PKKuR+TXkW0dwgVTOXRGBIDGKQXDs X-Received: by 2002:a17:906:846c:b0:7a5:ccb:c174 with SMTP id hx12-20020a170906846c00b007a50ccbc174mr7307459ejc.583.1666629193814; Mon, 24 Oct 2022 09:33:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629193; cv=none; d=google.com; s=arc-20160816; b=i9Cm6hxX8aAI9ojX8AuskrJ82z2HDvMxRBKpO3dBkUi1WRh2egz6ShdqEebqf6CIFL pESZ6AJ/e8FQ6MdX4eQvDbqI6xXiHKoog0wLm19eufcnGktPulFyZZlENlkTh3N920qG lKd3nC8oPY4FE7iO64xBUGKnm19bOcOK2UFnAAxAH5C3xBZ8oH80MgPoKqF9ut6Y0+oY CuOe9lfLS5o6Tb1+i1Wkxxjj9nzbDen04/BtEYGK0ZvuX0Y3ZbS40lj0ap9L7vtW2wYF PY7jwPf2CCbHway7DUyJMkZOCMcA6VeRwaAMAFIozi4sUgE9F1UmUk61b61XLd0Vr6k8 Ze/g== 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=JLX3+bbud0xfFoHAWSA6wno6dI4KVrCLC3YcG5qX26s=; b=c9umpJudwpJnMqd0iKmuhICMqU+Pjrn2FxoKa1UM8Lnv4SYlhGBMcVie5gge+qcvTQ Gt5CQX7/XKuEtKP94/I3SVyvQhd+PBOlgN8tNOfc+9c4kmSNw+1FBvmSIR/xl3NW9Th5 CDdZc68lvkTDj0hAS8jX0tmDGh8D1Jf7X6xBolEiTyeelXu6HO0qbOBcWG8IaUCM7Oid SAvUW5x6iXZPgZr42eKYSPD7IpkCLabga72uAwl4/XJDJ/v4zlXyyiPoCBffYE+oPOY5 z+92lu2kmyxDx8UnUX5oQTppUn9DH8n3FOB+UrnJCHj+2/zQBVEWVnr285mbqpYPHEOo pf9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YGRli9ik; 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 qf34-20020a1709077f2200b0078df6780adfsi227551ejc.22.2022.10.24.09.32.49; Mon, 24 Oct 2022 09:33:13 -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=YGRli9ik; 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 S234082AbiJXQQN (ORCPT + 99 others); Mon, 24 Oct 2022 12:16:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234356AbiJXQOq (ORCPT ); Mon, 24 Oct 2022 12:14:46 -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 4916613226D; Mon, 24 Oct 2022 08:02:25 -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 B8162B81338; Mon, 24 Oct 2022 12:16:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 190FDC433C1; Mon, 24 Oct 2022 12:16:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613789; bh=kMvBlkjmS9JmIfNXHRt9OvFXZBDg4ubqH1ggpRsAn7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YGRli9ikFXP6c+x38J5LhiocB9zUh8uaK3NFd/BCJisOL9dJfFS162XAn8K0nZq7Z YBhe18gdkMslpV7ZKM39aKnIrxzVwl5LMhHk1EIrz6ENJ4tmi2doeWo5+woI+iI49H TAKpuhqKtJCPlGGVa43rSb4wvrk19DhGINw0thxM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.10 002/390] ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() Date: Mon, 24 Oct 2022 13:26:39 +0200 Message-Id: <20221024113022.624825696@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@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?1747587373470081389?= X-GMAIL-MSGID: =?utf-8?q?1747587373470081389?= 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 @@ -1736,10 +1736,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]);