From nobody Thu Apr 30 08:25:08 2026 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 42063C433EF for ; Wed, 1 Jun 2022 08:11:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243130AbiFAILi (ORCPT ); Wed, 1 Jun 2022 04:11:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348233AbiFAILd (ORCPT ); Wed, 1 Jun 2022 04:11:33 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5AFD64D01 for ; Wed, 1 Jun 2022 01:11:30 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id q18so1059378pln.12 for ; Wed, 01 Jun 2022 01:11:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Px54YeB8y4JCFlFNgwFGWbi1FoMMkCqF3KundDZ3EiM=; b=M8QTLybUaNBk1aN+aW6WTC6oMiD4gHTGH1IngOQcZXfUt6/9wkK5VwiDq6/TgBjLAi VVsj1zx/ZRNW6HwMWapL1em5dRTDFO1BdGM4XJEzdGl465emrnSipiJlkXL99sIWN7qI 9CSmCdLCdbtaS5kOdWFVaX+dXjXQFG3VInPenaz9FVnGInt6sogEJ3OUq9UKXKTUi8Tg y3iCO9U3saux5xWEPNNxjZUTr3CRhtjY9lza1ynF5mNDhIArJKqHuSDLhxPIyjv8C8Q+ tVZdl1wi9BZZSp8Cv+flw3+ENseAF/nVTGBzMznepyaQD+/Awxu8IeXC1MK+Dka/qAib EvnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Px54YeB8y4JCFlFNgwFGWbi1FoMMkCqF3KundDZ3EiM=; b=chhySVU9aN9lh2pg5/XUh1fOObXjftr6vrOvmOcwUI1o9/LBiDtiWSrAslFZFN1WAJ 1pBWJ17lcsD7V3B+O+ST+mgpYsZpNroUkTOJ9WuRSfa21qpaPHwWdob0MoFE2KnuQS4M A7NkXvukIMY+P7VBedAZH+9lwVompiab0Jz4eJwAsR0JlRylFn2axzKrnMKFn4AIGUm0 GPU3blc1/sec8hIVjXHRFB9JiLmhVoPm33c3Y9KOiJuoKGK1QR/rt2B76TGz2fN/Wi2Q mdjV33mF/u5gND3VLglcyBiM++qcXdQQTV0GIyu1h8jZOeNuAE52kl1tRETUaUp9C3Ym eYcw== X-Gm-Message-State: AOAM530+g7m54Iphmkbx5uf6ZQg1hHQwxCpqjlJ/TS7/iGfh0zs9Xt/O /Lc6rKSDwzhlb56omOE9rVs= X-Google-Smtp-Source: ABdhPJzG3vlU3jO48Ym1PPOrpdAe+gZj7tJD29o/oekC+E8060IQUrfmuoDVjXjxS3qI7mfLWO385Q== X-Received: by 2002:a17:902:690b:b0:159:65c:9044 with SMTP id j11-20020a170902690b00b00159065c9044mr66244014plk.47.1654071090228; Wed, 01 Jun 2022 01:11:30 -0700 (PDT) Received: from localhost.localdomain ([202.120.234.246]) by smtp.googlemail.com with ESMTPSA id y1-20020a17090ad0c100b001e2f3831102sm792288pjw.17.2022.06.01.01.11.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 01:11:29 -0700 (PDT) From: Miaoqian Lin To: Hector Martin , Sven Peter , Alyssa Rosenzweig , Thomas Gleixner , Marc Zyngier , Linus Walleij , Birger Koblitz , John Crispin , Bert Vermeulen , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Miaoqian Lin Subject: [PATCH 1/6] irqchip/gic/realview: Fix refcount leak in realview_gic_of_init Date: Wed, 1 Jun 2022 12:09:25 +0400 Message-Id: <20220601080930.31005-2-linmq006@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220601080930.31005-1-linmq006@gmail.com> References: <20220601080930.31005-1-linmq006@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" of_find_matching_node_and_match() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 82b0a434b436 ("irqchip/gic/realview: Support more RealView DCC varia= nts") Signed-off-by: Miaoqian Lin --- drivers/irqchip/irq-gic-realview.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/irqchip/irq-gic-realview.c b/drivers/irqchip/irq-gic-r= ealview.c index b4c1924f0255..38fab02ffe9d 100644 --- a/drivers/irqchip/irq-gic-realview.c +++ b/drivers/irqchip/irq-gic-realview.c @@ -57,6 +57,7 @@ realview_gic_of_init(struct device_node *node, struct dev= ice_node *parent) =20 /* The PB11MPCore GIC needs to be configured in the syscon */ map =3D syscon_node_to_regmap(np); + of_node_put(np); if (!IS_ERR(map)) { /* new irq mode with no DCC */ regmap_write(map, REALVIEW_SYS_LOCK_OFFSET, --=20 2.25.1 From nobody Thu Apr 30 08:25:08 2026 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 377CAC433F5 for ; Wed, 1 Jun 2022 08:11:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348759AbiFAILu (ORCPT ); Wed, 1 Jun 2022 04:11:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346307AbiFAILi (ORCPT ); Wed, 1 Jun 2022 04:11:38 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFE7F64D11 for ; Wed, 1 Jun 2022 01:11:37 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id s14so1075267plk.8 for ; Wed, 01 Jun 2022 01:11:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3He5zqQafCaqxIZZoOREzUNxsIzRMeOPPdePDkzSSxg=; b=qq9VhWsouBy8dPsUw0DdBt28a/qRbqk696UR/zScNQXa6Pi7KY2McPssAJ1mKoUkv7 uVrRQm6pZstAqrdUSPKX87knMJV4KXUA3Aeb/Tt+7hczVx/aSq5wQazrO/5unjQ1r3df pb/pROCHQc7RQwCBCEa/bCDOqDzviTCL1mRVgUbNg7bJxIPlGlr3D6l0FI4xvrUjdZRN hv4WsyIDc/y+LByUw3u1AgTorxoUq8AVsG60WdihRWp5u2/ceoThtMTxZJihoZ8MAcY/ OnIaoliAV5+me8384xFFMQRbW57UORsgKmj1ZDNILAnvckpLK7YGwh1osExA2jMN2+X6 7z+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3He5zqQafCaqxIZZoOREzUNxsIzRMeOPPdePDkzSSxg=; b=Lg/5XuC0KxCK7FmWAtD6dWUdszpeaEr5ZNBJDKOv3OjiMMX/3CQCYn5teofUPZoch+ Qaxcaq23Or4RGElbwkJVuJF74A0B5zmmAhV5YZ14Wr6LRNCRvhVJdD+GDFndZtiebXMX fI2DCxns0QxfayB1zeV3SG1IMpjfYnlE9H3GacpNGqzKbYh5jX2Bf4Xr6yeVkZU/GSrd eghF4yWljJn15stnXeNbAXHCwTfSwn7lr01jr07fuQIZAQDYqXsdWOmCEqX8jQKirzjU K9mx065CZA+EuMUETGlPIgHmcaYP32ZZLrT6OsH1W45k6yJ37k/rf50OvalPfvq4Ok86 nDBg== X-Gm-Message-State: AOAM532SzZ3kg14HwOECY3DKuDeM15+d7d+8yCVaaT/1ZSX9c1nEDtYz a+WRqy9goNdZb9AleSZN00E= X-Google-Smtp-Source: ABdhPJzBCG24CTqcAbxbuUX+p7x/yKqMY2QNv/dS6wzJy4NlNTOe030W2heDInH+ViGtU8VE+LwDmg== X-Received: by 2002:a17:902:e484:b0:164:1c:57a with SMTP id i4-20020a170902e48400b00164001c057amr8152447ple.12.1654071097415; Wed, 01 Jun 2022 01:11:37 -0700 (PDT) Received: from localhost.localdomain ([202.120.234.246]) by smtp.googlemail.com with ESMTPSA id y1-20020a17090ad0c100b001e2f3831102sm792288pjw.17.2022.06.01.01.11.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 01:11:36 -0700 (PDT) From: Miaoqian Lin To: Hector Martin , Sven Peter , Alyssa Rosenzweig , Thomas Gleixner , Marc Zyngier , Linus Walleij , Bert Vermeulen , John Crispin , Birger Koblitz , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Miaoqian Lin Subject: [PATCH 2/6] irqchip/apple-aic: Fix refcount leak in build_fiq_affinity Date: Wed, 1 Jun 2022 12:09:26 +0400 Message-Id: <20220601080930.31005-3-linmq006@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220601080930.31005-1-linmq006@gmail.com> References: <20220601080930.31005-1-linmq006@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" of_find_node_by_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: a5e8801202b3 ("irqchip/apple-aic: Parse FIQ affinities from device-t= ree") Signed-off-by: Miaoqian Lin --- drivers/irqchip/irq-apple-aic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/irqchip/irq-apple-aic.c b/drivers/irqchip/irq-apple-ai= c.c index 12dd48727a15..478d0af16d9f 100644 --- a/drivers/irqchip/irq-apple-aic.c +++ b/drivers/irqchip/irq-apple-aic.c @@ -1035,6 +1035,7 @@ static void build_fiq_affinity(struct aic_irq_chip *i= c, struct device_node *aff) continue; =20 cpu =3D of_cpu_node_to_id(cpu_node); + of_node_put(cpu_node); if (WARN_ON(cpu < 0)) continue; =20 --=20 2.25.1 From nobody Thu Apr 30 08:25:08 2026 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 A8146C433F5 for ; Wed, 1 Jun 2022 08:12:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350585AbiFAIMB (ORCPT ); Wed, 1 Jun 2022 04:12:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348673AbiFAILy (ORCPT ); Wed, 1 Jun 2022 04:11:54 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C74FB7D7 for ; Wed, 1 Jun 2022 01:11:50 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id gc3-20020a17090b310300b001e33092c737so1341798pjb.3 for ; Wed, 01 Jun 2022 01:11:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GWjGR+uUnc6AYWehSdkH/qKXs6QNn54ho2G5cZ8+zoc=; b=lO2Wb90PRtDZzwh2kw70sxt7A/gYeEkNtkUsS3yqAgTMWQOTDGZva4fzz7aMr+4i5C DJAuNZ4iAMF68sPTRHzMJwT0Ko9mpjCrn5dt1zjSqBBanJ9PRMJxrCYZNz4YWoScI+1f tE3E9sl6Ug1NFOXH6ezkTyoj2yQg7spcEAyiADgR5vbMerxjw85BIzJx6mpN2QjVo2t7 bdc20Jtg3vL2gHqJj4G3MOIICtESleFZOhnw3LRN/i+ngeEg78csnWrvfMl4QGJjwdbm SyXqchhjD+rYzhWdJtf7b3EAyHxKrGzJOCN9iK5lTZYEI4lrsn0WflvXFUnPLmiCCfYZ t+jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GWjGR+uUnc6AYWehSdkH/qKXs6QNn54ho2G5cZ8+zoc=; b=BJv80sbtrPs9zPR5MC7F5vV7war3qCgnK+2JjLFxYS9Rq5+WYoh7aR7etMiA5yncot B2TPlKG1/uffgIRZOqKyZrpHyW6oRml2A/ote8RvdV9ooLFGfjcYTMQG0CFuKi5jHk8W rJySaBpypSJmaYBxgs/87ivVMFq+Ms3oUS7eWBVcpyaUOx/W1DAVyfjg3p620n9vH9Ph DjDHUKqlp8zRTC2Il0rBqUikm/Zd+x/x6QKXAHT4mY663pNbUQmejl8U4Oxf/kF7BKS4 NcodctdQuZZjuwkvsD2bTeFm/fgVZEc/9nVn/enIC2SiCSiLKpbu62nAvePy4g41Z3yq ozcQ== X-Gm-Message-State: AOAM530tGxt9Vbj8cWsOI6f+NkBW/W+y6RGpTG3is/qhKWu0Tzbjur8R wlFkIhpjXgI9/R2AGecfP0Y= X-Google-Smtp-Source: ABdhPJyELGcS1L/91yKuLn5SIOvjSQzhnoeJComUUBK/MJj1z2x7Sd+TlkrWgVt8POtKp+07fMGkLQ== X-Received: by 2002:a17:90b:1e4f:b0:1e0:b91:39ef with SMTP id pi15-20020a17090b1e4f00b001e00b9139efmr32876048pjb.51.1654071109571; Wed, 01 Jun 2022 01:11:49 -0700 (PDT) Received: from localhost.localdomain ([202.120.234.246]) by smtp.googlemail.com with ESMTPSA id y1-20020a17090ad0c100b001e2f3831102sm792288pjw.17.2022.06.01.01.11.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 01:11:49 -0700 (PDT) From: Miaoqian Lin To: Hector Martin , Sven Peter , Alyssa Rosenzweig , Thomas Gleixner , Marc Zyngier , Linus Walleij , Birger Koblitz , John Crispin , Bert Vermeulen , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Miaoqian Lin Subject: [PATCH 3/6] irqchip/apple-aic: Fix refcount leak in aic_of_ic_init Date: Wed, 1 Jun 2022 12:09:27 +0400 Message-Id: <20220601080930.31005-4-linmq006@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220601080930.31005-1-linmq006@gmail.com> References: <20220601080930.31005-1-linmq006@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: a5e8801202b3 ("irqchip/apple-aic: Parse FIQ affinities from device-t= ree") Signed-off-by: Miaoqian Lin --- drivers/irqchip/irq-apple-aic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/irqchip/irq-apple-aic.c b/drivers/irqchip/irq-apple-ai= c.c index 478d0af16d9f..5ac83185ff47 100644 --- a/drivers/irqchip/irq-apple-aic.c +++ b/drivers/irqchip/irq-apple-aic.c @@ -1144,6 +1144,7 @@ static int __init aic_of_ic_init(struct device_node *= node, struct device_node *p for_each_child_of_node(affs, chld) build_fiq_affinity(irqc, chld); } + of_node_put(affs); =20 set_handle_irq(aic_handle_irq); set_handle_fiq(aic_handle_fiq); --=20 2.25.1 From nobody Thu Apr 30 08:25:08 2026 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 D475DC433EF for ; Wed, 1 Jun 2022 08:12:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350599AbiFAIMP (ORCPT ); Wed, 1 Jun 2022 04:12:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350568AbiFAIME (ORCPT ); Wed, 1 Jun 2022 04:12:04 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A0FA255A7 for ; Wed, 1 Jun 2022 01:11:59 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id s68so1198204pgs.10 for ; Wed, 01 Jun 2022 01:11:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CjxfEwNZAv/Ns2YjhAVktI1vfhpKFNGdsrqBv+NvOkk=; b=aKhB0zYrAcHE9EQYEKT2g7DsA3648OnKR/M8ytLi01NrDKBfQOWtxZ0GlOwRXPWShx 8X3OUs/gp80cLKaoNhpPXvuvrdxOQw7cpf+jK0webG1TA85XOEfve62vpkGjXVOkid2+ 6UL51qe0apR+nNwdNVXcSeY83YA5GKWB8H6meLszdRK8DIkJHe13oLACV4sQvvQqcSQB RcDaxRIkVlA8g1ym8drygJvmSLNOwhtQuLCtmb4jhLNFwrMgHRQuF2u0UtTcmGShGOpI 7SreIHf38Ouddqe27CWE6Te3i0BxNVWqHQE4qw3F69h6z4TIn36NR2ZEMhYyy/U6OvyS BZxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CjxfEwNZAv/Ns2YjhAVktI1vfhpKFNGdsrqBv+NvOkk=; b=xVWtMBekaySKys63Go2a2iU6qFK5tPKkcbJMzD0MWHL+VXO3H2cTpwM6fXvjTuTToM YjNlb+/Vi5C8QuaUI3MhF9c1XNg4dVsvamaejRy4QSC4aausjK5Kc5lnZSsh7d/6E0Jw Z1o+khgtt0lEloNfCg1wMzIN3YZMe1T937JZKTf6/0lJgeItnhfWe9y6/SP/sk3kdilA bt71AxyGpaQZ9v7BeJPcq8G+SuNMdSMPrucY/Nl81DxVdKVBWK7jaBFbnJqlMt4/tff8 KOgJRa1fro3xn0x7/Cv+ES3Lgnd0NLwMlv/UJRSxuQfdbDLxd6Ee+zZN9jyuR4tH5LPw N64g== X-Gm-Message-State: AOAM533vG5GpfBwXaLWKT3TVzN6thsc7JArWn2GrESdjDAqkSnQqLfIQ 51uMKjkHycYYLpk1heMs7Z4= X-Google-Smtp-Source: ABdhPJxjBIdiCetN9iBXLJVU/D5c4YBixW5Uqour1lmH8glwsFGvDrj0ZkgjEyCEoOM6tS+5L/X6GQ== X-Received: by 2002:a63:184d:0:b0:3fb:74ce:effa with SMTP id 13-20020a63184d000000b003fb74ceeffamr23908491pgy.621.1654071119384; Wed, 01 Jun 2022 01:11:59 -0700 (PDT) Received: from localhost.localdomain ([202.120.234.246]) by smtp.googlemail.com with ESMTPSA id y1-20020a17090ad0c100b001e2f3831102sm792288pjw.17.2022.06.01.01.11.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 01:11:58 -0700 (PDT) From: Miaoqian Lin To: Hector Martin , Sven Peter , Alyssa Rosenzweig , Thomas Gleixner , Marc Zyngier , Linus Walleij , Birger Koblitz , John Crispin , Bert Vermeulen , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Miaoqian Lin Subject: [PATCH 4/6] irqchip/gic-v3: Fix error handling in gic_populate_ppi_partitions Date: Wed, 1 Jun 2022 12:09:28 +0400 Message-Id: <20220601080930.31005-5-linmq006@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220601080930.31005-1-linmq006@gmail.com> References: <20220601080930.31005-1-linmq006@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. When kcalloc fails, it missing of_node_put() and results in refcount leak. Fix this by goto out_put_node label. Fixes: 52085d3f2028 ("irqchip/gic-v3: Dynamically allocate PPI partition de= scriptors") Signed-off-by: Miaoqian Lin --- drivers/irqchip/irq-gic-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 2be8dea6b6b0..1d5b4755a27e 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -1932,7 +1932,7 @@ static void __init gic_populate_ppi_partitions(struct= device_node *gic_node) =20 gic_data.ppi_descs =3D kcalloc(gic_data.ppi_nr, sizeof(*gic_data.ppi_desc= s), GFP_KERNEL); if (!gic_data.ppi_descs) - return; + goto out_put_node; =20 nr_parts =3D of_get_child_count(parts_node); =20 --=20 2.25.1 From nobody Thu Apr 30 08:25:08 2026 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 15548C433F5 for ; Wed, 1 Jun 2022 08:12:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350562AbiFAIMX (ORCPT ); Wed, 1 Jun 2022 04:12:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350622AbiFAIMI (ORCPT ); Wed, 1 Jun 2022 04:12:08 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E94D8C3F for ; Wed, 1 Jun 2022 01:12:06 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id b135so1256898pfb.12 for ; Wed, 01 Jun 2022 01:12:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yDHLNk2lC1y820Hnctg510Z3pMFH42mdXU5O+qRYKas=; b=arrmauLcCxQndylaqkIA9fZ0VPxT810s39+vQWP3F3WnNMGOPYnIZ3hBSdBdD3B4Ej s4prptJWPl5/vqxaSc/fUl7y70PfQACoZzJj61xE4n30EZTA4BV4Bi6r8rZ/YZOu10m5 IEZQNt7MGu79BotcQeQ/3OQzBG4QJ8dSxtfWeYoOJErGMKP2lkkn/N/yB8RJtvRUYDZ5 G181GMNlHoon+ht/Fm5HLrPRYysHkMFSa+cVNFwoaiNsnh4ZXRZhEBAyIpvUf4L4w7YP A2EWDdpUHRMH0407FM/jMRqzvQ6HA4EzsmKSWiTwENCwBvriwJau1SMYxSfaign62Kae LL0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yDHLNk2lC1y820Hnctg510Z3pMFH42mdXU5O+qRYKas=; b=vpiqhlj27iysdm+OhWMEiRbDiPrcRgVB/bbbUnS98k78iLT3KMMNyfLK7A/V0p3BP4 CjEX1i1Cng/++Mlr6mEeerE6r4v19YA+AeMkof93y4fCuZc3iKDxzVEyr++tbmF+FABC OdsiN/IiYaiKgefvMPWE9gw+3on8e4LDJaXwQJo1Ont+uLL1xcIDVXwMVaSi1xyKRm1w VA/VCCoMLsikgjYVgBzWfOaxLYW/zL+eoGZ6t1Iy5GtZGBoEJ8aifxPYzm9wlvY6cv/D 8DQ28+O9p/RTz1Fq0favYe3pTDOEi48+u6pJvyz3roPWb2fZ/UgeCZakMKGyPIViZA83 Tt+A== X-Gm-Message-State: AOAM533WhRWK6XwiYQ5PMzJ6Y2d2SF94CrybTa3szbE4+ieoV9COXXrs 0K9xp0xIYer/l3a8jV+KGBo= X-Google-Smtp-Source: ABdhPJw4BidUZQTAmV3LJkHDKE7X1qt6fzaWbucahjUCngpbzdX11O/YdU3Uf72mxrMRfIb6Tt5WQA== X-Received: by 2002:a63:69c5:0:b0:3fb:a606:819a with SMTP id e188-20020a6369c5000000b003fba606819amr22251860pgc.81.1654071126469; Wed, 01 Jun 2022 01:12:06 -0700 (PDT) Received: from localhost.localdomain ([202.120.234.246]) by smtp.googlemail.com with ESMTPSA id y1-20020a17090ad0c100b001e2f3831102sm792288pjw.17.2022.06.01.01.12.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 01:12:05 -0700 (PDT) From: Miaoqian Lin To: Hector Martin , Sven Peter , Alyssa Rosenzweig , Thomas Gleixner , Marc Zyngier , Linus Walleij , Birger Koblitz , John Crispin , Bert Vermeulen , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Miaoqian Lin Subject: [PATCH 5/6] irqchip/gic-v3: Fix refcount leak in gic_populate_ppi_partitions Date: Wed, 1 Jun 2022 12:09:29 +0400 Message-Id: <20220601080930.31005-6-linmq006@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220601080930.31005-1-linmq006@gmail.com> References: <20220601080930.31005-1-linmq006@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" of_find_node_by_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: e3825ba1af3a ("irqchip/gic-v3: Add support for partitioned PPIs") Signed-off-by: Miaoqian Lin --- drivers/irqchip/irq-gic-v3.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 1d5b4755a27e..5c1cf907ee68 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -1973,12 +1973,15 @@ static void __init gic_populate_ppi_partitions(stru= ct device_node *gic_node) continue; =20 cpu =3D of_cpu_node_to_id(cpu_node); - if (WARN_ON(cpu < 0)) + if (WARN_ON(cpu < 0)) { + of_node_put(cpu_node); continue; + } =20 pr_cont("%pOF[%d] ", cpu_node, cpu); =20 cpumask_set_cpu(cpu, &part->mask); + of_node_put(cpu_node); } =20 pr_cont("}\n"); --=20 2.25.1 From nobody Thu Apr 30 08:25:08 2026 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 8C9D5C433F5 for ; Wed, 1 Jun 2022 08:12:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350623AbiFAIMc (ORCPT ); Wed, 1 Jun 2022 04:12:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350627AbiFAIMP (ORCPT ); Wed, 1 Jun 2022 04:12:15 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ACC82494D for ; Wed, 1 Jun 2022 01:12:14 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id i1so1082859plg.7 for ; Wed, 01 Jun 2022 01:12:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m+PEPLe6RgZ/co/uaiAinJBginVPw5Z9zDkizQywe5E=; b=km40SlpgsEcHZucZJOMM58TzoKmps1pvbmNm/0yqRjeCUeLKj6NHUZPPOJQisuxz+I rs9cx7BB0u1eIYLzMLL1UwKxI0Z7njWVlGW+l2GnEWZ0T3MqpChFsOrCE9YptV3SEEfa 6DKzWT5fd28uC8AzWz1kf+D9xlXYwJrVccOcbMlq3jyROjBzntUh3sOefIJsygyrUO0I HElvR9jNp87t4Sw/+ZXDV4uI8+LT+E0qJqg60uNna25YcqOMbWe42urRnYoq1YsFJ8J2 gGsPMeV37dd5rwRKh7ei0ghgmWKcFyfBshDxi2utkBoGqs747Wp1vPlo+3fqw7StAVIq 3bJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m+PEPLe6RgZ/co/uaiAinJBginVPw5Z9zDkizQywe5E=; b=n7DTJJE84c6jH4yhCzGljcrngBeaZaHQfIt+8TUlPDu+5oKi9CN/+tDppB8ueVuASi WnYv8X7HsiebjqkROCnXlFjPOWk+x4XZ9rntrfkUOiAzDsuIopRfAdW/5fFq20x7R9/7 SayQEhmTuUcNTWfUyWyMf0tjurG+Ak8sW+/Iz9QfeSEdBL98px3KfZGIAdJGJ1LzFsaK rq/xYQjgU/rTLCaP413KeV+YIh7t5Nu6+COr8JdPAhaOPHufTBIHuKe0AY/v/W56YfVJ yvmeCf0ZtxBlwnjSDyfjPSPvtp9XNGo3sP8DeCexPXw1POZxSNlUjQNCcwRT+dqnjVgQ MKHA== X-Gm-Message-State: AOAM530fguMTtzCeKcA+7/5dYFB7cdKCnhdnf0e8b/3DwZDVgs4uajTG dEr2+OfV+rtq4TGPa9cWsk6gCWu00u7AhPc/ X-Google-Smtp-Source: ABdhPJwFrVaDOS+yHOraldAu8p/JQBxp84sZBopNyIVCcUoYq2dXh8kiVGYqtM8BBG6ywJ4n/pN6Kw== X-Received: by 2002:a17:903:124a:b0:154:c7a4:9374 with SMTP id u10-20020a170903124a00b00154c7a49374mr65595986plh.68.1654071133567; Wed, 01 Jun 2022 01:12:13 -0700 (PDT) Received: from localhost.localdomain ([202.120.234.246]) by smtp.googlemail.com with ESMTPSA id y1-20020a17090ad0c100b001e2f3831102sm792288pjw.17.2022.06.01.01.12.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 01:12:13 -0700 (PDT) From: Miaoqian Lin To: Hector Martin , Sven Peter , Alyssa Rosenzweig , Thomas Gleixner , Marc Zyngier , Linus Walleij , John Crispin , Bert Vermeulen , Birger Koblitz , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Miaoqian Lin Subject: [PATCH 6/6] irqchip/realtek-rtl: Fix refcount leak in map_interrupts Date: Wed, 1 Jun 2022 12:09:30 +0400 Message-Id: <20220601080930.31005-7-linmq006@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220601080930.31005-1-linmq006@gmail.com> References: <20220601080930.31005-1-linmq006@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" of_find_node_by_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. This function doesn't call of_node_put() in error path. Call of_node_put() directly after of_property_read_u32() to cover both normal path and error path. Fixes: 9f3a0f34b84a ("irqchip: Add support for Realtek RTL838x/RTL839x inte= rrupt controller") Signed-off-by: Miaoqian Lin --- drivers/irqchip/irq-realtek-rtl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-realtek-rtl.c b/drivers/irqchip/irq-realte= k-rtl.c index 50a56820c99b..56bf502d9c67 100644 --- a/drivers/irqchip/irq-realtek-rtl.c +++ b/drivers/irqchip/irq-realtek-rtl.c @@ -134,9 +134,9 @@ static int __init map_interrupts(struct device_node *no= de, struct irq_domain *do if (!cpu_ictl) return -EINVAL; ret =3D of_property_read_u32(cpu_ictl, "#interrupt-cells", &tmp); + of_node_put(cpu_ictl); if (ret || tmp !=3D 1) return -EINVAL; - of_node_put(cpu_ictl); =20 cpu_int =3D be32_to_cpup(imap + 2); if (cpu_int > 7 || cpu_int < 2) --=20 2.25.1