]> git.baikalelectronics.ru Git - kernel.git/commit
rtc: r7301: Fix a possible sleep-in-atomic bug in rtc7301_set_time
authorJia-Ju Bai <baijiaju1990@gmail.com>
Wed, 13 Dec 2017 13:56:04 +0000 (21:56 +0800)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Thu, 11 Jan 2018 23:20:34 +0000 (00:20 +0100)
commit7bc824c751dc95e438d49590a67e80e456d5b719
treeb8d9e8a26bf916072856f5f9865dc680162bc49e
parent692304d7aaea00ec81a975fc40e29cf6b884fa60
rtc: r7301: Fix a possible sleep-in-atomic bug in rtc7301_set_time

The driver may sleep under a spinlock.
The function call path is:
rtc7301_set_time (acquire the spinlock)
  usleep_range --> may sleep

To fix it, usleep_range is replaced with udelay.

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

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/rtc-r7301.c