lkml.org 
[lkml]   [2009]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kvm: Prevent kvm_init from corrupting debugfs structures
On 10/15/2009 08:21 AM, Darrick J. Wong wrote:
> 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.
>
>

Looks good.

--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.



\
 
 \ /
  Last update: 2009-10-15 09:19    [W:0.381 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site