linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] powerpc/pseries: fix potential memory leak in init_cpu_associativity()
@ 2022-12-14  7:46 Wang Yufen
  2023-01-10  6:50 ` Naveen N. Rao
  2023-10-27  9:59 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Wang Yufen @ 2022-12-14  7:46 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy; +Cc: Wang Yufen, naveen.n.rao, linuxppc-dev

If the vcpu_associativity alloc memory successfully but the
pcpu_associativity fails to alloc memory, the vcpu_associativity
memory leaks.

Fixes: d62c8deeb6e6 ("powerpc/pseries: Provide vcpu dispatch statistics")
Signed-off-by: Wang Yufen <wangyufen@huawei.com>
---
 arch/powerpc/platforms/pseries/lpar.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 97ef649..bb24545 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -524,8 +524,10 @@ static ssize_t vcpudispatch_stats_write(struct file *file, const char __user *p,
 
 	if (cmd) {
 		rc = init_cpu_associativity();
-		if (rc)
+		if (rc) {
+			destroy_cpu_associativity();
 			goto out;
+		}
 
 		for_each_possible_cpu(cpu) {
 			disp = per_cpu_ptr(&vcpu_disp_data, cpu);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] powerpc/pseries: fix potential memory leak in init_cpu_associativity()
  2022-12-14  7:46 [PATCH v2] powerpc/pseries: fix potential memory leak in init_cpu_associativity() Wang Yufen
@ 2023-01-10  6:50 ` Naveen N. Rao
  2023-10-27  9:59 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Naveen N. Rao @ 2023-01-10  6:50 UTC (permalink / raw)
  To: christophe.leroy, mpe, npiggin, Wang Yufen; +Cc: linuxppc-dev

Wang Yufen wrote:
> If the vcpu_associativity alloc memory successfully but the
> pcpu_associativity fails to alloc memory, the vcpu_associativity
> memory leaks.
> 
> Fixes: d62c8deeb6e6 ("powerpc/pseries: Provide vcpu dispatch statistics")
> Signed-off-by: Wang Yufen <wangyufen@huawei.com>
> ---
>  arch/powerpc/platforms/pseries/lpar.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>

- Naveen


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] powerpc/pseries: fix potential memory leak in init_cpu_associativity()
  2022-12-14  7:46 [PATCH v2] powerpc/pseries: fix potential memory leak in init_cpu_associativity() Wang Yufen
  2023-01-10  6:50 ` Naveen N. Rao
@ 2023-10-27  9:59 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2023-10-27  9:59 UTC (permalink / raw)
  To: npiggin, christophe.leroy, Wang Yufen; +Cc: naveen.n.rao, linuxppc-dev

On Wed, 14 Dec 2022 15:46:23 +0800, Wang Yufen wrote:
> If the vcpu_associativity alloc memory successfully but the
> pcpu_associativity fails to alloc memory, the vcpu_associativity
> memory leaks.
> 
> 

Applied to powerpc/next.

[1/1] powerpc/pseries: fix potential memory leak in init_cpu_associativity()
      https://git.kernel.org/powerpc/c/95f1a128cd728a7257d78e868f1f5a145fc43736

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-27 10:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-14  7:46 [PATCH v2] powerpc/pseries: fix potential memory leak in init_cpu_associativity() Wang Yufen
2023-01-10  6:50 ` Naveen N. Rao
2023-10-27  9:59 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).