lkml.org 
[lkml]   [2019]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] spi: fix NULL pointer dereferences by checking dmaengine_prep_slave_sg
Date
In case dmaengine_prep_slave_sg fails, the fix returns to avoid
NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/spi/spi-s3c64xx.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 7b7151ec14c8..3a5f161ce558 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -293,6 +293,8 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma,

desc = dmaengine_prep_slave_sg(dma->ch, sgt->sgl, sgt->nents,
dma->direction, DMA_PREP_INTERRUPT);
+ if (!desc)
+ return;

desc->callback = s3c64xx_spi_dmacb;
desc->callback_param = dma;
--
2.17.1
\
 
 \ /
  Last update: 2019-03-14 07:42    [W:0.042 / U:10.852 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site