From patchwork Mon Oct 24 11:25:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9378 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp478061wru; Mon, 24 Oct 2022 07:16:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66qpd6LLZEx2af2Bc3kjgKSETI0zHJ9OZx5Lbu3jl0BLCw+mrKT3nX62oUIdjHPGwJwgWE X-Received: by 2002:a05:6402:520f:b0:45f:b7a0:a31 with SMTP id s15-20020a056402520f00b0045fb7a00a31mr23860419edd.379.1666621008648; Mon, 24 Oct 2022 07:16:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621008; cv=none; d=google.com; s=arc-20160816; b=0PIReS3vF5vsbsFbbCZODAWUsADZ1JBJtwpabkPtl/AxdjDM1y5kFYcoRrDB1eJUWz Y67/rkXkQcPa5RL3egq/ZseX+1+i6HNe891p8mvfQZBgVxKUaZ8vm0q+q/ZYCAnLKMgv 7rR8r332GsYvWPxumMjms5vIpgpRPWnzYYqAcWtNhzoif8MZRZ+v3bbZZyGFExhpfd7o cgW6dkE6nc0vCFc0QVYMJsHaar2pHC0aTqAOGPVYpUDdJhwDystyFjLeWGGB4mdsUsdh uqJR4FaUw7gPp8CsZmOKRLTw+LjaUkp4UhbhFW3YFo21I9q+ednGOCYeT6a/0/fCu9G4 1Yhw== 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=wjBfyjpLNPbchMH1CVZmeGfrjU+xxk5V2kR24l2icRVi4j/Ayh+rBMZxmo7dqLVV4L njxSE9TssbW+N/m2EjfY0p27xyq2k5Box77nEtGShbMFRWQvhGmiXkOupc75eLzpqaXn Jc6m6vWhG+wRV7jOZhDun2owlFtbQYZLBybDNTkpMMP8OHDz2kIvIZWLKRSC7qNXnSEq OEimU79ULjwjThRD0SmRWhsa/EdpfocouQ4MB/YOhuEwqb+rACP0KqKmMK3oFdkX2+vL JBQw9CVByAFhxKof7j2iPLub2Fw36MwhjiWNTv47iSKeIL0syopjkQ1ofv6QYuLeU7p3 nttg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F1LQUuJQ; 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 hp35-20020a1709073e2300b00781d695b597si32365480ejc.473.2022.10.24.07.16.23; Mon, 24 Oct 2022 07:16:48 -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=F1LQUuJQ; 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 S232398AbiJXODm (ORCPT + 99 others); Mon, 24 Oct 2022 10:03:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236954AbiJXOCY (ORCPT ); Mon, 24 Oct 2022 10:02:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3EB08680B; Mon, 24 Oct 2022 05:48:19 -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 E31FA6128D; Mon, 24 Oct 2022 12:34:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03E2CC433D6; Mon, 24 Oct 2022 12:34:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614859; bh=8fi4KRnTeAjrn2RZpFpUaMqKpGr4C7VXsqZt/H77q6U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F1LQUuJQiWNLXkWgWjMd6rGagBa5VkuIJeC47/CJbE1E7MGdGLch7DtagOFMlrdzV DXqQju4Dqx5fiXNxPZJXJ9saOIKNEqhRj43ouHQy5aED5/dkluB/18t7KMwFAD8Ch6 zmBTd3tIYTDSUSBz1Fkj04/XLXCVNr8qdHAEWsSQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.15 003/530] ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() Date: Mon, 24 Oct 2022 13:25:47 +0200 Message-Id: <20221024113045.140040293@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@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?1747578790874784885?= X-GMAIL-MSGID: =?utf-8?q?1747578790874784885?= 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]);