From patchwork Sun Aug 20 15:53:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 803755 X-Patchwork-Delegate: scottwood@freescale.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xb1bX6cr4z9sRg for ; Mon, 21 Aug 2017 01:54:32 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xb1bX5klGzDrK5 for ; Mon, 21 Aug 2017 01:54:32 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from smtp.smtpout.orange.fr (smtp11.smtpout.orange.fr [80.12.242.133]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xb1ZG52SgzDqb5 for ; Mon, 21 Aug 2017 01:53:25 +1000 (AEST) Received: from localhost.localdomain ([90.21.44.83]) by mwinf5d46 with ME id zTtF1v0011ngAYy03TtFfQ; Sun, 20 Aug 2017 17:53:19 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 20 Aug 2017 17:53:19 +0200 X-ME-IP: 90.21.44.83 From: Christophe JAILLET To: qiang.zhao@nxp.com, leoyang.li@nxp.com Subject: [PATCH 1/2] soc/fsl/qe: Fix a potential NULL pointer dereference in an error handling path Date: Sun, 20 Aug 2017 17:53:12 +0200 Message-Id: <20170820155312.831-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.11.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, Christophe JAILLET , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" If 'of_find_device_by_node()' fails at line 153, a NULL pointer dereference (pdev) will occur in the error handling path. Just remove the 'devm_iounmap()' call from the error handling path. The corresponding is managed, there is no need to release explicitly here. Fixes: 35ef1c20fdb2 ("fsl/qe: Add QE TDM lib") Signed-off-by: Christophe JAILLET --- This patch is only a guess that sounds logical to me. I propose to remove this 'devm_iounmap' mainly because of its name (if it is managed, why should be manually handle it here ?) --- drivers/soc/fsl/qe/qe_tdm.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/soc/fsl/qe/qe_tdm.c b/drivers/soc/fsl/qe/qe_tdm.c index f744c214f680..6b9647fee512 100644 --- a/drivers/soc/fsl/qe/qe_tdm.c +++ b/drivers/soc/fsl/qe/qe_tdm.c @@ -174,7 +174,6 @@ int ucc_of_parse_tdm(struct device_node *np, struct ucc_tdm *utdm, return ret; err_miss_siram_property: - devm_iounmap(&pdev->dev, utdm->si_regs); return ret; } EXPORT_SYMBOL(ucc_of_parse_tdm);