From patchwork Wed May 24 17:41:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 104353 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp391247qge; Wed, 24 May 2017 10:44:53 -0700 (PDT) X-Received: by 10.223.164.198 with SMTP id h6mr20885374wrb.44.1495647893381; Wed, 24 May 2017 10:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495647893; cv=none; d=google.com; s=arc-20160816; b=RYWB00ieJKgR1qNkNZdU+9GIlljiH76J4qjV9EcLMlLTNRW/+Qp2hMFtHi/q785bul qPnPv0ZSZc27Iy4MRo5r2azoEC6uDrhYxrh5WTGocV9C2BU24E/Duse7KoDMLTL+CUdW xgJG0t0KnzhpvwnNyV2sBdK/mBeXANrj6QdYK53gXMVVDryDijtPOtQ+mJNjRzt3yTEQ qLrkt2PLTuLQeFZwjyQihGUVMDjCHvPnO9LFjIc7tT4fap95g1WslHUm4QRbff2t3KSp /7K3c0Mez0P74T6FxUFbADZvjzGPFeB8nS/yZZcWNq7hze4gz8M+ROhvFXEPMGav11dk teLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :delivered-to:arc-authentication-results; bh=Z776mgMCqpyrDddBoqUsYUbA/U8uuRrhM+/AAFaaAwQ=; b=HOsANfyVf8u1vY+jTKNdB/PJddAl3rtgxAIFM8ORRha595vWldI3MV3JLteHH3KG1E dNr89GQZv4aOrASwMJ98lG/au5Iv9FLViLmtpxB6zxM9ZK9ClG/aSF7wkBEwnfvO5qyN NoMAC0+8fonbbXoLs8k3kdFpfiHP5sYBjk5x1kZYacWgNmJFjBgkx+drjRINRGGIrs47 2lExXq0jCI6RnNsPO3RMYwxBdIHFJDflmxmsJnGcQjJU2LMKgWknJBYDsfkRcy/ThA/k TKwccFR46K80mM5ETJEF1MbWyAuEYjyO3fT1PcAO7lRjEWc4DbtffDapqtgL5fElqQ+i 9oHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id e189si7047480wmg.138.2017.05.24.10.44.53; Wed, 24 May 2017 10:44:53 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 96BDF2673CF; Wed, 24 May 2017 19:42:27 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3BE722673B7; Wed, 24 May 2017 19:42:21 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, RP_MATCHES_RCVD, SPF_PASS, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mezzanine.sirena.org.uk (mezzanine.sirena.org.uk [106.187.55.193]) by alsa0.perex.cz (Postfix) with ESMTP id 96D0C26737B for ; Wed, 24 May 2017 19:42:03 +0200 (CEST) Received: from [2001:470:1f1d:6b5::3] (helo=debutante) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dDaIH-0004vu-En; Wed, 24 May 2017 17:41:59 +0000 Received: from broonie by debutante with local (Exim 4.89) (envelope-from ) id 1dDaIE-0002pS-M4; Wed, 24 May 2017 18:41:54 +0100 From: Mark Brown To: Pardha Saradhi K In-Reply-To: <1494857671-19257-1-git-send-email-subhransu.s.prusty@intel.com> Message-Id: Date: Wed, 24 May 2017 18:41:54 +0100 X-SA-Exim-Connect-IP: 2001:470:1f1d:6b5::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Cc: alsa-devel@alsa-project.org, Vinod Koul , lgirdwood@gmail.com, patches.audio@intel.com, tiwai@suse.de, broonie@kernel.org, "Subhransu S. Prusty" Subject: [alsa-devel] Applied "ASoC: Intel: Skylake: Fix IPC rx_list corruption" to the asoc tree X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org The patch ASoC: Intel: Skylake: Fix IPC rx_list corruption has been applied to the asoc tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 5cd1f5c32132101955d7f0e1955249a84f9b6fd9 Mon Sep 17 00:00:00 2001 From: Pardha Saradhi K Date: Mon, 15 May 2017 19:44:29 +0530 Subject: [PATCH] ASoC: Intel: Skylake: Fix IPC rx_list corruption In SKL+ platforms, all IPC commands are serialised, i.e. the driver sends a new IPC to DSP, only after receiving a reply from the firmware for the current IPC. Hence it seems apparent that there is only a single modifier of the IPC RX List. However, during an IPC timeout case in a multithreaded environment, there is a possibility of the list element being deleted two times if not properly protected. So, use spin lock save/restore to prevent rx_list corruption. Signed-off-by: Pardha Saradhi K Signed-off-by: Subhransu S. Prusty Acked-by: Vinod Koul Signed-off-by: Mark Brown --- sound/soc/intel/skylake/skl-sst-ipc.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.11.0 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c b/sound/soc/intel/skylake/skl-sst-ipc.c index 58c525096a7c..498b15345b1a 100644 --- a/sound/soc/intel/skylake/skl-sst-ipc.c +++ b/sound/soc/intel/skylake/skl-sst-ipc.c @@ -413,8 +413,11 @@ static void skl_ipc_process_reply(struct sst_generic_ipc *ipc, u32 reply = header.primary & IPC_GLB_REPLY_STATUS_MASK; u64 *ipc_header = (u64 *)(&header); struct skl_sst *skl = container_of(ipc, struct skl_sst, ipc); + unsigned long flags; + spin_lock_irqsave(&ipc->dsp->spinlock, flags); msg = skl_ipc_reply_get_msg(ipc, *ipc_header); + spin_unlock_irqrestore(&ipc->dsp->spinlock, flags); if (msg == NULL) { dev_dbg(ipc->dev, "ipc: rx list is empty\n"); return; @@ -456,8 +459,10 @@ static void skl_ipc_process_reply(struct sst_generic_ipc *ipc, } } + spin_lock_irqsave(&ipc->dsp->spinlock, flags); list_del(&msg->list); sst_ipc_tx_msg_reply_complete(ipc, msg); + spin_unlock_irqrestore(&ipc->dsp->spinlock, flags); } irqreturn_t skl_dsp_irq_thread_handler(int irq, void *context)