btrfs-progs/libbtrfsutil/python
Omar Sandoval e3e10fc8c6 libbtrfsutil: fix accidentally closing fd passed to subvolume iterator
For an unprivileged subvolume iterator, append_to_search_stack() closes
cur_fd. On the first call to btrfs_util_subvolume_iterator_next(),
cur_fd is equal to the fd that was passed to
btrfs_util_create_subvolume_iterator_fd(). We're not supposed to close
that. We didn't notice it because it's more common to use it through
btrfs_util_create_subvolume_iterator(), which opens its own fd that
should be closed, and because the fd number is often reused internally
by the subvolume iterator.

pop_search_stack() already has a check to avoid closing the passed fd;
add the same check to append_to_search_stack(). Also add a regression
test.

Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-06-25 17:42:18 +02:00
..
tests libbtrfsutil: fix accidentally closing fd passed to subvolume iterator 2024-06-25 17:42:18 +02:00
.gitignore
btrfsutilpy.h libbtrfsutil: relicense to LGPLv2.1+ 2021-04-19 18:58:26 +02:00
error.c libbtrfsutil: relicense to LGPLv2.1+ 2021-04-19 18:58:26 +02:00
filesystem.c libbtrfsutil: relicense to LGPLv2.1+ 2021-04-19 18:58:26 +02:00
module.c btrfs-progs: remove support for BTRFS_SUBVOL_CREATE_ASYNC 2021-10-06 16:49:21 +02:00
qgroup.c libbtrfsutil: relicense to LGPLv2.1+ 2021-04-19 18:58:26 +02:00
setup.py libbtrfsutil: add warning about autogenerated constants.c 2021-05-06 16:41:47 +02:00
subvolume.c libbtrfsutil: relicense to LGPLv2.1+ 2021-04-19 18:58:26 +02:00