diff mbox series

[RESEND,1/1] soc: qcom: geni: Provide parameter error checking

Message ID 20190905082555.15020-1-lee.jones@linaro.org (mailing list archive)
State Mainlined, archived
Commit 8928e917aeafaf38d65cc5cbc1f11e952dbed062
Headers show
Series [RESEND,1/1] soc: qcom: geni: Provide parameter error checking | expand

Commit Message

Lee Jones Sept. 5, 2019, 8:25 a.m. UTC
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 <bjorn.andersson@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 * 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(+)

Comments

patchwork-bot+linux-soc@kernel.org Sept. 6, 2019, 9:22 a.m. UTC | #1
Hello:

The following patches were marked "accepted", because they were applied to
soc/soc.git (refs/heads/for-next):

Patch: [RESEND,1/1] soc: qcom: geni: Provide parameter error checking
  Submitter: Lee Jones <lee.jones@linaro.org>
  Patchwork: https://patchwork.kernel.org/project/linux-soc/list/?series=170791

Total patches: 1
patchwork-bot+linux-soc@kernel.org Sept. 6, 2019, 9:22 a.m. UTC | #2
Hello:

This patch was applied to soc/soc.git (refs/heads/for-next).

On Thu,  5 Sep 2019 09:25:55 +0100 you wrote:
> 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 <bjorn.andersson@linaro.org>
> Reviewed-by: Stephen Boyd <sboyd@kernel.org>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> 
> [...]


Here is a summary with links:
  - [RESEND,1/1] soc: qcom: geni: Provide parameter error checking
    https://git.kernel.org/soc/soc/c/8928e917aeafaf38d65cc5cbc1f11e952dbed062

You are awesome, thank you!
diff mbox series

Patch

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;