Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1239196pxu; Mon, 23 Nov 2020 15:38:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3Zee/ctn/gMX4PGlYaA52krW0jpSWpA8KSjUqYgJ9BWYqJMjcGpC/CNMbqBN4TLOYbmNW X-Received: by 2002:a50:b224:: with SMTP id o33mr1461543edd.21.1606174701145; Mon, 23 Nov 2020 15:38:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606174701; cv=none; d=google.com; s=arc-20160816; b=bs2iZ2nEnsokP88Dw0+u/d0j7Zj80oX+/EvG5g3hiwPV61eHc2VgueNQZXW5S0SNRf VR47lUKb7VoF9njVjA2+OaaP5drIZ2hRS1cbwJFZDbFFchM7ulkhS+ee1KIdSzp+rPsG ulRQUySYyOsCtd3VnQ1s/DqXc2ZQlmcfBlY0XY8/Sk75veND5AESOt8KGbGmicoD+HZA 3XHcCNmDdMpdcqmeJZqJM/z+WhcjHdLC8QJUiSFsAS1oDcYnmeuaYkBO9ruDYkaCO7OD 1qprLJPlTCVSfsC0HwOJv7DRZhP2ibxDJZJqz84PMOTPzeRNfRSBba6zkJecFc2CKRKs VoeQ== 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=Q+CKWJAwC8+7cqSK0j+es9yy/YFPyQqsoputdF+fCzM=; b=WuEW2WeA5VovaGt6ZhzjdKMjW76R22DsflwoP0YAg5tUH8olc4t1kO8Iy3vHoxQe0t Dz1jG5XEKtOUvNtsgHU2gcHLzU5D2wsALvLT10w1d4qDGxZWUnhLNZ/2KIjcoKtYvzLi Y77iag+euYKL/u2egFzU1O5/2pQwfV632+0oyAHjorYRVF72dnks5Wwrt30lXKGGhXRP nMFZke6Z0Izi93fBMF7q/VJa1YUS6lTfmewn2T99Oxj4sLJ1wogxzQhXHbSHB5JM4vgc ckUENpr0Zwos+twaqS0qzRHE8mnoKJKy6A3nzI02wt7RchxVzosKjcrLjKfb0ZGkwdFb UF4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="JoDYoNa/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bf9si7325381edb.241.2020.11.23.15.37.58; Mon, 23 Nov 2020 15:38:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="JoDYoNa/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1732261AbgKWMj1 (ORCPT + 99 others); Mon, 23 Nov 2020 07:39:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:51648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732158AbgKWMjA (ORCPT ); Mon, 23 Nov 2020 07:39:00 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 93BF22076E; Mon, 23 Nov 2020 12:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606135140; bh=eM/A2Gt6qPDjT4lcbUVvMzb+xRiqchOcjtPCv+PF9YE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JoDYoNa/i1P9HfoOk6nPo/QRec+rasKM5TxU/wAnAy4ZTqGtAoZ0onN2sQFOUS3jP xZLB7HEhx1ecXy75yf3s4nM9EMEcPIHLM0D+ghLc0lgxHeC0b2qwm0QqCsu/0iFU4Y fwLN5DR8SzhEXD05kH/6lQGCTGyLGdAaZrP56kK8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Takashi Sakamoto , Takashi Iwai Subject: [PATCH 5.4 117/158] ALSA: firewire: Clean up a locking issue in copy_resp_to_buf() Date: Mon, 23 Nov 2020 13:22:25 +0100 Message-Id: <20201123121825.583279079@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121819.943135899@linuxfoundation.org> References: <20201123121819.943135899@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter commit 02a9c6ee4183af2e438454c55098b828a96085fb upstream. The spin_lock/unlock_irq() functions cannot be nested. The problem is that presumably we would want the IRQs to be re-enabled on the second call the spin_unlock_irq() but instead it will be enabled at the first call so IRQs will be enabled earlier than expected. In this situation the copy_resp_to_buf() function is only called from one function and it is called with IRQs disabled. We can just use the regular spin_lock/unlock() functions. Fixes: 555e8a8f7f14 ("ALSA: fireworks: Add command/response functionality into hwdep interface") Signed-off-by: Dan Carpenter Acked-by: Takashi Sakamoto Cc: Link: https://lore.kernel.org/r/20201113101241.GB168908@mwanda Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/firewire/fireworks/fireworks_transaction.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/sound/firewire/fireworks/fireworks_transaction.c +++ b/sound/firewire/fireworks/fireworks_transaction.c @@ -123,7 +123,7 @@ copy_resp_to_buf(struct snd_efw *efw, vo t = (struct snd_efw_transaction *)data; length = min_t(size_t, be32_to_cpu(t->length) * sizeof(u32), length); - spin_lock_irq(&efw->lock); + spin_lock(&efw->lock); if (efw->push_ptr < efw->pull_ptr) capacity = (unsigned int)(efw->pull_ptr - efw->push_ptr); @@ -190,7 +190,7 @@ handle_resp_for_user(struct fw_card *car copy_resp_to_buf(efw, data, length, rcode); end: - spin_unlock_irq(&instances_lock); + spin_unlock(&instances_lock); } static void