diff options
author | Darrick J. Wong <djwong@us.ibm.com> | 2009-10-14 19:21:00 -0400 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2009-10-16 11:30:26 -0400 |
commit | 0ea4ed8e948c30f88c824c973ee4b9529015fe65 (patch) | |
tree | b7bbcbc50fda3290c3acbb6ca38bd1e4dd3f05c6 /virt/kvm/iommu.c | |
parent | 8a8365c560b8b631e0a2d1ac032fbca66a9645bc (diff) |
KVM: Prevent kvm_init from corrupting debugfs structures
I'm seeing an oops condition when kvm-intel and kvm-amd are modprobe'd
during boot (say on an Intel system) and then rmmod'd:
# modprobe kvm-intel
kvm_init()
kvm_init_debug()
kvm_arch_init() <-- stores debugfs dentries internally
(success, etc)
# modprobe kvm-amd
kvm_init()
kvm_init_debug() <-- second initialization clobbers kvm's
internal pointers to dentries
kvm_arch_init()
kvm_exit_debug() <-- and frees them
# rmmod kvm-intel
kvm_exit()
kvm_exit_debug() <-- double free of debugfs files!
*BOOM*
If execution gets to the end of kvm_init(), then the calling module has been
established as the kvm provider. Move the debugfs initialization to the end of
the function, and remove the now-unnecessary call to kvm_exit_debug() from the
error path. That way we avoid trampling on the debugfs entries and freeing
them twice.
Cc: stable@kernel.org
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'virt/kvm/iommu.c')
0 files changed, 0 insertions, 0 deletions