All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] s390/test_unwind: fix possible memleak in test_unwind()
@ 2020-07-30  6:36 ` Wang Hai
  0 siblings, 0 replies; 4+ messages in thread
From: Wang Hai @ 2020-07-30  6:36 UTC (permalink / raw)
  To: hca, gor, borntraeger, colin.king, iii; +Cc: linux-s390, linux-kernel

test_unwind() misses to call kfree(bt) in an error path.
Add the missed function call to fix it.

Fixes: 0610154650f1 ("s390/test_unwind: print verbose unwinding results")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
---
 arch/s390/lib/test_unwind.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/s390/lib/test_unwind.c b/arch/s390/lib/test_unwind.c
index 32b7a30b2485..b0b12b46bc57 100644
--- a/arch/s390/lib/test_unwind.c
+++ b/arch/s390/lib/test_unwind.c
@@ -63,6 +63,7 @@ static noinline int test_unwind(struct task_struct *task, struct pt_regs *regs,
 			break;
 		if (state.reliable && !addr) {
 			pr_err("unwind state reliable but addr is 0\n");
+			kfree(bt);
 			return -EINVAL;
 		}
 		sprint_symbol(sym, addr);
-- 
2.17.1


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

* [PATCH] s390/test_unwind: fix possible memleak in test_unwind()
@ 2020-07-30  6:36 ` Wang Hai
  0 siblings, 0 replies; 4+ messages in thread
From: Wang Hai @ 2020-07-30  6:36 UTC (permalink / raw)
  To: hca, gor, borntraeger, colin.king, iii; +Cc: linux-s390, linux-kernel

test_unwind() misses to call kfree(bt) in an error path.
Add the missed function call to fix it.

Fixes: 0610154650f1 ("s390/test_unwind: print verbose unwinding results")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
---
 arch/s390/lib/test_unwind.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/s390/lib/test_unwind.c b/arch/s390/lib/test_unwind.c
index 32b7a30b2485..b0b12b46bc57 100644
--- a/arch/s390/lib/test_unwind.c
+++ b/arch/s390/lib/test_unwind.c
@@ -63,6 +63,7 @@ static noinline int test_unwind(struct task_struct *task, struct pt_regs *regs,
 			break;
 		if (state.reliable && !addr) {
 			pr_err("unwind state reliable but addr is 0\n");
+			kfree(bt);
 			return -EINVAL;
 		}
 		sprint_symbol(sym, addr);
-- 
2.17.1

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

* Re: [PATCH] s390/test_unwind: fix possible memleak in test_unwind()
  2020-07-30  6:36 ` Wang Hai
  (?)
@ 2020-07-30  7:35 ` Ilya Leoshkevich
  2020-07-31 11:52   ` Heiko Carstens
  -1 siblings, 1 reply; 4+ messages in thread
From: Ilya Leoshkevich @ 2020-07-30  7:35 UTC (permalink / raw)
  To: Wang Hai, hca, gor, borntraeger, colin.king; +Cc: linux-s390, linux-kernel

On Thu, 2020-07-30 at 14:36 +0800, Wang Hai wrote:
> test_unwind() misses to call kfree(bt) in an error path.
> Add the missed function call to fix it.
> 
> Fixes: 0610154650f1 ("s390/test_unwind: print verbose unwinding
> results")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wang Hai <wanghai38@huawei.com>
> ---
>  arch/s390/lib/test_unwind.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/s390/lib/test_unwind.c
> b/arch/s390/lib/test_unwind.c
> index 32b7a30b2485..b0b12b46bc57 100644
> --- a/arch/s390/lib/test_unwind.c
> +++ b/arch/s390/lib/test_unwind.c
> @@ -63,6 +63,7 @@ static noinline int test_unwind(struct task_struct
> *task, struct pt_regs *regs,
>  			break;
>  		if (state.reliable && !addr) {
>  			pr_err("unwind state reliable but addr is
> 0\n");
> +			kfree(bt);
>  			return -EINVAL;
>  		}
>  		sprint_symbol(sym, addr);

Looks good to me, thanks!

Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>


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

* Re: [PATCH] s390/test_unwind: fix possible memleak in test_unwind()
  2020-07-30  7:35 ` Ilya Leoshkevich
@ 2020-07-31 11:52   ` Heiko Carstens
  0 siblings, 0 replies; 4+ messages in thread
From: Heiko Carstens @ 2020-07-31 11:52 UTC (permalink / raw)
  To: Ilya Leoshkevich
  Cc: Wang Hai, gor, borntraeger, colin.king, linux-s390, linux-kernel

On Thu, Jul 30, 2020 at 09:35:15AM +0200, Ilya Leoshkevich wrote:
> On Thu, 2020-07-30 at 14:36 +0800, Wang Hai wrote:
> > test_unwind() misses to call kfree(bt) in an error path.
> > Add the missed function call to fix it.
> > 
> > Fixes: 0610154650f1 ("s390/test_unwind: print verbose unwinding
> > results")
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Wang Hai <wanghai38@huawei.com>
> > ---
> >  arch/s390/lib/test_unwind.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/arch/s390/lib/test_unwind.c
> > b/arch/s390/lib/test_unwind.c
> > index 32b7a30b2485..b0b12b46bc57 100644
> > --- a/arch/s390/lib/test_unwind.c
> > +++ b/arch/s390/lib/test_unwind.c
> > @@ -63,6 +63,7 @@ static noinline int test_unwind(struct task_struct
> > *task, struct pt_regs *regs,
> >  			break;
> >  		if (state.reliable && !addr) {
> >  			pr_err("unwind state reliable but addr is
> > 0\n");
> > +			kfree(bt);
> >  			return -EINVAL;
> >  		}
> >  		sprint_symbol(sym, addr);
> 
> Looks good to me, thanks!
> 
> Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>

Applied, thanks!

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

end of thread, other threads:[~2020-07-31 11:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30  6:36 [PATCH] s390/test_unwind: fix possible memleak in test_unwind() Wang Hai
2020-07-30  6:36 ` Wang Hai
2020-07-30  7:35 ` Ilya Leoshkevich
2020-07-31 11:52   ` Heiko Carstens

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.