Patch "virtiofs: forbid newlines in tags" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    virtiofs: forbid newlines in tags

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:
     virtiofs-forbid-newlines-in-tags.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.



commit ed070d9580433c822d3bb079e0076396e8fe6e0a
Author: Stefan Hajnoczi <stefanha@xxxxxxxxxx>
Date:   Mon Feb 12 19:11:47 2024 -0500

    virtiofs: forbid newlines in tags
    
    [ Upstream commit 40488cc16f7ea0d193a4e248f0d809c25cc377db ]
    
    Newlines in virtiofs tags are awkward for users and potential vectors
    for string injection attacks.
    
    Signed-off-by: Stefan Hajnoczi <stefanha@xxxxxxxxxx>
    Reviewed-by: Vivek Goyal <vgoyal@xxxxxxxxxx>
    Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index 7d4655022afc6..c50999ad9f7ab 100644
--- a/fs/fuse/virtio_fs.c
+++ b/fs/fuse/virtio_fs.c
@@ -315,6 +315,16 @@ static int virtio_fs_read_tag(struct virtio_device *vdev, struct virtio_fs *fs)
 		return -ENOMEM;
 	memcpy(fs->tag, tag_buf, len);
 	fs->tag[len] = '\0';
+
+	/* While the VIRTIO specification allows any character, newlines are
+	 * awkward on mount(8) command-lines and cause problems in the sysfs
+	 * "tag" attr and uevent TAG= properties. Forbid them.
+	 */
+	if (strchr(fs->tag, '\n')) {
+		dev_dbg(&vdev->dev, "refusing virtiofs tag with newline character\n");
+		return -EINVAL;
+	}
+
 	return 0;
 }
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux