This is a note to let you know that I've just added the patch titled firmware: qemu_fw_cfg: fix sysfs information leak to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: firmware-qemu_fw_cfg-fix-sysfs-information-leak.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 1b656e9aad7f4886ed466094d1dc5ee4dd900d20 Mon Sep 17 00:00:00 2001 From: Johan Hovold <johan@xxxxxxxxxx> Date: Wed, 1 Dec 2021 14:25:27 +0100 Subject: firmware: qemu_fw_cfg: fix sysfs information leak From: Johan Hovold <johan@xxxxxxxxxx> commit 1b656e9aad7f4886ed466094d1dc5ee4dd900d20 upstream. Make sure to always NUL-terminate file names retrieved from the firmware to avoid accessing data beyond the entry slab buffer and exposing it through sysfs in case the firmware data is corrupt. Fixes: 75f3e8e47f38 ("firmware: introduce sysfs driver for QEMU's fw_cfg device") Cc: stable@xxxxxxxxxxxxxxx # 4.6 Cc: Gabriel Somlo <somlo@xxxxxxx> Signed-off-by: Johan Hovold <johan@xxxxxxxxxx> Link: https://lore.kernel.org/r/20211201132528.30025-4-johan@xxxxxxxxxx Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/firmware/qemu_fw_cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/firmware/qemu_fw_cfg.c +++ b/drivers/firmware/qemu_fw_cfg.c @@ -601,7 +601,7 @@ static int fw_cfg_register_file(const st /* set file entry information */ entry->size = be32_to_cpu(f->size); entry->select = be16_to_cpu(f->select); - memcpy(entry->name, f->name, FW_CFG_MAX_FILE_PATH); + strscpy(entry->name, f->name, FW_CFG_MAX_FILE_PATH); /* register entry under "/sys/firmware/qemu_fw_cfg/by_key/" */ err = kobject_init_and_add(&entry->kobj, &fw_cfg_sysfs_entry_ktype, Patches currently in stable-queue which might be from johan@xxxxxxxxxx are queue-5.10/firmware-qemu_fw_cfg-fix-null-pointer-deref-on-duplicate-entries.patch queue-5.10/firmware-qemu_fw_cfg-fix-sysfs-information-leak.patch queue-5.10/media-uvcvideo-fix-division-by-zero-at-stream-start.patch queue-5.10/firmware-qemu_fw_cfg-fix-kobject-leak-in-probe-error-path.patch