Re: [PATCH] irqbypass: add missing module_put() in irq_bypass_register_*()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 23 May 2018 19:30:00 +0300
Emmanouil Maroudas <emmanouil.maroudas@xxxxxxxxx> wrote:

> Follow the lock pattern in the irq_bypass_unregister_*()
> ---
>  virt/lib/irqbypass.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/virt/lib/irqbypass.c b/virt/lib/irqbypass.c
> index 6d2fcd6..bb24267 100644
> --- a/virt/lib/irqbypass.c
> +++ b/virt/lib/irqbypass.c
> @@ -123,6 +123,8 @@ int irq_bypass_register_producer(struct irq_bypass_producer *producer)
>  
>  	mutex_unlock(&lock);
>  
> +	module_put(THIS_MODULE);
> +
>  	return 0;
>  }
>  EXPORT_SYMBOL_GPL(irq_bypass_register_producer);
> @@ -218,6 +220,8 @@ int irq_bypass_register_consumer(struct irq_bypass_consumer *consumer)
>  
>  	mutex_unlock(&lock);
>  
> +	module_put(THIS_MODULE);
> +
>  	return 0;
>  }
>  EXPORT_SYMBOL_GPL(irq_bypass_register_consumer);

Nak, the module reference is intentionally held until the
producer/consumer is unregistered.  The above not only removes that
intentional reference but causes an unbalanced module_put() in the
unregistration path (note the double module_put()).  Thanks,

Alex



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux