Skip to contentSkip to conversation

add some unlocks on error paths irq_comm.c

PATCH In review Dan Carpenter 2 participants 2 messages Nov 10, 2009 – Nov 12, 2009 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add some unlocks on error paths irq_comm.c

There were a couple unlocks missing. They were found by smatch static checker. Compile tested.

regards,
dan carpenter

virt/kvm/irq_comm.c +2 -0
@@ -209,6 +209,7 @@
 				sizeof(kvm->arch.irq_sources_bitmap));
 
 	if (irq_source_id >= sizeof(kvm->arch.irq_sources_bitmap)) {
+		mutex_unlock(&kvm->irq_lock);
 		printk(KERN_WARNING "kvm: exhaust allocatable IRQ sources!\n");
 		return -EFAULT;
 	}
@@ -229,6 +230,7 @@
 	mutex_lock(&kvm->irq_lock);
 	if (irq_source_id < 0 ||
 	    irq_source_id >= sizeof(kvm->arch.irq_sources_bitmap)) {
+		mutex_unlock(&kvm->irq_lock);
 		printk(KERN_ERR "kvm: IRQ source ID out of range!\n");
 		return;
 	}
#1 lore raw

Dan,

This has already been fixed by commit
57225096e5888d84e84224bac13aae2aaed89280.

Thanks.

Quoted 26 lines · Dan Carpenter

There were a couple unlocks missing. They were found by smatch static checker. Compile tested.

regards,
dan carpenter

virt/kvm/irq_comm.c +2 -0
@@ -209,6 +209,7 @@
 				sizeof(kvm->arch.irq_sources_bitmap));
 
 	if (irq_source_id >= sizeof(kvm->arch.irq_sources_bitmap)) {
+		mutex_unlock(&kvm->irq_lock);
 		printk(KERN_WARNING "kvm: exhaust allocatable IRQ sources!\n");
 		return -EFAULT;
 	}
@@ -229,6 +230,7 @@
 	mutex_lock(&kvm->irq_lock);
 	if (irq_source_id < 0 ||
 	    irq_source_id >= sizeof(kvm->arch.irq_sources_bitmap)) {
+		mutex_unlock(&kvm->irq_lock);
 		printk(KERN_ERR "kvm: IRQ source ID out of range!\n");
 		return;
 	}