diff options
author | Petros Angelatos <petrosagg@gmail.com> | 2016-03-22 03:40:29 -0700 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-03-30 16:23:21 +0200 |
commit | ee78a83b5e72887ee40d18d82a750258e6939817 (patch) | |
tree | f69112a4197b6e62612f9150e12f185d426f0697 /btrfs-zero-log.c | |
parent | 90104b2618cbfec84633bad000929ddfb2c7ab67 (diff) |
btrfs-progs: utils: make sure set_label_mounted uses correct length buffers
When `btrfs filesystem label /foo bar` command is invoked, it will pass
the buffer allocated in the argv array directly to set_label_mounted()
and then to the BTRFS_IOC_SET_FSLABEL ioctl.
However, the kernel code handling the ioctl will always try to copy
BTRFS_LABEL_SIZE bytes[1] from the userland pointer. Under certain
conditions and when the label is small enough, the command will fail
with:
[root@localhost /]# btrfs filesystem label /mnt f
ERROR: unable to set label Bad address
Fix this by making sure we pass a BTRFS_LABEL_SIZE sized buffer to the
ioctl containing the desired label.
[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/btrfs/ioctl.c?id=refs/tags/v4.5#n5231
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'btrfs-zero-log.c')
0 files changed, 0 insertions, 0 deletions