diff options
author | Ryan Moeller <[email protected]> | 2022-06-13 20:24:23 +0000 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2022-06-14 08:13:38 -0700 |
commit | def1a401f44abce71196949feaecbd66ebcddf0b (patch) | |
tree | 5926c4e52a873f996cece2741329d7e1f78b179e | |
parent | 482505fd4219a4c3a91f2857199436df27ad687e (diff) |
libzfs: zfs_userns: Don't leak the namespace fd
zfs_userns opens a file descriptor for the kernel to look up a
namespace, but does not close it.
Close the fd when we're done with it.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Allan Jude <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #13554
-rw-r--r-- | lib/libzfs/os/linux/libzfs_util_os.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libzfs/os/linux/libzfs_util_os.c b/lib/libzfs/os/linux/libzfs_util_os.c index 7bd26ea98..0ab79be4e 100644 --- a/lib/libzfs/os/linux/libzfs_util_os.c +++ b/lib/libzfs/os/linux/libzfs_util_os.c @@ -274,5 +274,7 @@ zfs_userns(zfs_handle_t *zhp, const char *nspath, int attach) if ((ret = zfs_ioctl(hdl, cmd, &zc)) != 0) zfs_standard_error(hdl, errno, errbuf); + (void) close(zc.zc_cleanup_fd); + return (ret); } |