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: 9911181 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 175DB603F3 for ; Sun, 20 Aug 2017 15:54:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0899D286A9 for ; Sun, 20 Aug 2017 15:54:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F17F1286D4; Sun, 20 Aug 2017 15:54:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8AEA9286C4 for ; Sun, 20 Aug 2017 15:54:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=43ewqhTu0aDaMRaXK7RAfM7m3sJ3tmsBMtfxklryHqI=; b=nv6 yRomi9jsCmpw+Q8Vk6g8isrQZ3NoMd+E2a9PHpLwxtM06++6ML2/DS8B/O7YS6XeEPwl8OTH+E9Qm f1Scx4OUeb8SSj8OIjBdkblnrs6a4OeoUUKipigN+l3W7ygnCboXzZlTvSY2yV6exEPScAL+GmFeh yuFhzgkkkdttQwutO7NdyZ7tZ8MdgjCip48f5UmCgPGShxBJ/fuOcvdQMzreHYP4hLVeYs4zlDL4W A6yAr79ZBa5J9wS9AwHNHC1YctJaNZyl4Ahb8yBkfJzjOkYoLPAIaJoyuaMuZsxes/bU7lGOcEDVI pjXmdqE5MrRfIrlC3vOj/XZv0YViI1w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1djSYH-0000Qq-JP; Sun, 20 Aug 2017 15:54:13 +0000 Received: from smtp11.smtpout.orange.fr ([80.12.242.133] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1djSXs-000064-DH for linux-arm-kernel@lists.infradead.org; Sun, 20 Aug 2017 15:53:50 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170820_085348_790609_7028D918 X-CRM114-Status: UNSURE ( 8.48 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: 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 MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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);