From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Sasha Levin <sashal@kernel.org>,
aik@ozlabs.ru, christophe.leroy@csgroup.eu,
linuxppc-dev@lists.ozlabs.org
Subject: [PATCH AUTOSEL 6.2 06/16] powerpc/iommu: fix memory leak with using debugfs_lookup()
Date: Sun, 5 Mar 2023 08:51:57 -0500 [thread overview]
Message-ID: <20230305135207.1793266-6-sashal@kernel.org> (raw)
In-Reply-To: <20230305135207.1793266-1-sashal@kernel.org>
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Upstream commit b505063910c134778202dfad9332dfcecb76bab3 ]
When calling debugfs_lookup() the result must have dput() called on it,
otherwise the memory will leak over time. To make things simpler, just
call debugfs_lookup_and_remove() instead which handles all of the logic
at once.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230202141919.2298821-1-gregkh@linuxfoundation.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/powerpc/kernel/iommu.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index caebe1431596e..ee95937bdaf14 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -67,11 +67,9 @@ static void iommu_debugfs_add(struct iommu_table *tbl)
static void iommu_debugfs_del(struct iommu_table *tbl)
{
char name[10];
- struct dentry *liobn_entry;
sprintf(name, "%08lx", tbl->it_index);
- liobn_entry = debugfs_lookup(name, iommu_debugfs_dir);
- debugfs_remove(liobn_entry);
+ debugfs_lookup_and_remove(name, iommu_debugfs_dir);
}
#else
static void iommu_debugfs_add(struct iommu_table *tbl){}
--
2.39.2
next prev parent reply other threads:[~2023-03-05 13:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-05 13:51 [PATCH AUTOSEL 6.2 01/16] clk: qcom: mmcc-apq8084: remove spdm clocks Sasha Levin
2023-03-05 13:51 ` [PATCH AUTOSEL 6.2 02/16] MIPS: Fix a compilation issue Sasha Levin
2023-03-05 13:51 ` [PATCH AUTOSEL 6.2 03/16] powerpc: Check !irq instead of irq == NO_IRQ and remove NO_IRQ Sasha Levin
2023-03-05 13:51 ` [PATCH AUTOSEL 6.2 04/16] powerpc/64: Don't recurse irq replay Sasha Levin
2023-03-05 13:51 ` [PATCH AUTOSEL 6.2 05/16] s390/virtio: sort out physical vs virtual pointers usage Sasha Levin
2023-03-06 10:26 ` Nico Boehr
2023-03-14 17:26 ` Sasha Levin
2023-03-05 13:51 ` Sasha Levin [this message]
2023-03-05 13:51 ` [PATCH AUTOSEL 6.2 07/16] clk: renesas: rcar-gen3: Disable R-Car H3 ES1.* Sasha Levin
2023-03-05 13:59 ` Geert Uytterhoeven
2023-03-14 17:42 ` Sasha Levin
2023-03-05 13:51 ` [PATCH AUTOSEL 6.2 08/16] powerpc: Remove __kernel_text_address() in show_instructions() Sasha Levin
2023-03-05 13:52 ` [PATCH AUTOSEL 6.2 09/16] powerpc/bpf/32: Only set a stack frame when necessary Sasha Levin
2023-03-05 13:52 ` [PATCH AUTOSEL 6.2 10/16] powerpc/64: Fix task_cpu in early boot when booting non-zero cpuid Sasha Levin
2023-03-05 13:52 ` [PATCH AUTOSEL 6.2 11/16] powerpc/64: Move paca allocation to early_setup() Sasha Levin
2023-03-05 13:52 ` [PATCH AUTOSEL 6.2 12/16] powerpc/kcsan: Exclude udelay to prevent recursive instrumentation Sasha Levin
2023-03-05 13:52 ` [PATCH AUTOSEL 6.2 13/16] alpha: fix R_ALPHA_LITERAL reloc for large modules Sasha Levin
2023-03-05 13:52 ` [PATCH AUTOSEL 6.2 14/16] macintosh: windfarm: Use unsigned type for 1-bit bitfields Sasha Levin
2023-03-05 13:52 ` [PATCH AUTOSEL 6.2 15/16] PCI: Add SolidRun vendor ID Sasha Levin
2023-03-05 13:52 ` [PATCH AUTOSEL 6.2 16/16] PCI: Avoid FLR for SolidRun SNET DPU rev 1 Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230305135207.1793266-6-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=aik@ozlabs.ru \
--cc=christophe.leroy@csgroup.eu \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox