Skip to content

Commit 417385c

Browse files
committed
Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
Pull virtio fixes from Michael Tsirkin: "A couple of last minute bugfixes" * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: virtio-mem: Fix build error due to improper use 'select' virtio_balloon: fix up endian-ness for free cmd id virtio-balloon: Document byte ordering of poison_val vhost/scsi: fix up req type endian-ness firmware: Fix a reference count leak.
2 parents aa54ea9 + a96b0d0 commit 417385c

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

drivers/firmware/qemu_fw_cfg.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,10 @@ static int fw_cfg_register_file(const struct fw_cfg_file *f)
605605
/* register entry under "/sys/firmware/qemu_fw_cfg/by_key/" */
606606
err = kobject_init_and_add(&entry->kobj, &fw_cfg_sysfs_entry_ktype,
607607
fw_cfg_sel_ko, "%d", entry->select);
608-
if (err)
609-
goto err_register;
608+
if (err) {
609+
kobject_put(&entry->kobj);
610+
return err;
611+
}
610612

611613
/* add raw binary content access */
612614
err = sysfs_create_bin_file(&entry->kobj, &fw_cfg_sysfs_attr_raw);
@@ -622,7 +624,6 @@ static int fw_cfg_register_file(const struct fw_cfg_file *f)
622624

623625
err_add_raw:
624626
kobject_del(&entry->kobj);
625-
err_register:
626627
kfree(entry);
627628
return err;
628629
}

drivers/vhost/scsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,7 @@ vhost_scsi_ctl_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
12151215
continue;
12161216
}
12171217

1218-
switch (v_req.type) {
1218+
switch (vhost32_to_cpu(vq, v_req.type)) {
12191219
case VIRTIO_SCSI_T_TMF:
12201220
vc.req = &v_req.tmf;
12211221
vc.req_size = sizeof(struct virtio_scsi_ctrl_tmf_req);

drivers/virtio/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ config VIRTIO_MEM
8585
depends on VIRTIO
8686
depends on MEMORY_HOTPLUG_SPARSE
8787
depends on MEMORY_HOTREMOVE
88-
select CONTIG_ALLOC
88+
depends on CONTIG_ALLOC
8989
help
9090
This driver provides access to virtio-mem paravirtualized memory
9191
devices, allowing to hotplug and hotunplug memory.

drivers/virtio/virtio_balloon.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,10 +578,14 @@ static int init_vqs(struct virtio_balloon *vb)
578578
static u32 virtio_balloon_cmd_id_received(struct virtio_balloon *vb)
579579
{
580580
if (test_and_clear_bit(VIRTIO_BALLOON_CONFIG_READ_CMD_ID,
581-
&vb->config_read_bitmap))
581+
&vb->config_read_bitmap)) {
582582
virtio_cread(vb->vdev, struct virtio_balloon_config,
583583
free_page_hint_cmd_id,
584584
&vb->cmd_id_received_cache);
585+
/* Legacy balloon config space is LE, unlike all other devices. */
586+
if (!virtio_has_feature(vb->vdev, VIRTIO_F_VERSION_1))
587+
vb->cmd_id_received_cache = le32_to_cpu((__force __le32)vb->cmd_id_received_cache);
588+
}
585589

586590
return vb->cmd_id_received_cache;
587591
}
@@ -974,6 +978,11 @@ static int virtballoon_probe(struct virtio_device *vdev)
974978
/*
975979
* Let the hypervisor know that we are expecting a
976980
* specific value to be written back in balloon pages.
981+
*
982+
* If the PAGE_POISON value was larger than a byte we would
983+
* need to byte swap poison_val here to guarantee it is
984+
* little-endian. However for now it is a single byte so we
985+
* can pass it as-is.
977986
*/
978987
if (!want_init_on_free())
979988
memset(&poison_val, PAGE_POISON, sizeof(poison_val));

0 commit comments

Comments
 (0)