From patchwork Thu Sep 5 08:25:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 173125 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp403218ilq; Thu, 5 Sep 2019 01:26:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzc2MT+MkSQ26F40w7qU6Em1JFifuS/0XffpBIln64ZI/ilS813rLd3eKSBVWd62N3Ggxzw X-Received: by 2002:a65:64c6:: with SMTP id t6mr2069132pgv.323.1567671963390; Thu, 05 Sep 2019 01:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567671963; cv=none; d=google.com; s=arc-20160816; b=CYXEH1s2CcrnPm4CGz1pwVjJ4k8TLzDy7IG3IrQ4NOeLNXhn+aWBBTthhZRvGEC6c1 5QkvKLXBVC6TtkUoPg9enAr+EcdmKR+AZCNM/vVpbxiT5BtvO+7dyZcvhrJwxUF+MF/G fDIcmBjORpjoQGhRvV/vyLkZ2vNjwp41XJB+K+ENIFZ02BRotAh7RJdVMgW+49mwdMaf gyTRsgVNqcX+CG6SIfmsOyD6SSAE4NKE7li7Zlmven7Fyi2nXnBEnXpSNtuOMpeg2YGE rBLLt6jKn+y7/DZFLEq1eMUowjjHG++i0N4MQhGeifzXsYuEhmwhUuPJntAtqImYwH0a R+Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=0SGxKzloC1sYoifm3y16biO6W+84MTKzulfWNDZIOv0=; b=oWFiP2VNM6UWl+XGaqxTT9UGtjJwSemdW8Q0BBtYRlVr7sVsK/cyRIOaoH7IzIDcUz 5ccsgE3dXV7nfufchQDzRUgGNmrTFxCUqivNepNuthryv9aAqfrtc+satPxywVg17DFI 5JBp759WXovA5GyQEMuVP+db21siQi2Ok/TuZf/84FXvm2bkDlsyLN6jPpnPMVA33ofv rGMSpu6L/iXMi0kV8c9vNfxGvNwsivmuR1OU/f4CvTBy5h5JR4n8pJY6dI2U+e5PNn5/ cB3/KMJT5FBls0TM5sCVZrJO29GZBT1xTXPdHZNh4QLLIDRx0dFSEhB3XEYFFLzYcH+W WedQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JtEU3isN; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t21si1121857pga.294.2019.09.05.01.26.03; Thu, 05 Sep 2019 01:26:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=@linaro.org header.s=google header.b=JtEU3isN; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732493AbfIEI0C (ORCPT + 15 others); Thu, 5 Sep 2019 04:26:02 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34447 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732454AbfIEI0C (ORCPT ); Thu, 5 Sep 2019 04:26:02 -0400 Received: by mail-wr1-f65.google.com with SMTP id s18so1649456wrn.1 for ; Thu, 05 Sep 2019 01:26:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=0SGxKzloC1sYoifm3y16biO6W+84MTKzulfWNDZIOv0=; b=JtEU3isNL7tcsgWJfDETBw410yLKfnQUAezfYGPe+bkIod/xnIaEu2T3jcqiNm93kk c099+BNZcXW8lNfpNu4j2o3a0h7z5Zk+CnH+T3UfNNgcKwR7FG6TCKzWg7f7h5YmmqlM xVeCWcGOSo0Zc3rByshg/dksK8+xE6/CGJLPPz+dxi4uAOTWzzrJEXDKf2AL1a43X6zF A7Z9JWkCE23NMb3Me5AH8Gc2LD57eZsSX9B5Fd7Q0Q/EPeH2xqr0kLz6ZnV29gr7Mkbi eAsX4kMg4t43ld9DtOe0UsezPWxCDc6HSIdqOvBIQsO+DCP/5WMbNPmtqcvIBwphQcV1 ujGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0SGxKzloC1sYoifm3y16biO6W+84MTKzulfWNDZIOv0=; b=ueIpEu5tPwGkCjIYFi6bMfQi7t8OJ2lqbdR5gceGK4aa+5373Yr57Z05ZScPjwWGW2 kkvD67lGFkMWKqyABNGqlwuGDnZDEDH/+BzZct7nntuqoIixiKHcHEo42xv10FkM9NBj 4IFUDJC/0RRAq3Ym/2m8IxVUJ2rOWYbCTElwHTFPYxoTcdUpjcKv1rAevhSmFqJwgWnI x/7XyJdTgdHzikzIfMEKW0+X4d2Shj+x0hWupLHcymkYLXOOh421zux0bT7cMNHsoeSw HfDqBCBGatssGsu+B3gicTgLwcx8AHumxE6K/RjqwW9RMFNJmGvFySZwv9626o6iqQ8J bc9A== X-Gm-Message-State: APjAAAU7F1VCOt40vnRLe0dPhhWdneHrt9d02okD1Q6bZgTy74JkIYf9 FuwK1E35xy9+/XmiY7RfBhRpDg== X-Received: by 2002:a5d:6504:: with SMTP id x4mr1489361wru.227.1567671958823; Thu, 05 Sep 2019 01:25:58 -0700 (PDT) Received: from localhost.localdomain ([95.147.198.36]) by smtp.gmail.com with ESMTPSA id a13sm3592687wrf.73.2019.09.05.01.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2019 01:25:58 -0700 (PDT) From: Lee Jones To: agross@kernel.org, bjorn.andersson@linaro.org, swboyd@chromium.org Cc: linux-arm-msm@vger.kernel.org, Lee Jones Subject: [RESEND 1/1] soc: qcom: geni: Provide parameter error checking Date: Thu, 5 Sep 2019 09:25:55 +0100 Message-Id: <20190905082555.15020-1-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org When booting with ACPI, the Geni Serial Engine is not set as the I2C/SPI parent and thus, the wrapper (parent device) is unassigned. This causes the kernel to crash with a null dereference error. Fixes: 8bc529b25354 ("soc: qcom: geni: Add support for ACPI") Acked-by: Bjorn Andersson Reviewed-by: Stephen Boyd Signed-off-by: Lee Jones --- * Collecting Acks NB: If someone could send this to Linus for -rc7, it would make v5.3 work when booting with ACPI, meaning the newly released distros, due out in October will be bootable. I'd be happy to send it myself with a nod from someone prominant (QCom, Andy, Bjorn, etc). drivers/soc/qcom/qcom-geni-se.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.17.1 diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c index d5cf953b4337..7d622ea1274e 100644 --- a/drivers/soc/qcom/qcom-geni-se.c +++ b/drivers/soc/qcom/qcom-geni-se.c @@ -630,6 +630,9 @@ int geni_se_tx_dma_prep(struct geni_se *se, void *buf, size_t len, struct geni_wrapper *wrapper = se->wrapper; u32 val; + if (!wrapper) + return -EINVAL; + *iova = dma_map_single(wrapper->dev, buf, len, DMA_TO_DEVICE); if (dma_mapping_error(wrapper->dev, *iova)) return -EIO; @@ -663,6 +666,9 @@ int geni_se_rx_dma_prep(struct geni_se *se, void *buf, size_t len, struct geni_wrapper *wrapper = se->wrapper; u32 val; + if (!wrapper) + return -EINVAL; + *iova = dma_map_single(wrapper->dev, buf, len, DMA_FROM_DEVICE); if (dma_mapping_error(wrapper->dev, *iova)) return -EIO;