Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3883168yba; Mon, 29 Apr 2019 10:03:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwWnhB4HmT2Mtj8UFDQgvO8Jzo+bJgzubeh+ZM3/+CiMO8Lygfeu1x8VFGOX2JNa9B7KIWM X-Received: by 2002:a17:902:e402:: with SMTP id ci2mr28030127plb.154.1556557419510; Mon, 29 Apr 2019 10:03:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556557419; cv=none; d=google.com; s=arc-20160816; b=jzndipGEfMgc9HyWyxvwIiSXiWJKBTrwvXgnKuanqp6c4xsp4NfvMfsFh+mmYUpVPh gUutYSqz1j1eEpXwoYqlU/Kjt1Xx98FwIGJ32oHamojR0/SSxg6tok5BPU+IZWUz6ElJ D2YBgF1qj96OgYcEM8cg6p8eDJ0Ee4Rlqw912tSZ7nIyocFdu3yAUWTlCQK8kWotMRm0 5GPvb3x1Fxs2gnA3voS0RvzGwHhKn7zep2v/1TSp/RHS0DosaU7FE4GEG8YKqHQmJabc 9rHQrjXh+6HIs6fJdkbNY5LxtfWyiqtlBvdBJgHPhSAmuYp+J9ahod93BVevHhKo+ER1 KDrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=wL3BmO/NnA3NwafXMitsQjGpheHu4M8s6Xt8v0Jomo0=; b=GWZreG5G4K63VOUAQgt53qcbywbX1ioSSyubKHsUvGXDLH4Gu2WZVU/AK+bBU2E8WB S9IVlFLEjhOHYvf65ljHGhznPVr/Nok/gsa5IgriHRs9q/dEu3U3i8n0yqhjMLZBcZ36 Ux2i0UecVZ22ofPcOmvVUJlmXULh4iBbnHV2cc+dqCQRQyuEdzKfa4YIsIclgf+58pKr aW/EvrYHMaJSBLCkje5+JnjyELUqeCnSi1xl1nJ02cIfy/DqSG7wiWSnb1OrEqU0kUr7 UW9kII2eF03/g4BYfLucTxq8xAJBba61JIm6fiP+WqKdnU/bm3tkBR1pjpAYI3k6KiGS wTtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=s2AGHwV0; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v3si32458499pga.354.2019.04.29.10.03.22; Mon, 29 Apr 2019 10:03:39 -0700 (PDT) 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=@google.com header.s=20161025 header.b=s2AGHwV0; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728776AbfD2RCX (ORCPT + 99 others); Mon, 29 Apr 2019 13:02:23 -0400 Received: from mail-it1-f193.google.com ([209.85.166.193]:55468 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728681AbfD2RCX (ORCPT ); Mon, 29 Apr 2019 13:02:23 -0400 Received: by mail-it1-f193.google.com with SMTP id w130so124104itc.5 for ; Mon, 29 Apr 2019 10:02:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=wL3BmO/NnA3NwafXMitsQjGpheHu4M8s6Xt8v0Jomo0=; b=s2AGHwV0MIipVuKm522AGWItowSBGgqT99tWc8KzjL140BVwLf0BNLJtwKT41jWXNL Ukof9nce0Cq6pB0k4RT6l+JJckq6LDo7dqUTee6F4HyesQwlrL6FccvupQpguUqjGpNE 1LBkfc1FShajkH5kEmAjl9yf5FfYh/FTohBDK2bup5Dt8ctFaMV91kmiluhGT6lwpsIL XNYRY1uDKflHGrH3ShCan7broKF2mwu9hB3Nri6Yuhib2DH1pqwGFDg425K6uze853HA YqRV8YWIdZh09HQ/zO2TrNYOfMHz1jkmWpxyVCVGrCB7tP4XVQzYSYBc/qRxDOruKlp+ OUKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=wL3BmO/NnA3NwafXMitsQjGpheHu4M8s6Xt8v0Jomo0=; b=shNTukxtl9IFF3l62rjUppl5hTesWqMQtINmn2dEKYmuQstN6aB7d3aD6RAlQdFd7D CKA/6nHZFwxA5ew8BFFvqPql0epyHa+s5C2VhXdc+u8VpQy+eIa+amJLhIG1hvpQfFoP UmY0WsGkgadJne4F6n42DGxNjBgK2zhA/e283LVIS3vvE4p6xH/mDXfUh/n6P3486Eja knRRvJd2Oi3VTyhOviszWrf5Pn8n6OXre/YsqoCKM3ULDAstvNZ/PyzQAfJC72YBgeB3 Oc+H2Nml2zQAuwaTcm6Jeez2eHNvhf99dOCJDP+fediXLPBkz+ssY7Ifk0nF7/LMDcbp QBxg== X-Gm-Message-State: APjAAAV5Ybt95YSvUXb+pZq2MaW5boMqcvzYpEW3nfXbJ0IIXE1UDptw 8thl2Pt3tA8gVOsd1JncQ9L9ow== X-Received: by 2002:a24:3602:: with SMTP id l2mr85415itl.68.1556557342335; Mon, 29 Apr 2019 10:02:22 -0700 (PDT) Received: from google.com ([2620:15c:183:200:855f:8919:84a7:4794]) by smtp.gmail.com with ESMTPSA id w2sm9289032iot.33.2019.04.29.10.02.21 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Apr 2019 10:02:21 -0700 (PDT) Date: Mon, 29 Apr 2019 11:02:19 -0600 From: Ross Zwisler To: Pierre-Louis Bossart Cc: Ross Zwisler , linux-kernel@vger.kernel.org, Jaroslav Kysela , Jie Yang , Liam Girdwood , Mark Brown , Takashi Iwai , alsa-devel@alsa-project.org, stable@vger.kernel.org Subject: Re: [PATCH] ASoC: Intel: avoid Oops if DMA setup fails Message-ID: <20190429170219.GA89435@google.com> References: <20190426164740.211139-1-zwisler@google.com> <0b030b85-00c8-2e35-3064-bb764aaff0f6@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0b030b85-00c8-2e35-3064-bb764aaff0f6@linux.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 26, 2019 at 04:03:47PM -0500, Pierre-Louis Bossart wrote: > On 4/26/19 11:47 AM, Ross Zwisler wrote: > > Currently in sst_dsp_new() if we get an error return from sst_dma_new() > > we just print an error message and then still complete the function > > successfully. This means that we are trying to run without sst->dma > > properly set up, which will result in NULL pointer dereference when > > sst->dma is later used. This was happening for me in > > sst_dsp_dma_get_channel(): > > > > struct sst_dma *dma = dsp->dma; > > ... > > dma->ch = dma_request_channel(mask, dma_chan_filter, dsp); > > > > This resulted in: > > > > BUG: unable to handle kernel NULL pointer dereference at 0000000000000018 > > IP: sst_dsp_dma_get_channel+0x4f/0x125 [snd_soc_sst_firmware] > > > > Fix this by adding proper error handling for the case where we fail to > > set up DMA. > > > > Signed-off-by: Ross Zwisler > > Cc: stable@vger.kernel.org > > --- > > sound/soc/intel/common/sst-firmware.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/sound/soc/intel/common/sst-firmware.c b/sound/soc/intel/common/sst-firmware.c > > index 1e067504b6043..9be3a793a55e3 100644 > > --- a/sound/soc/intel/common/sst-firmware.c > > +++ b/sound/soc/intel/common/sst-firmware.c > > @@ -1251,11 +1251,15 @@ struct sst_dsp *sst_dsp_new(struct device *dev, > > goto irq_err; > > err = sst_dma_new(sst); > > - if (err) > > + if (err) { > > dev_warn(dev, "sst_dma_new failed %d\n", err); > > + goto dma_err; > > + } > > Thanks for the patch. > The fix looks correct, but does it make sense to keep a dev_warn() here? > Should it be changed to dev_err() instead since as you mentioned it's fatal > to keep going. > Also you may want to mention in the commit message that this should only > impact Broadwell and maybe the legacy Baytrail driver. IIRC we don't use the > DMAs in other cases. Sure, I'll address both of these in a v2. Thank you for the quick review.