Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp423775pxk; Fri, 11 Sep 2020 10:28:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqeHeTchib5OQA3hnICL630B7PznLFNRkR8X0VInaDDLHeB2jkxEo8sLCi02xuoMweJ6lY X-Received: by 2002:a17:906:1b15:: with SMTP id o21mr2941934ejg.377.1599845333539; Fri, 11 Sep 2020 10:28:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599845333; cv=none; d=google.com; s=arc-20160816; b=FHE/Z8RjswGGSRmSJO+VKgdwo1cUboZ88fy8IzY99wpBLfab0fHJ0cqOSPdaT0D344 XqmcECgp16LggX7bLH8v1xvSKZusawr2m4bkMf21hxpR+VuwAZ5t7oLoQAS3uhQtjtTP Ag4To6RpDhJXekGTO0uS37QXHqEgPkmn0rvwci1XxS7oOpXSHxjjXQ7uqLWKYw4OXp+k qLNdvfwzNG4KNlEDT8J1TXOtpX5S7h89l86Z7K3GU5c1zGSzNFpm1/B0rQohfTJeSoFc eQepnrlgqbyu2r4vAPA8S2SW/hsHKIYnq4hK0j3glBJMSR+kodEv2Z3W1xCvTfXg996R LRNQ== 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=HHpKcuNs7ZhfR65tCffbHaC/T0rFxSoWoI7uo5EyaXQ=; b=J41yqhbqxOxU7PsDO4BZHVpMgi4H1gP6vnc0oEG6sviz9V73Kxh/NKxlUdkrRg13Ye RDeK1j5DhUmYKz/DlJ77a1t36z9yaBr4v72KOBgfyytffzcQGEGf09KRBsKPcr/7TTQo xSs5UBCgp3Yf4A97W0i6/ApLy1PK8/i9Db7cbsuwE3t2A6wRCGqxUMsf7lU0fCIXlumg 1NFmxRPfreyAthnfhRseaekrN3S2XkHJhwbs4rB9rDMl4m+JcfxGLvoxkgg6t3i4/JG0 C6ElkH4lPfoydSdZaqz7Yn2bAjVuAcUk/wU7UGjJh7ByNqNLIjTzC4ovI1D+2xePxBsZ +i0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sZCxz+ii; 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 p7si1793976edy.43.2020.09.11.10.28.30; Fri, 11 Sep 2020 10:28:53 -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=sZCxz+ii; 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 S1726415AbgIKR0Y (ORCPT + 99 others); Fri, 11 Sep 2020 13:26:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:49260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726121AbgIKNAK (ORCPT ); Fri, 11 Sep 2020 09:00:10 -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 BEC1622251; Fri, 11 Sep 2020 12:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599828961; bh=SBK2HNKNJ+JL6x4mU7ei9C5WVJMlfumQ0oEPx2yqabY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sZCxz+iiumqdGhhxW+hYovaEUUVGToqa7ruaeGlysD38SlpGQnRM0Qyk464BCaRJb WQ/YPPzBaDZvkuHYZDpGhwZuH2nxD9rRZJBTBgKE/JDfJkfFZSewaffar6R7MovZFf ku1O3ioD0yFGbLOz2BboV2mq+ndFQTspanupC5vQ= 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.9 12/71] dmaengine: at_hdmac: check return value of of_find_device_by_node() in at_dma_xlate() Date: Fri, 11 Sep 2020 14:45:56 +0200 Message-Id: <20200911122505.554791505@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200911122504.928931589@linuxfoundation.org> References: <20200911122504.928931589@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 a32cd71f94bbe..cb72b8c915c73 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -1810,6 +1810,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