KVM: fix 'release' method of KVM device
PATCH 1/1 KVM: fix 'release' method of KVM device
There is no need to test for the device pointer validity when releasing a KVM device. The file descriptor should identify it safely.
---
Fixes http://patchwork.ozlabs.org/patch/1087506/
https://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git/commit/?h=kvm-ppc-next&id+de9b3ec8bdf60788e9e2ce8c07a2f8d6003dbd
virt/kvm/kvm_main.c | 6 ------ 1 file changed, 6 deletions(-)
virt/kvm/kvm_main.c +0 -6
@@ -2939,12 +2939,6 @@ static int kvm_device_release(struct inode *inode, struct file *filp)struct kvm_device *dev = filp->private_data;struct kvm *kvm = dev->kvm; -if (!dev) -return -ENODEV ; - -if (dev->kvm != kvm) -return -EPERM ; -if (dev->ops->release) {mutex_lock (&kvm->lock);list_del (&dev->vm_node);
Signature · 1 line
2.20.1
Quoted 2 lines · Cédric Le Goater
There is no need to test for the device pointer validity when releasing a KVM device. The file descriptor should identify it safely.
"Fix" implies it is broken. Is it broken?
Quoted 28 lines
Signed-off-by Cédric Le Goater <[email protected]>---
Fixes http://patchwork.ozlabs.org/patch/1087506/
https://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git/commit/?h=kvm-ppc-next&id+de9b3ec8bdf60788e9e2ce8c07a2f8d6003dbdvirt/kvm/kvm_main.c | 6 ------ 1 file changed, 6 deletions(-)virt/kvm/kvm_main.c +0
-6@@ -2939,12 +2939,6 @@ static int kvm_device_release(struct inode *inode, struct file *filp)struct kvm_device *dev = filp->private_data;struct kvm *kvm = dev->kvm; -if (!dev) -return -ENODEV ; - -if (dev->kvm != kvm) -return -EPERM ; -if (dev->ops->release) {mutex_lock (&kvm->lock);list_del (&dev->vm_node);
Signature · 3 lines
Thanks, David / dhildenb
Quoted 5 lines · David Hildenbrand
Quoted 2 lines · Cédric Le Goater
There is no need to test for the device pointer validity when releasing a KVM device. The file descriptor should identify it safely.
"Fix" implies it is broken. Is it broken?
no, it's not broken indeed. The changes are removing useless checks leftover from a previous patch. A title such as :
remove useless checks in 'release' method of KVM device
would be more appropriate. I can send a v2 with Alexey's rb.
Thanks,
C.
Quoted 30 lines
Quoted 28 lines
Signed-off-by Cédric Le Goater <[email protected]>---
Fixes http://patchwork.ozlabs.org/patch/1087506/
https://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git/commit/?h=kvm-ppc-next&id+de9b3ec8bdf60788e9e2ce8c07a2f8d6003dbdvirt/kvm/kvm_main.c | 6 ------ 1 file changed, 6 deletions(-)virt/kvm/kvm_main.c +0
-6@@ -2939,12 +2939,6 @@ static int kvm_device_release(struct inode *inode, struct file *filp)struct kvm_device *dev = filp->private_data;struct kvm *kvm = dev->kvm; -if (!dev) -return -ENODEV ; - -if (dev->kvm != kvm) -return -EPERM ; -if (dev->ops->release) {mutex_lock (&kvm->lock);list_del (&dev->vm_node);
Quoted 8 lines · Cédric Le Goater
There is no need to test for the device pointer validity when releasing a KVM device. The file descriptor should identify it safely.
Signed-off-by Cédric Le Goater <[email protected]>---
Fixes http://patchwork.ozlabs.org/patch/1087506/
https://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git/commit/?h=kvm-ppc-next&id+de9b3ec8bdf60788e9e2ce8c07a2f8d6003dbd
Usually suggested way is:
[fstn1-p1 kernel]$ git log -1 --format='Fixes: %h ("%s")' 2bde9b3ec8bd
Anyway,
Quoted 22 lines
virt/kvm/kvm_main.c | 6 ------ 1 file changed, 6 deletions(-)virt/kvm/kvm_main.c +0
-6@@ -2939,12 +2939,6 @@ static int kvm_device_release(struct inode *inode, struct file *filp)struct kvm_device *dev = filp->private_data;struct kvm *kvm = dev->kvm; -if (!dev) -return -ENODEV ; - -if (dev->kvm != kvm) -return -EPERM ; -if (dev->ops->release) {mutex_lock (&kvm->lock);list_del (&dev->vm_node);
Signature · 1 line
Alexey