From patchwork Tue Sep 8 15:26:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 264294 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 787CCC2D0A7 for ; Tue, 8 Sep 2020 18:04:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2CDEE20936 for ; Tue, 8 Sep 2020 18:04:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599588276; bh=94jbiT/iviL3xFKjxO4CaHmUaM3rOn+3FKbtH+tRnok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zKeRJsRsp/T4scx7HZdUakpV380TOXuIQ3Q7iGwEWhkJMthXScpIrxyFZI1B4b5wI MFi9qZtr5DX3ocYR4Ar76V/d1r5EItho1YeCK0DCdNu9RSS7vs+3tkFzJcQDpIYir3 Km+pR+ZFlppeRCV1iPPvraiYupGm81lw30LkqVCs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731586AbgIHR6o (ORCPT ); Tue, 8 Sep 2020 13:58:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:56658 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731559AbgIHQMr (ORCPT ); Tue, 8 Sep 2020 12:12:47 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5A56324884; Tue, 8 Sep 2020 15:52:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599580330; bh=94jbiT/iviL3xFKjxO4CaHmUaM3rOn+3FKbtH+tRnok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jKyo+qWswoKU1zUNRESYhgSwiTcHUV1UcIyjguj8KJrk+iUc70agjsP12hCsIU8Wd 1C8ifipvzNINsqQsPWQ6EBY9rMf2eqWP30wxOU2p0fNyCKfDkt4mlNc01rEddXOO3c QdS/4vFT4qjnMPlT+YZVkVOYh272muMb3F5nkkRs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Kuai , Vinod Koul , Sasha Levin Subject: [PATCH 4.14 15/65] dmaengine: at_hdmac: check return value of of_find_device_by_node() in at_dma_xlate() Date: Tue, 8 Sep 2020 17:26:00 +0200 Message-Id: <20200908152217.822263235@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152217.022816723@linuxfoundation.org> References: <20200908152217.022816723@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Yu Kuai [ Upstream commit 0cef8e2c5a07d482ec907249dbd6687e8697677f ] The reurn value of of_find_device_by_node() is not checked, thus null pointer dereference will be triggered if of_find_device_by_node() failed. Fixes: bbe89c8e3d59 ("at_hdmac: move to generic DMA binding") Signed-off-by: Yu Kuai Link: https://lore.kernel.org/r/20200817115728.1706719-2-yukuai3@huawei.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/at_hdmac.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 21ed0e20c5d91..cf3225a229890 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -1677,6 +1677,8 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec, return NULL; dmac_pdev = of_find_device_by_node(dma_spec->np); + if (!dmac_pdev) + return NULL; dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask);