From ac282b728594630c17dc6ec5d90dbf56397865f0 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Thu, 2 May 2024 03:51:18 +0900 Subject: [PATCH] lsns: verify the uniqueness of a namespace in ls->namespaces list In read_open_ns_inos(), a namespace is added to the list without verifying its uniqueness in the list. Signed-off-by: Masatake YAMATO --- sys-utils/lsns.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c index 220c85825..6b6ea2924 100644 --- a/sys-utils/lsns.c +++ b/sys-utils/lsns.c @@ -588,6 +588,8 @@ static void read_opened_namespaces(struct lsns *ls, struct path_cxt *pc) if (ul_path_stat(pc, &st, 0, path) == 0 && st.st_dev == ls->nsfs_dev) { + if (get_namespace(ls, st.st_ino)) + continue; int fd = ul_path_open(pc, O_RDONLY, path); if (fd >= 0) { add_namespace_for_nsfd(ls, fd, st.st_ino); -- 2.47.3