8f4a09
From 498385e3aaf265d6e9786e0a391196cd82ab3260 Mon Sep 17 00:00:00 2001
8f4a09
From: Pingfan Liu <piliu@redhat.com>
8f4a09
Date: Fri, 18 Jun 2021 18:14:20 +0800
8f4a09
Subject: [PATCH 6/6] numactl.c: fix use after free
8f4a09
8f4a09
The following command can trigger the bug
8f4a09
  numactl --length 65536 --shm xxx -p0 -V > /dev/null
8f4a09
8f4a09
So reset mask to block any new access inside this loop.
8f4a09
8f4a09
Signed-off-by: Pingfan Liu <piliu@redhat.com>
8f4a09
---
8f4a09
 numactl.c | 1 +
8f4a09
 1 file changed, 1 insertion(+)
8f4a09
8f4a09
diff --git a/numactl.c b/numactl.c
8f4a09
index 5a9d2df..ae41d6c 100644
8f4a09
--- a/numactl.c
8f4a09
+++ b/numactl.c
8f4a09
@@ -544,6 +544,7 @@ int main(int ac, char **av)
8f4a09
 			if (nnodes != 1)
8f4a09
 				usage();
8f4a09
 			numa_bitmask_free(mask);
8f4a09
+			mask = NULL;
8f4a09
 			errno = 0;
8f4a09
 			did_node_cpu_parse = 1;
8f4a09
 			numa_set_bind_policy(0);
8f4a09
-- 
8f4a09
2.29.2
8f4a09