• David Sterba's avatar
    btrfs: factor out validation of btrfs_ioctl_vol_args_v2::name · 0478adff
    David Sterba authored
    The validation of vol args v2 name in snapshot and device remove ioctls
    is not done properly. A terminating NUL is written to the end of the
    buffer unconditionally, assuming that this would be the last place in
    case the buffer is used completely. This does not communicate back the
    actual error (either an invalid or too long path).
    
    Factor out all such cases and use a helper to do the verification,
    simply look for NUL in the buffer.  There's no expected practical
    change, the size of buffer is 4088, this is enough for most paths or
    names.
    Reviewed-by: default avatarBoris Burkov <boris@bur.io>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    0478adff
ioctl.c 117 KB