Skip to content

Commit 2391f0b

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: "virtio and qemu bugfixes A couple of bugfixes that just became ready" * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: virtio_balloon: fix increment of vb->num_pfns in fill_balloon() virtio: release virtio index when fail to device_register fw_cfg: fix driver remove
2 parents 236fa07 + d9e427f commit 2391f0b

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

drivers/firmware/qemu_fw_cfg.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,10 @@ static int fw_cfg_sysfs_remove(struct platform_device *pdev)
582582
{
583583
pr_debug("fw_cfg: unloading.\n");
584584
fw_cfg_sysfs_cache_cleanup();
585+
sysfs_remove_file(fw_cfg_top_ko, &fw_cfg_rev_attr.attr);
586+
fw_cfg_io_cleanup();
585587
fw_cfg_kset_unregister_recursive(fw_cfg_fname_kset);
586588
fw_cfg_kobj_cleanup(fw_cfg_sel_ko);
587-
fw_cfg_io_cleanup();
588589
return 0;
589590
}
590591

drivers/virtio/virtio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ int register_virtio_device(struct virtio_device *dev)
333333
/* device_register() causes the bus infrastructure to look for a
334334
* matching driver. */
335335
err = device_register(&dev->dev);
336+
if (err)
337+
ida_simple_remove(&virtio_index_ida, dev->index);
336338
out:
337339
if (err)
338340
virtio_add_status(dev, VIRTIO_CONFIG_S_FAILED);

drivers/virtio/virtio_balloon.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,12 @@ static unsigned fill_balloon(struct virtio_balloon *vb, size_t num)
174174
while ((page = balloon_page_pop(&pages))) {
175175
balloon_page_enqueue(&vb->vb_dev_info, page);
176176

177-
vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE;
178-
179177
set_page_pfns(vb, vb->pfns + vb->num_pfns, page);
180178
vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE;
181179
if (!virtio_has_feature(vb->vdev,
182180
VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
183181
adjust_managed_page_count(page, -1);
182+
vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE;
184183
}
185184

186185
num_allocated_pages = vb->num_pfns;

0 commit comments

Comments
 (0)