diff options
author | Christian Borntraeger <borntraeger@de.ibm.com> | 2008-12-02 11:16:03 +0100 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2008-12-31 15:55:44 +0100 |
commit | e3a2a0d4e5ace731e60e2eff4fb7056ecb34adc1 (patch) | |
tree | 87626c198c57dda52979c01f5c781e32ba370e5c /virt/kvm | |
parent | x86: KVM guest: kvm_get_tsc_khz: return khz, not lpj (diff) | |
download | linux-e3a2a0d4e5ace731e60e2eff4fb7056ecb34adc1.tar.xz linux-e3a2a0d4e5ace731e60e2eff4fb7056ecb34adc1.zip |
anon_inodes: use fops->owner for module refcount
There is an imbalance for anonymous inodes. If the fops->owner field is set,
the module reference count of owner is decreases on release.
("filp_close" --> "__fput" ---> "fops_put")
On the other hand, anon_inode_getfd does not increase the module reference
count of owner. This causes two problems:
- if owner is set, the module refcount goes negative
- if owner is not set, the module can be unloaded while code is running
This patch changes anon_inode_getfd to be symmetric regarding fops->owner
handling.
I have checked all existing users of anon_inode_getfd. Noone sets fops->owner,
thats why nobody has seen the module refcount negative. The refcounting was
tested with a patched and unpatched KVM module.(see patch 2/2) I also did an
epoll_open/close test.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Davide Libenzi <davidel@xmailserver.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt/kvm')
0 files changed, 0 insertions, 0 deletions