[BUG] kernel: locking: a possible sleep-in-atomic-context bug in rt_mutex_slowlock()

From: Jia-Ju Bai
Date: Wed Jun 20 2018 - 23:15:24 EST


The kernel may sleep with holding a spinlock.
The function call path (from bottom to top) in Linux-4.16.7 is:

[FUNC] schedule
kernel/locking/rtmutex.c, 1223: schedule in rt_mutex_handle_deadlock
kernel/locking/rtmutex.c, 1273: rt_mutex_handle_deadlock in rt_mutex_slowlock
kernel/locking/rtmutex.c, 1249: _raw_spin_lock_irqsave in rt_mutex_slowlock

This bug is found by my static analysis tool (DSAC-2) and checked by my
code review.

I do not know how to correctly fix this bug, so I just report them.


Best wishes,
Jia-Ju Bai