Commit 417385c4 authored by Linus Torvalds's avatar Linus Torvalds

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.
parents aa54ea90 a96b0d06
...@@ -605,8 +605,10 @@ static int fw_cfg_register_file(const struct fw_cfg_file *f) ...@@ -605,8 +605,10 @@ static int fw_cfg_register_file(const struct fw_cfg_file *f)
/* register entry under "/sys/firmware/qemu_fw_cfg/by_key/" */ /* register entry under "/sys/firmware/qemu_fw_cfg/by_key/" */
err = kobject_init_and_add(&entry->kobj, &fw_cfg_sysfs_entry_ktype, err = kobject_init_and_add(&entry->kobj, &fw_cfg_sysfs_entry_ktype,
fw_cfg_sel_ko, "%d", entry->select); fw_cfg_sel_ko, "%d", entry->select);
if (err) if (err) {
goto err_register; kobject_put(&entry->kobj);
return err;
}
/* add raw binary content access */ /* add raw binary content access */
err = sysfs_create_bin_file(&entry->kobj, &fw_cfg_sysfs_attr_raw); 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) ...@@ -622,7 +624,6 @@ static int fw_cfg_register_file(const struct fw_cfg_file *f)
err_add_raw: err_add_raw:
kobject_del(&entry->kobj); kobject_del(&entry->kobj);
err_register:
kfree(entry); kfree(entry);
return err; return err;
} }
......
...@@ -1215,7 +1215,7 @@ vhost_scsi_ctl_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) ...@@ -1215,7 +1215,7 @@ vhost_scsi_ctl_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
continue; continue;
} }
switch (v_req.type) { switch (vhost32_to_cpu(vq, v_req.type)) {
case VIRTIO_SCSI_T_TMF: case VIRTIO_SCSI_T_TMF:
vc.req = &v_req.tmf; vc.req = &v_req.tmf;
vc.req_size = sizeof(struct virtio_scsi_ctrl_tmf_req); vc.req_size = sizeof(struct virtio_scsi_ctrl_tmf_req);
......
...@@ -85,7 +85,7 @@ config VIRTIO_MEM ...@@ -85,7 +85,7 @@ config VIRTIO_MEM
depends on VIRTIO depends on VIRTIO
depends on MEMORY_HOTPLUG_SPARSE depends on MEMORY_HOTPLUG_SPARSE
depends on MEMORY_HOTREMOVE depends on MEMORY_HOTREMOVE
select CONTIG_ALLOC depends on CONTIG_ALLOC
help help
This driver provides access to virtio-mem paravirtualized memory This driver provides access to virtio-mem paravirtualized memory
devices, allowing to hotplug and hotunplug memory. devices, allowing to hotplug and hotunplug memory.
......
...@@ -578,10 +578,14 @@ static int init_vqs(struct virtio_balloon *vb) ...@@ -578,10 +578,14 @@ static int init_vqs(struct virtio_balloon *vb)
static u32 virtio_balloon_cmd_id_received(struct virtio_balloon *vb) static u32 virtio_balloon_cmd_id_received(struct virtio_balloon *vb)
{ {
if (test_and_clear_bit(VIRTIO_BALLOON_CONFIG_READ_CMD_ID, if (test_and_clear_bit(VIRTIO_BALLOON_CONFIG_READ_CMD_ID,
&vb->config_read_bitmap)) &vb->config_read_bitmap)) {
virtio_cread(vb->vdev, struct virtio_balloon_config, virtio_cread(vb->vdev, struct virtio_balloon_config,
free_page_hint_cmd_id, free_page_hint_cmd_id,
&vb->cmd_id_received_cache); &vb->cmd_id_received_cache);
/* Legacy balloon config space is LE, unlike all other devices. */
if (!virtio_has_feature(vb->vdev, VIRTIO_F_VERSION_1))
vb->cmd_id_received_cache = le32_to_cpu((__force __le32)vb->cmd_id_received_cache);
}
return vb->cmd_id_received_cache; return vb->cmd_id_received_cache;
} }
...@@ -974,6 +978,11 @@ static int virtballoon_probe(struct virtio_device *vdev) ...@@ -974,6 +978,11 @@ static int virtballoon_probe(struct virtio_device *vdev)
/* /*
* Let the hypervisor know that we are expecting a * Let the hypervisor know that we are expecting a
* specific value to be written back in balloon pages. * specific value to be written back in balloon pages.
*
* If the PAGE_POISON value was larger than a byte we would
* need to byte swap poison_val here to guarantee it is
* little-endian. However for now it is a single byte so we
* can pass it as-is.
*/ */
if (!want_init_on_free()) if (!want_init_on_free())
memset(&poison_val, PAGE_POISON, sizeof(poison_val)); memset(&poison_val, PAGE_POISON, sizeof(poison_val));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment