diff options
author | Karel Zak <kzak@redhat.com> | 2024-04-22 14:28:52 +0200 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2024-04-22 14:28:52 +0200 |
commit | 42880f54894c1d7fd113552ff8474566a2595a0d (patch) | |
tree | eb5ff4591e0ad979ab371bf1f6ae6a94c064b9cc | |
parent | 60546acc885243c94a7aa95e00e9105fa88a8fe6 (diff) | |
download | util-linux-42880f54894c1d7fd113552ff8474566a2595a0d.tar.gz |
lsns: fix netns use
# ip netns add vpn
# lsns -T -t net
Segmentation fault (core dumped)
The function interpolate_missing_namespaces() reads data from /proc.
However, in the case of a persistent namespace, there is no procfs
entry for the namespace. Therefore, this function should ignore it.
Fixes: https://github.com/util-linux/util-linux/issues/2982
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | sys-utils/lsns.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c index 89484dd583..dc26d5556a 100644 --- a/sys-utils/lsns.c +++ b/sys-utils/lsns.c @@ -835,6 +835,9 @@ static void interpolate_missing_namespaces(struct lsns *ls, struct lsns_namespac int fd_orphan, fd_missing; struct stat st; + if (!orphan->proc) + return; + orphan->related_ns[rela] = get_namespace(ls, orphan->related_id[rela]); if (orphan->related_ns[rela]) return; |