From patchwork Mon Oct 24 11:29:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8737 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp424009wru; Mon, 24 Oct 2022 05:26:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+6e/rIxc3+pdmarw9Wp4tpQhrf1u8FFvPCFKg5gdf9Xmk6L80B4cL6iNOaMBdlJ+hCru7 X-Received: by 2002:a63:8bc8:0:b0:461:ff70:7546 with SMTP id j191-20020a638bc8000000b00461ff707546mr28447963pge.70.1666614384979; Mon, 24 Oct 2022 05:26:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614384; cv=none; d=google.com; s=arc-20160816; b=HByHUWWEAT7rshw9O3Uascs7yqJNBJ1+NnKDQyYvc6Mla7BBwHxuSv7lpE7UI5npZ2 FgqAuoJODLkQHt6FFlmYuI5les5t8yVnrNHnt7GRb7tsCevlf5VyUIkFTYbewAvuLhY8 jPDBA+Gbim/zvJnkLz5MZU+ka2ehhzK2LfSBJTWxmmKKvdvZIhIIbsNKunaZz5rpFsJR wk2r+2BqjP0H48gkTwWvp0ekBjpfbqhGaP88THm2YalIKR2eAz1YxQJdDV6STpzExa8b pzkg8KZXuf/uGza1nKRzdPInQu0Dc0dDThejB5xtL5bKqMYCbJqH9Al2JNlMmvQMgQ47 YBag== 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=dBLLpsR1iPYwE8shFTvqe4zT2W/wYiW7XgileQ+R40U=; b=q3DSkR2yNYyZ85iErGxScuNXxIBMgpuGyI3FSbfiOZCNZqLugbm5m3/k3JK72Udxy3 +tmjs7OoPoOtVP2HBUgwRxG10vrMsrjbXzvbvI6wXyeZ2+B4mXxIC+uYc++vq8uW0DKc Hb5XIZ+ZB3rloppaXo0TTgQEbCotWI6sN9CidY3JIK01iEMycTFowInPMbDtp+2ZnB+/ +zgQxZe6wmT6/jG7d7DA20D+7RoZfEmwR7yiKx0rnGV86nAfjHz2Sk0vcOAT+JqdhwiY KO1jYj7BlUDfHsfZtoUdyNGJyUPL2XJZKq8DQ7DEAEKskkqF7ped+pEZrJRmMBG6s1bV K2yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Mw8ddgqm; 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 s13-20020a056a0008cd00b00565ab6fdd86si39016875pfu.56.2022.10.24.05.26.11; Mon, 24 Oct 2022 05:26:24 -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=Mw8ddgqm; 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 S233651AbiJXMZr (ORCPT + 99 others); Mon, 24 Oct 2022 08:25:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233756AbiJXMYN (ORCPT ); Mon, 24 Oct 2022 08:24:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C64D37F8C; Mon, 24 Oct 2022 05:00: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 ams.source.kernel.org (Postfix) with ESMTPS id 5A795B811E0; Mon, 24 Oct 2022 11:55:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABC89C433C1; Mon, 24 Oct 2022 11:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612558; bh=FyCdJYzELcqWqBl95dcc8i6zX3vwHF5ZkCWr/GY/HQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mw8ddgqmRcpKv/CE7zpye7vkn8KIbb4wFj6h0LZ47fkAqSs9Qk0fOgk5WvmRnjzsH uGFpBEbKU+bwGc/nUwK/kdExQuw0fq03gvMDxJyUbSbBBezMH7J8OVKBI7UZxVLdvS J56v9Df7n78I7cEA7hiq+cOe3dirAeGbA9cmxcrA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 4.19 033/229] ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() Date: Mon, 24 Oct 2022 13:29:12 +0200 Message-Id: <20221024113000.187580600@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@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?1747571845312600952?= X-GMAIL-MSGID: =?utf-8?q?1747571845312600952?= 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 @@ -1655,10 +1655,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]);