Received: by 2002:aa6:c429:0:b029:98:93ff:f56f with SMTP id g9csp3392183lkq; Mon, 23 Nov 2020 04:39:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzo0vtxmN0jtvAVrUWV8XQ7/ZMIsOZnt+iqAXxOLV8FMcVn7urKGtWS7AYXh7/KBkVPWHvK X-Received: by 2002:a05:6402:54d:: with SMTP id i13mr49168279edx.3.1606135173332; Mon, 23 Nov 2020 04:39:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606135173; cv=none; d=google.com; s=arc-20160816; b=iKaVcHIRWJBNcd66YWOBUJFa9yBXyy8ySUHFTCsxDVv5zmiJw/nE7YDWL7KYT904se OGigznhF0Degb49S3mwjjQBwvUXxItVqhcHZnePfMkOdpTo7EkgM9jh9NQZsN9QGbH2z OPo8xCB3tGZlby79vjM1BKTYPzoWWj4GClzhtZ6U/OZEOcbke/fpAJI0Ac9j2EOsMQRz +iCLvHoSbCP4vz2fZMhr47WwGQNu+W41+g/+hhBEkj4MjsdzhIL0PhCLcB0RrFfiokq9 rjvOwp63hVosX/Mo2SFKykVR/9qzAXrvvsYAABW1X81yW2+XkrSAMhtkm8Lo1qLn4tx4 njyQ== 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=5P7HoMWcINWJlPhJImtY05fRUuUpBMtQiAkGMWOhBhM=; b=zLNLwYpqWR7LULFccOfzUnmAlSJTeKpuPNZVp5tSctnBXpSuKQLGekflD+Y2QUW+2b JJV2DgE+OB2nMDFlDTeWqWx+oCcItkWU4i36wwDKgvV3RwkVqU4MZxgS97hF7E4Q22TG vmOsY3/ogZtyglIixFRboEW4Li2yG8rFpEVpxyIhFCyw5gZUomoVwb5rCG4vMSggSHmk qMehyxMeM1ZIel+HJ+DUUcL07uj8jV1XyCHeYpm7fviEpp85E91HO+/KkaWkjpZhDWNJ vcymO1nKRM3aIexmvpwGBDDu91PmcKgqbP1rSNZ+KsKKcjM+TWM5I4e6GeegCkBAyUk3 ZTKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="gVTqJ/T4"; 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 l89si6373752ede.577.2020.11.23.04.39.10; Mon, 23 Nov 2020 04:39:33 -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="gVTqJ/T4"; 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 S1731288AbgKWMd6 (ORCPT + 99 others); Mon, 23 Nov 2020 07:33:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:45498 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731282AbgKWMd4 (ORCPT ); Mon, 23 Nov 2020 07:33:56 -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 64D5A208C3; Mon, 23 Nov 2020 12:33:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134835; bh=tJbZKXe6A0C3UQjO/RIGm2lp1AlNOC82cfKbavYT8ik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gVTqJ/T47KpOAvlBbqCHk11Ybu+PGp8Ypwlwy9xkMCuIGdRQxTBdTC0BYz0zKjrsP oIXTWZzWtn5TGPoBvdv9Tq1MBV4LgJUft9p5DObrPoxIdsqok47Iiuk6JNdySTVcSm +gH4im7cnCdtxuSeu2nH4KMsLHoXTftauJSoRW8Q= 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 4.19 67/91] ALSA: firewire: Clean up a locking issue in copy_resp_to_buf() Date: Mon, 23 Nov 2020 13:22:27 +0100 Message-Id: <20201123121812.579309994@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121809.285416732@linuxfoundation.org> References: <20201123121809.285416732@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 @@ -124,7 +124,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); @@ -191,7 +191,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