From patchwork Wed Oct 19 08:21:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4501 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202305wrs; Wed, 19 Oct 2022 01:40:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6jB34XyBG99/H53WUE7cATn6YJVHkpGeSSLpUNHslspoR3AWnMQwTRmF7kmhHiB8AYDhG6 X-Received: by 2002:a17:907:2da5:b0:78e:1208:8783 with SMTP id gt37-20020a1709072da500b0078e12088783mr5834793ejc.743.1666168820647; Wed, 19 Oct 2022 01:40:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168820; cv=none; d=google.com; s=arc-20160816; b=RUKVttVexJobqlCD2LvToMC6go1s0fR/AO2a4e/Ki4gbXIBthEOiDTAJ47CHhIkFxk kPTX+WRVLmWxbKFwAhfUXKc6ZVRDow9UBha2QDIQfnG9CtEW2AqjODYc8jvYQKXhyKL7 /kf1aiW0WJ4+oTSVU+5Ke37K15x/ndabAYsSGashObb9rTyaSYBM7YI9HSqu+47kwvMf dAM1+b8+L7AKSWgc0omjrpFWsarOej6VmpLhHHSX4+YptnZ3DvV0VMQPTeW1lyNB/In9 kTn5WDVvqlFUOy51Yq43zPLWq84J31k/52mioC+eBEGLTp3tXdPe9MMkz4xaQ44iKp6D 0X6w== 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=/G36dJCdLqkpszEmr+hpK7zmuIiuwgS82vTsUp4p6/c=; b=hEBPz6hMqA9NIP9k6sfGGjM3Je4Jq63U/FbZYY/ParQ8Zrwondp5uJc+C6N78vYLGm ltihPgSPiY4biNPd/WpdER9BwjmwTF4mMvmxNjtX6pYu/nXRZJTEF9w+iTMOUQgV/Qhy W2xhUZsh1/joeiWnu4LqMl65+vugtPRai9ny2Xudyv65rssSUBFtAwPZKZhunxmp/wA5 TAem7Dh8omxKR5tQXOTixqbH3xX1b8y8uRizROwPhQ12YJxEU3ZM+Dd135eFLVFxR8wp TTPBO3bHAg1iX1ypWJbNoaleKAYl2Npf4cx4vWl+/p9GyhvMPG0m2qI5gVNNB3n3uttf UOGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZSkL4oiV; 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 jx23-20020a170906ca5700b0078d148daf4bsi11619517ejb.409.2022.10.19.01.39.56; Wed, 19 Oct 2022 01:40:20 -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=ZSkL4oiV; 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 S230369AbiJSIj3 (ORCPT + 99 others); Wed, 19 Oct 2022 04:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230308AbiJSIiy (ORCPT ); Wed, 19 Oct 2022 04:38:54 -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 027CE786E3; Wed, 19 Oct 2022 01:38:26 -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 ACF3CB822BC; Wed, 19 Oct 2022 08:38:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F14A6C433C1; Wed, 19 Oct 2022 08:38:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168682; bh=6eLQVFcIp4Vgqw1RS1upxwn5IKwsEUEOJKr3XYirb/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZSkL4oiVDaS4SRGyoJ09lIc/QOz33+oL4by9HbmuzMKEQ2t9jTbbVbS/F738dSznM ipNrgKg4Swb42GOUN/ye6qVaZ2uOlppjQwhrv+kiWjE+HcElihatMiCQ4weLpwJdim jwdICwjfC/uw+KmTTzsV7tDk8+03wdh3njDNnSgA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 6.0 002/862] ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() Date: Wed, 19 Oct 2022 10:21:29 +0200 Message-Id: <20221019083250.085744456@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747104637290339237?= X-GMAIL-MSGID: =?utf-8?q?1747104637290339237?= 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 @@ -1899,10 +1899,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]);