Re: [syzbot] [btrfs?] KASAN: slab-out-of-bounds Read in getname_kernel (2)
From: Edward Adam Davis
Date: Mon Jan 15 2024 - 18:45:58 EST
please test slab-out-of-bounds Read in getname_kernel
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 3bd7d7488169
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 1502d664c892..58ffaede8d16 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -741,6 +741,8 @@ int btrfs_dev_replace_by_ioctl(struct btrfs_fs_info *fs_info,
if ((args->start.srcdevid == 0 && args->start.srcdev_name[0] == '\0') ||
args->start.tgtdev_name[0] == '\0')
return -EINVAL;
+ args->start.srcdev_name[BTRFS_PATH_NAME_MAX] = 0;
+ args->start.tgtdev_name[BTRFS_PATH_NAME_MAX] = 0;
ret = btrfs_dev_replace_start(fs_info, args->start.tgtdev_name,
args->start.srcdevid,