lkml.org 
[lkml]   [2015]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH 3.2 108/221] spi: dw-mid: avoid potential NULL dereference
3.2.69-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

commit c9dafb27c84412fe4b17c3b94cc4ffeef5df1833 upstream.

When DMA descriptor allocation fails we should not try to assign any fields in
the bad descriptor. The patch adds the necessary checks for that.

Fixes: 7063c0d942a1 (spi/dw_spi: add DMA support)
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
drivers/spi/spi-dw-mid.c | 6 ++++++
1 file changed, 6 insertions(+)

--- a/drivers/spi/spi-dw-mid.c
+++ b/drivers/spi/spi-dw-mid.c
@@ -155,6 +155,9 @@ static int mid_spi_dma_transfer(struct d
1,
DMA_TO_DEVICE,
DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_DEST_UNMAP);
+ if (!txdesc)
+ return NULL;
+
txdesc->callback = dw_spi_dma_done;
txdesc->callback_param = dws;

@@ -177,6 +180,9 @@ static int mid_spi_dma_transfer(struct d
1,
DMA_FROM_DEVICE,
DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_DEST_UNMAP);
+ if (!rxdesc)
+ return NULL;
+
rxdesc->callback = dw_spi_dma_done;
rxdesc->callback_param = dws;



\
 
 \ /
  Last update: 2015-05-05 04:01    [W:0.608 / U:1.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site