Skip to contentSkip to conversation

s390/test_unwind: fix possible memleak in test_unwind()

PATCH Applied Wang Hai 3 participants 3 messages Jul 30, 2020 – Jul 31, 2020 s390

lore
Share & tools
lore

Wang Hai

author
#0 lore raw

PATCH 1/1 s390/test_unwind: fix possible memleak in test_unwind()

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")
---
 arch/s390/lib/test_unwind.c | 1 +
 1 file changed, 1 insertion(+)
arch/s390/lib/test_unwind.c +1 -0
index 32b7a30b2485..b0b12b46bc57 100644
@@ -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);
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 24 lines · Wang Hai

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")

---
 arch/s390/lib/test_unwind.c | 1 +
 1 file changed, 1 insertion(+)
arch/s390/lib/test_unwind.c +1 -0
index 32b7a30b2485..b0b12b46bc57 100644
@@ -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;

arch/s390/lib/test_unwind.c static noinline int test_unwind(struct task_struct *task, struct pt_regs *regs, · line 69

Quoted 2 lines
arch/s390/lib/test_unwind.c +0 -0
 		}
 		sprint_symbol(sym, addr);

Looks good to me, thanks!

maintainer Applied
#2 lore raw
Quoted 30 lines · Ilya Leoshkevich
Quoted 24 lines · Wang Hai

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")

---
 arch/s390/lib/test_unwind.c | 1 +
 1 file changed, 1 insertion(+)
arch/s390/lib/test_unwind.c +1 -0
index 32b7a30b2485..b0b12b46bc57 100644
@@ -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;

arch/s390/lib/test_unwind.c static noinline int test_unwind(struct task_struct *task, struct pt_regs *regs, · line 69

Quoted 2 lines
arch/s390/lib/test_unwind.c +0 -0
 		}
 		sprint_symbol(sym, addr);

Looks good to me, thanks!

Quoted 1 line

Applied, thanks!