[Lguest] [PATCH] lguest: Make sure the interrupt is allocated correctly by lguest_setup_irq (ie check the return value of irq_alloc_desc_at for -ENOMEM)

Rusty Russell rusty at rustcorp.com.au
Thu Jun 23 19:41:58 EST 2011


On Thu, 23 Jun 2011 12:23:08 +0300, Stratos Psomadakis <psomas at ece.ntua.gr> wrote:
> About this comment, we pass back any error we receive anyway. We just 
> check for -ENOMEM, so that we don't call irq_set_chip_and_handler_name 
> if we run out of memory.
> 
> However, after some searching and looking at code I think that:
> 1) We could just do err = irq_alloc_desc_at, without checking for 
> -ENOMEM, and just pass the error code to lg_find_vq. 
> irq_set_chip_and_handler_name can handle this situation without problems 
> (ie no descriptor for the given irq).
> 2) We should only check for -ENOMEM in lg_find_vq. Other error codes 
> either don't ever get returned (ie -EINVAL), or they're 'valid', like 
> -EEXIST, since we don't free the irq descs when deleting a virtqueue. If 
> we call setup_irq again irq_alloc_desc_at will return -EEXIST I think.
> 
> Am I right?

I believe so, yes.

Thanks,
Rusty.


More information about the Lguest mailing list