Faults in Linux Kernel 3.x : Interrupts turned off but not turned on again

As part of my work, I need to annotate  the reports generated using Coccinelle Scripts as bugs/FPs for recent Linux Kernels, recent as in versions > 3.0 till the current one 3.18.

As I’m reading the reports (newer ones), so today I completed Linux_intr.new.org.

This file has reports for the case where where interrupts are turned off but not turned on again, using the functions local_irq_save or save_and_cli. There were not many Todos. I have also wrote a blog post on this type of pattern.


What is local_irq_save?

Calling local_irq_save function will disable interrupt on the current processor and prior to which it saves current interrupt state into flags (passed to this function). local_irq_restore function enables interrupts and restores state using flags (stored by local_irq_save).

This is a very good read on all sorts of function related to enabling and disabling interrupts and locks.

What did I find?

Most of them were bugs. There was many cases where a return statement was present after disabling an interrupt, unless otherwise stated.

There was some FPs too. Look at the following comment

* prepare_to_wait() must come before steal_tags(), in case
* percpu_ida_free() on another cpu flips a bit in
* cpus_have_tags
* global lock held and irqs disabled, don't need percpu lock

It makes disabling an interrupt and not re enabling it, important and useful. So this makes this as intentional. Most FPs were intentional.

There are bug of this type also present in current Linux Kernel, hence patches are lined up.

#bugs, #coccinelle, #coccinelle-scripts, #faults, #interrupt, #linux-kernel, #linux-kernels