From nobody Fri Sep 19 04:02:59 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39D0CC43217 for ; Tue, 29 Nov 2022 01:52:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234906AbiK2Bwp (ORCPT ); Mon, 28 Nov 2022 20:52:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233573AbiK2Bwm (ORCPT ); Mon, 28 Nov 2022 20:52:42 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02081335 for ; Mon, 28 Nov 2022 17:52:33 -0800 (PST) Received: from kwepemi500013.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NLlgp04XCzHwFv; Tue, 29 Nov 2022 09:51:49 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemi500013.china.huawei.com (7.221.188.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 29 Nov 2022 09:52:30 +0800 From: Zheng Yongjun To: , , , , Subject: [PATCH] soc: fsl: qe: Fix refcount leak in par_io_of_config Date: Tue, 29 Nov 2022 01:50:12 +0000 Message-ID: <20221129015012.61847-1-zhengyongjun3@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500013.china.huawei.com (7.221.188.120) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on error path. Add missing of_node_put() to avoid refcount leak. Fixes: 986585385131 ("[POWERPC] Add QUICC Engine (QE) infrastructure") Signed-off-by: Zheng Yongjun --- drivers/soc/fsl/qe/qe_io.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/soc/fsl/qe/qe_io.c b/drivers/soc/fsl/qe/qe_io.c index a5e2d0e5ab51..e26836315167 100644 --- a/drivers/soc/fsl/qe/qe_io.c +++ b/drivers/soc/fsl/qe/qe_io.c @@ -159,11 +159,13 @@ int par_io_of_config(struct device_node *np) pio_map =3D of_get_property(pio, "pio-map", &pio_map_len); if (pio_map =3D=3D NULL) { printk(KERN_ERR "pio-map is not set!\n"); + of_node_put(pio); return -1; } pio_map_len /=3D sizeof(unsigned int); if ((pio_map_len % 6) !=3D 0) { printk(KERN_ERR "pio-map format wrong!\n"); + of_node_put(pio); return -1; } -- 2.17.1