Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752164AbbEFKZK (ORCPT ); Wed, 6 May 2015 06:25:10 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:41140 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751131AbbEFKZF (ORCPT ); Wed, 6 May 2015 06:25:05 -0400 Date: Wed, 6 May 2015 11:25:02 +0100 From: Luis Henriques To: Ben Hutchings Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, akpm@linux-foundation.org, Mark Brown , Andy Shevchenko Subject: Re: [PATCH 3.2 108/221] spi: dw-mid: avoid potential NULL dereference Message-ID: <20150506102502.GA1691@ares.olymp> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2068 Lines: 62 On Tue, May 05, 2015 at 02:16:39AM +0100, Ben Hutchings wrote: > 3.2.69-rc1 review patch. If anyone has any objections, please let me know. > > ------------------ > > From: Andy Shevchenko > > 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 > Signed-off-by: Mark Brown > [bwh: Backported to 3.2: adjust context] > Signed-off-by: Ben Hutchings > --- > 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; > + This backport doesn't look right to me as the function returns an int, not a pointer. OTOH, it seems like this return value is not checked anywhere, which is why I dropped this patch in the 3.16 kernel. Cheers, -- Lu?s > 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; > > > -- > To unsubscribe from this list: send the line "unsubscribe stable" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/