Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759540AbcDJS6h (ORCPT ); Sun, 10 Apr 2016 14:58:37 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:53100 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759506AbcDJS6b (ORCPT ); Sun, 10 Apr 2016 14:58:31 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brent Taylor , Ulf Hansson Subject: [PATCH 4.5 203/238] mmc: atmel-mci: Check pdata for NULL before dereferencing it at DMA config Date: Sun, 10 Apr 2016 11:36:20 -0700 Message-Id: <20160410183507.358204470@linuxfoundation.org> X-Mailer: git-send-email 2.8.0 In-Reply-To: <20160410183456.398741366@linuxfoundation.org> References: <20160410183456.398741366@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1021 Lines: 33 4.5-stable review patch. If anyone has any objections, please let me know. ------------------ From: Brent Taylor commit 93c77d2999b09f2084b033ea6489915e0104ad9c upstream. Using an at91sam9g20ek development board with DTS configuration may trigger a kernel panic because of a NULL pointer dereference exception, while configuring DMA. Let's fix this by adding a check for pdata before dereferencing it. Signed-off-by: Brent Taylor Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/atmel-mci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c @@ -2443,7 +2443,7 @@ static int atmci_configure_dma(struct at struct mci_platform_data *pdata = host->pdev->dev.platform_data; dma_cap_mask_t mask; - if (!pdata->dma_filter) + if (!pdata || !pdata->dma_filter) return -ENODEV; dma_cap_zero(mask);