lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1606456195-23965-1-git-send-email-tangyouling@loongson.cn>
Date:   Fri, 27 Nov 2020 13:49:55 +0800
From:   Youling Tang <tangyouling@...ngson.cn>
To:     Shuah Khan <shuah@...nel.org>
Cc:     linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] tools: selftests: Add missing munmap() in check_error_paths()

Add the missing munmap(addr_ro, PAGE_SIZE) before return.

Signed-off-by: Youling Tang <tangyouling@...ngson.cn>
---
 tools/testing/selftests/ptrace/peeksiginfo.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/ptrace/peeksiginfo.c b/tools/testing/selftests/ptrace/peeksiginfo.c
index 5490065..3d64be4 100644
--- a/tools/testing/selftests/ptrace/peeksiginfo.c
+++ b/tools/testing/selftests/ptrace/peeksiginfo.c
@@ -62,7 +62,7 @@ static int check_error_paths(pid_t child)
 			MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
 	if (addr_ro == MAP_FAILED) {
 		err("mmap() failed: %m\n");
-		goto out;
+		goto out_rw;
 	}
 
 	arg.nr = SIGNR;
@@ -75,7 +75,7 @@ static int check_error_paths(pid_t child)
 		err("sys_ptrace() returns %d (expected -1),"
 				" errno %d (expected %d): %m\n",
 				ret, errno, EINVAL);
-		goto out;
+		goto out_ro;
 	}
 	arg.flags = 0;
 
@@ -84,7 +84,7 @@ static int check_error_paths(pid_t child)
 					addr_ro - sizeof(siginfo_t) * 2);
 	if (ret != 2) {
 		err("sys_ptrace() returns %d (expected 2): %m\n", ret);
-		goto out;
+		goto out_ro;
 	}
 
 	/* Read-only buffer */
@@ -93,11 +93,13 @@ static int check_error_paths(pid_t child)
 		err("sys_ptrace() returns %d (expected -1),"
 				" errno %d (expected %d): %m\n",
 				ret, errno, EFAULT);
-		goto out;
+		goto out_ro;
 	}
 
 	exit_code = 0;
-out:
+out_ro:
+	munmap(addr_ro, PAGE_SIZE);
+out_rw:
 	munmap(addr_rw, 2 * PAGE_SIZE);
 	return exit_code;
 }
-- 
2.1.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ