Chapter 5. Recipes for Deadlock

You cannot call any routines which may sleep, unless:

Note that some functions may sleep implicitly: common ones are the user space access functions (*_user) and memory allocation functions without GFP_ATOMIC.

You should always compile your kernel CONFIG_DEBUG_SPINLOCK_SLEEP on, and it will warn you if you break these rules. If you do break the rules, you will eventually lock up your box.