Re: [syzbot] [btrfs?] KASAN: slab-out-of-bounds Read in getname_kernel (2)

From: Edward Adam Davis
Date: Mon Jan 15 2024 - 20:15:44 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..fe6172707151 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -742,6 +742,7 @@ int btrfs_dev_replace_by_ioctl(struct btrfs_fs_info *fs_info,
args->start.tgtdev_name[0] == '\0')
return -EINVAL;

+ args->start.tgtdev_name[BTRFS_DEVICE_PATH_NAME_MAX] = '\0';
ret = btrfs_dev_replace_start(fs_info, args->start.tgtdev_name,
args->start.srcdevid,
args->start.srcdev_name,