title: btrfs: dev-replace: properly validate device names
description: In the Linux kernel, the following vulnerability has been resolved:
btrfs: dev-replace: properly validate device names
There's a syzbot report that device name buffers passed to device
replace are not properly checked for string termination which could lead
to a read out of bounds in getname_kernel().
Add a helper that validates both source and target device name buffers.
For devid as the source initialize the buffer to empty string in case
something tries to read it later.
This was originally analyzed and fixed in a different way by Edward Adam
Davis (see links).
affected:
{
product: Linux
vendor: Linux
defaultStatus: unaffected
repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
versions:
version: 1da177e4c3f4, lessThan: 11d7a2e429c0, status: affected, versionType: git
version: 1da177e4c3f4, lessThan: c6652e20d7d7, status: affected, versionType: git
version: 1da177e4c3f4, lessThan: 2886fe308a83, status: affected, versionType: git
version: 1da177e4c3f4, lessThan: ab2d68655d0f, status: affected, versionType: git
version: 1da177e4c3f4, lessThan: f590040ce2b7, status: affected, versionType: git
version: 1da177e4c3f4, lessThan: b1690ced4d2d, status: affected, versionType: git
version: 1da177e4c3f4, lessThan: 343eecb4ff49, status: affected, versionType: git
version: 1da177e4c3f4, lessThan: 9845664b9ee4, status: affected, versionType: git
}
{
product: Linux
vendor: Linux
defaultStatus: affected
repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
versions:
version: 4.19.309, lessThanOrEqual: 4.19.*, status: unaffected, versionType: custom
version: 5.4.271, lessThanOrEqual: 5.4.*, status: unaffected, versionType: custom
version: 5.10.212, lessThanOrEqual: 5.10.*, status: unaffected, versionType: custom
version: 5.15.151, lessThanOrEqual: 5.15.*, status: unaffected, versionType: custom
version: 6.1.81, lessThanOrEqual: 6.1.*, status: unaffected, versionType: custom
version: 6.6.21, lessThanOrEqual: 6.6.*, status: unaffected, versionType: custom
version: 6.7.9, lessThanOrEqual: 6.7.*, status: unaffected, versionType: custom
version: 6.8, lessThanOrEqual: *, status: unaffected, versionType: original_commit_for_fix
}
