From patchwork Tue Sep 3 13:50:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 172793 Delivered-To: patch@linaro.org Received: by 2002:ac9:5c4b:0:0:0:0:0 with SMTP id r11csp5600531ocp; Tue, 3 Sep 2019 06:51:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQSiX3X19UnHPN6MqDCGzJDuzJ97I4cOm/qJQvNUAgG83205WDQThPNqlWlsMOEn9i4291 X-Received: by 2002:a62:d445:: with SMTP id u5mr20204434pfl.92.1567518661673; Tue, 03 Sep 2019 06:51:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567518661; cv=none; d=google.com; s=arc-20160816; b=n+cgbZzmGQ8LRFC9F4yionRfIJFIfj68ttq0TRS1VfdTSTdZ8Iq2K99DLmw4aBF6yL Hk9uHPM6potdIKJSLZd5oeUIEKU888nWNVFGq48JIpM4VMP2rgZkq6s2cfAt+9R91ILe 49Cq9W/aECs6G8FOEp8JGUBf5z+QNv3sU8+d+ttnRWEhISy0q6sumEP8hoKoybKitWmH AbNgC/8keEv8QpQZmcKm0e4UUj3Zb6+IrGLlMhVIeVGyRqbC9hOpbPLAwgUABpDQsaFK NOeKsq5qfI3ET/eIZt/hI50ethnjq65qCooqAZb47UUuMtvVUNsRvDJUdJdLh2MVuKNB E2Qw== 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=aOyM32hMSWR1qRMtRvlicJ7f1Z5Z1CPh11gGjkkMTtY=; b=ZvCF3KDqvj1UUX+NtrqIZ2koo/WnF2vfRyNkPSLveD3ZpUQq0FS7HGOM1lB+KjQNfV 4I5FzfdB11kZBuVRUF8bndZ6YIw/6tQNZTdtRt0V8/HUNhe9buIC5v1ba1tvTsX1YXeB LKWzj5vME7RSsy4kOd8b2i/2KfWkOhix4AIBBl16SQp76yLpqjyCr1dxXYTP8QMl7qWz DZT2rHM6D9ETiLt9EGSRuSGrPyqwrbi67LGZDmb9TbC7hJkOX0JuUp+eo1qTgSXkeFD9 9FKvuRpZCvYLpMbpRcKgiHiK+oR8K0dOz4t0ONza2Dw16GydYlhL8KD4vM9lz4LI0S0O Djrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SEnDskUH; 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=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 g11si15206872plp.239.2019.09.03.06.50.59; Tue, 03 Sep 2019 06:51:01 -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=@linaro.org header.s=google header.b=SEnDskUH; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729417AbfICNu6 (ORCPT + 28 others); Tue, 3 Sep 2019 09:50:58 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:39281 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729169AbfICNu5 (ORCPT ); Tue, 3 Sep 2019 09:50:57 -0400 Received: by mail-wr1-f68.google.com with SMTP id t16so17606817wra.6 for ; Tue, 03 Sep 2019 06:50:56 -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=aOyM32hMSWR1qRMtRvlicJ7f1Z5Z1CPh11gGjkkMTtY=; b=SEnDskUHk7MKEpfjF3e0404Vx6RbV3Us34tpICArdFY5gu+Ad0LCkJkr+CWV8p0R7D 0P9jX11NcJR/cppXMJNg4DK7nZ4wLb6hHDDRE5vjvkM60LHU4/vAUwvFhKtPrHwDZ2ed MSUFYAAPsEguqTREsrN9QgP2MicHw3nwD4o0WSQ9aRwsqQbzSqEACxn4LH5D+Vp78CVk zGVrqCc8E494TwnqdASdi1A/hNkXjwD2RO4iTxLPHlIZqeX4ExGXV9jYgJPO74QRp3dQ cpqFJjn1ShGo0tkINNFZOWHirhB8CwhLCdXMAd2igfWtPSS/kpS4LJwQGOzp98a8ZqJS bO/Q== 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=aOyM32hMSWR1qRMtRvlicJ7f1Z5Z1CPh11gGjkkMTtY=; b=B/6lMMtlCA6mATSta4fRoBg9kikon3eEysSJLR/lRzYIOhVofqtCYV7vG1Wt/IoHyg 1m+hq/AeR5O/8gxe83WjF6uekrFe5rEIxIQ+/EbOjh7TSlcbQRk2+bL47Jvfb5I7qRBe E0l1ccDO4ahEusmgv+Xx4ZyNJKLa+jTTC9L63PD7CkotHlcYvAZLUdvESpKtWx2OWmt/ Jd1VUr8+ghtDXm9jQTJuGoMTvA5mhexU3dBzjY+p6FLHwiYmxvmWaIOOdTMFocdoMxlM CwXdWW7Q1iTukfmyZt3u8pszNhLE11ZRHn/8aexNgdmSIvlc+2dQRvU3MdFn/swxEZWh 9OnQ== X-Gm-Message-State: APjAAAWAQuRaXou6GBKFF808wjuk6qfqUZmqNqkHA3veW6KOYUQfo7Bk 69lWLaT3sH6SCw7TR/rcyBNAqA== X-Received: by 2002:adf:9e09:: with SMTP id u9mr43453065wre.169.1567518656051; Tue, 03 Sep 2019 06:50:56 -0700 (PDT) Received: from localhost.localdomain ([95.147.198.93]) by smtp.gmail.com with ESMTPSA id a17sm20710665wmm.47.2019.09.03.06.50.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 06:50:55 -0700 (PDT) From: Lee Jones To: agross@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, Lee Jones Subject: [PATCH 1/1] soc: qcom: geni: Provide parameter error checking Date: Tue, 3 Sep 2019 14:50:52 +0100 Message-Id: <20190903135052.13827-1-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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") Signed-off-by: Lee Jones --- Since we are already at -rc7 this patch should be processed ASAP - thank you. 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;