Skip to content
Commit fe8e7ace authored by Jia-Ju Bai's avatar Jia-Ju Bai Committed by Greg Kroah-Hartman
Browse files

tty/isicom: Fix a possible sleep-in-atomic bug in WaitTillCardIsFree



The driver may sleep under a spinlock.
The function call paths are:
isicom_activate (acquire the spinlock)
  isicom_setup_board
    drop_dtr_rts
      WaitTillCardIsFree
        msleep --> may sleep

isicom_set_termios
  isicom_config_port
    drop_dtr
      WaitTillCardIsFree
        msleep --> may sleep

isicom_tiocmset
  drop_dtr
    WaitTillCardIsFree
      msleep --> may sleep

Though "in_atomic" is used to check atomic context,
but it is not recommended to use in driver code (see include/linux/preempt.h).

To fix it, only using mdelay instead.

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

Signed-off-by: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent be7e251d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment