From: Masatake YAMATO Date: Wed, 1 May 2024 18:51:18 +0000 (+0900) Subject: lsns: verify the uniqueness of a namespace in ls->namespaces list X-Git-Tag: v2.42-start~354^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac282b728594630c17dc6ec5d90dbf56397865f0;p=thirdparty%2Futil-linux.git 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 --- 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);