Skip to content

Commit 96d88f6

Browse files
Brian FosterMiklos Szeredi
authored andcommitted
virtiofs: include a newline in sysfs tag
The internal tag string doesn't contain a newline. Append one when emitting the tag via sysfs. [Stefan] Orthogonal to the newline issue, sysfs_emit(buf, "%s", fs->tag) is needed to prevent format string injection. Signed-off-by: Brian Foster <bfoster@redhat.com> Fixes: a8f62f5 ("virtiofs: export filesystem tags through sysfs") Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
1 parent aef8acd commit 96d88f6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/fuse/virtio_fs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static ssize_t tag_show(struct kobject *kobj,
170170
{
171171
struct virtio_fs *fs = container_of(kobj, struct virtio_fs, kobj);
172172

173-
return sysfs_emit(buf, fs->tag);
173+
return sysfs_emit(buf, "%s\n", fs->tag);
174174
}
175175

176176
static struct kobj_attribute virtio_fs_tag_attr = __ATTR_RO(tag);

0 commit comments

Comments
 (0)