Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1742630ybl; Sat, 11 Jan 2020 01:54:54 -0800 (PST) X-Google-Smtp-Source: APXvYqykCJKBUuoTbvvsIOC89JAtZjYJhP30SBz3pwEHkzYu7H/kItZu1jWvKG1ph0ssxSGuv6Oi X-Received: by 2002:aca:55cc:: with SMTP id j195mr5849526oib.22.1578736494053; Sat, 11 Jan 2020 01:54:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578736494; cv=none; d=google.com; s=arc-20160816; b=Rqobxe86ePDqP+J5pynP8P1OAN6Ix+ngDbiKBYlrDMpSLsisOzjhwK8ZGzhnb3uDFp 90EeWpuE1mxs7Na3qXrtJVQzg1B1xkY4rx7iWl23pDOJv0zAZWnVl7SMvCUXJ1FUA0iz +YYx4URgoCqsz4B36Mo+LdNtteY96kaTg87856VlKvXQzZO5z7a1HKvjgr9w2YoTqwQu fdHRn4R60yfpuopnm3S/PaLCDyxKW6EnsVaYRJBF1gJ8M7xs8jkbneOAWkSLS0aRdQYY nwKPvUupVx9thrYJlDx4Z8DXOg3ADbUAAmCZgwBN3gLeT5sJPkdW202e2wgv3bsAAH7s wIww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RPHdGMXFArp+Tg5md8bcTMSS1IUtF/iUrJXllMLnUiU=; b=mMAWGOjK7yTrSTY4VEXJ0NeMZJR/h4gLDiEqETeRW/QDLuoYr2A1kIpncjJB0hJ8kb MYViykivjwBe4udqaUnEWhHn9GmTSQzFkCIx2+GujwxTu8gIbszAdba7CpeHzSjA69Ql 3QZDp8jNs+x/olQyU/yAGvRty2ar7lxiggFzBdXQVfteku8C8n3WtD8MDvLkXJQH9mw+ eElCH2+wLUORbgl0W4do+zoYoHYIFVmJgpjgDGxRcB0SI4ErPZNbLxsXJEpi8nRKx5mH J6qFxFEibnyuZCeQCBNAKUHAywUDoIZrcebj60haU4oV0VR8plxJeddlNfstMEGpaS0P MtLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CPPO3igb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l21si2732293oic.126.2020.01.11.01.54.43; Sat, 11 Jan 2020 01:54:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CPPO3igb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729032AbgAKJxv (ORCPT + 99 others); Sat, 11 Jan 2020 04:53:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:41130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728977AbgAKJxs (ORCPT ); Sat, 11 Jan 2020 04:53:48 -0500 Received: from localhost (unknown [62.119.166.9]) (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 E8E962072E; Sat, 11 Jan 2020 09:53:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578736427; bh=7JEuys0ygm7K41AezY4TjQQJBtt/HORkMiTSN189wM8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CPPO3igb9QVZg8tE3sj2eFDQTP6MV0mMTIBrmm/35qJHTU22SUEx8A7hRwbrM5IF0 WWIDeMlIRyymupblIdyPctVRAhUKn7J/9BRwNXqcCcNPy3eTGthtzEYBkxzLelf0zz 9BlTUVQ7Qc87xGvvsxJM5t9CkKaL0EU5w6kk3VyA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jia-Ju Bai , Takashi Iwai Subject: [PATCH 4.4 15/59] ALSA: ice1724: Fix sleep-in-atomic in Infrasonic Quartet support code Date: Sat, 11 Jan 2020 10:49:24 +0100 Message-Id: <20200111094841.490270629@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200111094835.417654274@linuxfoundation.org> References: <20200111094835.417654274@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai commit 0aec96f5897ac16ad9945f531b4bef9a2edd2ebd upstream. Jia-Ju Bai reported a possible sleep-in-atomic scenario in the ice1724 driver with Infrasonic Quartet support code: namely, ice->set_rate callback gets called inside ice->reg_lock spinlock, while the callback in quartet.c holds ice->gpio_mutex. This patch fixes the invalid call: it simply moves the calls of ice->set_rate and ice->set_mclk callbacks outside the spinlock. Reported-by: Jia-Ju Bai Cc: Link: https://lore.kernel.org/r/5d43135e-73b9-a46a-2155-9e91d0dcdf83@gmail.com Link: https://lore.kernel.org/r/20191218192606.12866-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/ice1712/ice1724.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -663,6 +663,7 @@ static int snd_vt1724_set_pro_rate(struc unsigned long flags; unsigned char mclk_change; unsigned int i, old_rate; + bool call_set_rate = false; if (rate > ice->hw_rates->list[ice->hw_rates->count - 1]) return -EINVAL; @@ -686,7 +687,7 @@ static int snd_vt1724_set_pro_rate(struc * setting clock rate for internal clock mode */ old_rate = ice->get_rate(ice); if (force || (old_rate != rate)) - ice->set_rate(ice, rate); + call_set_rate = true; else if (rate == ice->cur_rate) { spin_unlock_irqrestore(&ice->reg_lock, flags); return 0; @@ -694,12 +695,14 @@ static int snd_vt1724_set_pro_rate(struc } ice->cur_rate = rate; + spin_unlock_irqrestore(&ice->reg_lock, flags); + + if (call_set_rate) + ice->set_rate(ice, rate); /* setting master clock */ mclk_change = ice->set_mclk(ice, rate); - spin_unlock_irqrestore(&ice->reg_lock, flags); - if (mclk_change && ice->gpio.i2s_mclk_changed) ice->gpio.i2s_mclk_changed(ice); if (ice->gpio.set_pro_rate)