Commit fab7f25
virtio-mmio: fix memory leak of vm_dev
With the recent removal of vm_dev from devres its memory is only freed
via the callback virtio_mmio_release_dev. However, this only takes
effect after device_add is called by register_virtio_device. Until then
it's an unmanaged resource and must be explicitly freed on error exit.
This bug was discovered and resolved using Coverity Static Analysis
Security Testing (SAST) by Synopsys, Inc.
Cc: [email protected]
Fixes: 55c91fe ("virtio-mmio: don't break lifecycle of vm_dev")
Signed-off-by: Maximilian Heyne <[email protected]>
Reviewed-by: Catalin Marinas <[email protected]>
Tested-by: Catalin Marinas <[email protected]>
Reviewed-by: Xuan Zhuo <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Wolfram Sang <[email protected]>1 parent d121df7 commit fab7f25
1 file changed
+14
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
631 | 631 | | |
632 | 632 | | |
633 | 633 | | |
634 | | - | |
635 | | - | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
636 | 638 | | |
637 | 639 | | |
638 | 640 | | |
639 | 641 | | |
640 | 642 | | |
641 | | - | |
| 643 | + | |
| 644 | + | |
642 | 645 | | |
643 | 646 | | |
644 | 647 | | |
645 | 648 | | |
646 | 649 | | |
647 | 650 | | |
648 | 651 | | |
649 | | - | |
| 652 | + | |
| 653 | + | |
650 | 654 | | |
651 | 655 | | |
652 | 656 | | |
| |||
655 | 659 | | |
656 | 660 | | |
657 | 661 | | |
658 | | - | |
| 662 | + | |
| 663 | + | |
659 | 664 | | |
660 | 665 | | |
661 | 666 | | |
| |||
685 | 690 | | |
686 | 691 | | |
687 | 692 | | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
688 | 697 | | |
689 | 698 | | |
690 | 699 | | |
| |||
0 commit comments