s390/test_unwind: fix possible memleak in test_unwind()
authorWang Hai <wanghai38@huawei.com>
Thu, 30 Jul 2020 06:36:02 +0000 (14:36 +0800)
committerHeiko Carstens <hca@linux.ibm.com>
Tue, 11 Aug 2020 16:16:16 +0000 (18:16 +0200)
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>
Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/lib/test_unwind.c

index eb382ceaa116117f792e59435648b5f5aa73bfe9..7c988994931f03676cb425a3b4300b47dcb16dc9 100644 (file)
@@ -64,6 +64,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);