Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp429844pxk; Fri, 11 Sep 2020 10:38:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkb4IQaneCSIGrKRZqRZYAUfuUXRlXmO6wLVhN3ACxK4RI3poFvgu6fCAR6wFZiCIH8PfN X-Received: by 2002:a17:906:194b:: with SMTP id b11mr3028326eje.159.1599845903915; Fri, 11 Sep 2020 10:38:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599845903; cv=none; d=google.com; s=arc-20160816; b=YrCMRgIqjRT5VZrrdw/O3Hb63Djvu3U++dMR61CC1/5XMLoOjUhv+S6MhDiFncuWeD /J1P/B7kfZsSVEPQ2I+XgAs1ucbFjmXh6CKbU4IMBHspRn7GT/MLnz5f68x4RDqXQEBD LitogcBxa4+X0t5ADwdyAg+oHHO4izyolxntfVM3jtIB7Mwv81i6LeK5/Fut1Px+ROym NZa1G82J6LH2xt38cyZWKVyPCIA1Ly9Vwf1INmoKy15FSPhs0WWmrBaq7FO2RHUVwgS/ uHiAy9AXkfUS4x4m+zFX3AmB5mzEsgXgzDqzzn7jJ5uvE2oNBrEOmLTZ9dUTw70cchM4 Mc4g== 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=wl494l2kgez2ChoCOcLoLwp9J6ssR6cweCbcfoLYV8E=; b=HQIJmgGgtsw5vz7ND9C02YGuyAZXgEOzPCtQOF5ZSA8dkNOoaxFW+i2FGehI7xbUae /EEF9myM1CRieIcSFTwnCJctGLLdTIsjsrDM1oKtUXaprNlJuJhqRCGlmMLRmg3miPQN FzsQGmTSWAmugdwHraiJVNJiTkLyczySPZfmt42ICskPpOXFkFLGTso0U3klKYElRujL iAbrkpXwTnySvPcMb4pe3qzR5n1LXfELLv4di4ZTxUBEPMeogLmuGl9qRx5LERL2myfH zH/TmuoVi1Kucf/yMhG6I4YdWHwFFoPBf+g33+TvQg9KW5TUv97+YVjtoQQiFFtT+eFT Ln8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pifVRIPZ; 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 bt16si1655566ejb.314.2020.09.11.10.38.00; Fri, 11 Sep 2020 10:38:23 -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=pifVRIPZ; 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 S1726522AbgIKRhA (ORCPT + 99 others); Fri, 11 Sep 2020 13:37:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:48420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726032AbgIKMxc (ORCPT ); Fri, 11 Sep 2020 08:53:32 -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 99E9C2075E; Fri, 11 Sep 2020 12:53:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599828801; bh=1orYyBviryLot7PLY1H5LUc+zE1ffz4NBxzSk/+s7l8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pifVRIPZqNggEu0ubofW4pPQYwbXuaJ4TGKiBypAX8hzajybkeC2g8MGc4d9KOwk3 A9HEnZtmIh/HBVUzzToc2HGwaOE8QUrt/6BnTTCkuoGNgaXwbhRbalDpbqhWvX2txv Q4Rls4vLL7ERLh+uIy62IO2xrQJnF4IYLIVMZ2uA= 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.4 12/62] dmaengine: at_hdmac: check return value of of_find_device_by_node() in at_dma_xlate() Date: Fri, 11 Sep 2020 14:45:55 +0200 Message-Id: <20200911122503.003948091@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200911122502.395450276@linuxfoundation.org> References: <20200911122502.395450276@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 941ace0521306..5276074d0e364 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -1817,6 +1817,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