From patchwork Sat Oct 22 07:18:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7150 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087881wrr; Sat, 22 Oct 2022 00:37:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6d2rAXIdHFrS5n83bLtnPGWXidzQR/bqmi6u+rGrw69BcXQQzcdrJu2rxlQbfHPcdJi+FZ X-Received: by 2002:a05:6402:7d7:b0:460:8460:134e with SMTP id u23-20020a05640207d700b004608460134emr11306409edy.84.1666424277541; Sat, 22 Oct 2022 00:37:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424277; cv=none; d=google.com; s=arc-20160816; b=LiVYFYQESiSn1/h0tGP872f6IMF1aF+MTZf4Win+V/IOKd60a9fZOOVIhLZhQFypEh RFCQPHZSs4SL5WgmXMPndEDty0KzZmLGgdxaNtRQPIWlS9pIEPU6SVE05s7EXJyLJRZx ZRmA1/lDq+UKhLaPiaGWPQ4OeMKNYVlD/7CEf0yHvhcehdlKrlfvH3q1o8xwtvn2hcjE W/y9GX8HpF38DYgJvGaRIbAqjE5rFHuAZFgFGh+5jRUGTzgsWn2QbIdQTtWNgJdI2f86 Wo20B1UCvDaPgRlcXswUvwAzmdkFbuB/A/L0qGWJlPrr6UDhgUNe1IpvPSD/nuuYKZwz 4+vQ== 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=03jgGr6HwFQAtS5OxGZuj5lNrcCdb/ggv6vvWFUZ4Gc=; b=x9893qPTPgdOUDIvWvnfdNEGcfbSnbBb/TzyWt8Pw6QTwzoaPR2tSEP7IrzXNfaKZA JSdmuSpzMFMOJ8DA5IB0IS33zl9nTybCehwKzIx+cxi1j2nymPL9vzyzTEASn8L50A8u wXJdO2I2EQdTzvYqRTsJVJJcrgJymCG5fq2I7oOK9aYVklfO2JlLfENfbxg221cVTwQh TUrPT7ulWwMeGLd4k+TdbH70tmNE+tcnAu37UcIQJB1Dmz1fiFq/srV8dlOV+h+xD67V sfApY0ANK/sdAoCS9qGPxJiLVDZb2bgnBMfidLyQjiBzOBC2A6d9TimKJO7lJyMQlZe5 2sbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uyenJxij; 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 b12-20020a056402278c00b00447a7af56b2si24781968ede.326.2022.10.22.00.37.33; Sat, 22 Oct 2022 00:37:57 -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=uyenJxij; 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 S230303AbiJVHg6 (ORCPT + 99 others); Sat, 22 Oct 2022 03:36:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbiJVHg3 (ORCPT ); Sat, 22 Oct 2022 03:36:29 -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 52FF036DD5; Sat, 22 Oct 2022 00:35:12 -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 2A123B82DEF; Sat, 22 Oct 2022 07:35:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65988C433D6; Sat, 22 Oct 2022 07:35:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424107; bh=8fi4KRnTeAjrn2RZpFpUaMqKpGr4C7VXsqZt/H77q6U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uyenJxijD2Whif/fKhAg65xur7rVaqr9O8y6TOVV4gtMCw9u++ckorYghGGbf8OH4 V87bU5MbMfhMHLHlP+JVTSm2pybgcjkM2WNi18WFyngwp/bFJKHEOGPtxulZ1LqU7B FHutiANflQ2GMW0s2azv3lwdoFPIVbt+iPca243s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.19 003/717] ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() Date: Sat, 22 Oct 2022 09:18:02 +0200 Message-Id: <20221022072415.630907767@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372503570825252?= X-GMAIL-MSGID: =?utf-8?q?1747372503570825252?= 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 @@ -1835,10 +1835,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]);