Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4231135pxk; Tue, 8 Sep 2020 14:20:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcHMLexcvvKQKJ3Vp90CCq1hhus4AOY/e4ydOevAQPP+LgEtsfY0Uy8l/xYSrikHIC80dw X-Received: by 2002:a50:8524:: with SMTP id 33mr1032522edr.123.1599600001020; Tue, 08 Sep 2020 14:20:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599600001; cv=none; d=google.com; s=arc-20160816; b=wXrFB71ZGFTxWU5pet5viiYygiezK6I/2YjpzYIOpdEVcZuCLdg3etcBXsBV4uORCm N5f8AdMlOQsDABIOAlC7bJ5nAlHD5rum117Nx2L0emQ57hN17aRBDmDthGFxVng/uN1Y RRmyCDvrQ8oJHjxN0Iyds2kZxe9M2mC90OWMI/ZY0uqnaFTi3SeL1UCKcKBq2ZNokXWK OyYrAja7KGebsJpKyx1VTxRbiF3IVO6/NdLIyDiiRv9ChxPKh/AoZhg8aYbfxBsD9rOJ 4ZZY5UdvMybesMaH0630z1Bimnwtk6N7+ced4TVJ1rR/qxLswx0bGNa41u1qDSevWLNb eg6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WHjjCEAJe+LI8bkkUQkZeoQDcUFGcg1LqpfOvGpgRJ8=; b=AaUjiou5NM5rpZJJuql/aSVWGTIg+R/LHrCZArkH3mAXKpZvgU2usO6Bn1TQP/1V8t 5CVwBBT1pbogIN38O8xkiElf+lMkU+Xch5ODBMasxHuhsz6a17YngJQZ+gw5vcUsamN2 bIJkPtiTYIVVi50Aq58nVoyv4tGOkLQQGjHf7Huh8oTmUEZN1N3TXSaSzaPsrwcNWVXx iFLnBS9U7EEDsydl4hdjNhPj42xm8YppKhzwPJz7/3xO3uposCHVOqSq7DlQ38LikXcX aXvMfEJuoo0tN7pSBOvwGLupzWZgZeVBQgcJIZbJz5/7xWSwGDditQcERmvho+ivSzEX X1eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lKMz0qvj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c5si149144ejs.330.2020.09.08.14.19.38; Tue, 08 Sep 2020 14:20:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lKMz0qvj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732272AbgIHTde (ORCPT + 99 others); Tue, 8 Sep 2020 15:33:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:48730 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731005AbgIHP6F (ORCPT ); Tue, 8 Sep 2020 11:58:05 -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 D0D9B22460; Tue, 8 Sep 2020 15:36:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599579372; bh=NSBuye3y5qXgCTXV6CZRQCd0s3rA8j6SnAcyR7nKAY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lKMz0qvjbsaOKmCjxovccsX9kOQG/67l9Z/Aoh6grgYEZVrygHdzQZDEQiSNSP1ij MTWbl50rJUz9NaRlVOsshbTB4q/kbEQTZyzTlqbTtck0FtqZgWhZ1LF5PWu2nR8bkQ D7bskpo235w2uASLBhd7lm6Ke8o0Q+eVJxjiq6V8= 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 5.8 043/186] dmaengine: at_hdmac: check return value of of_find_device_by_node() in at_dma_xlate() Date: Tue, 8 Sep 2020 17:23:05 +0200 Message-Id: <20200908152243.754111179@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152241.646390211@linuxfoundation.org> References: <20200908152241.646390211@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 73a20780744bf..22c1c507055a3 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -1650,6 +1650,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); -- 2.25.1