scsi: qedi: Fix a possible sleep-in-atomic bug in qedi_process_tmf_resp
authorJia-Ju Bai <baijiaju1990@gmail.com>
Wed, 13 Dec 2017 09:11:08 +0000 (17:11 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 21 Dec 2017 02:11:51 +0000 (21:11 -0500)
commitb128458876975898221cc69c76ad72a5d3cbf297
tree46e24ed29fc2967c110a449fb6dd39bca849aeb1
parent6ae9abe0bde53fb92c51d0f4e2a3f310a1cf5d38
scsi: qedi: Fix a possible sleep-in-atomic bug in qedi_process_tmf_resp

The driver may sleep under a spinlock.
The function call path is:
qedi_cpu_offline (acquire the spinlock)
  qedi_fp_process_cqes
    qedi_mtask_completion
      qedi_process_tmf_resp
        kzalloc(GFP_KERNEL) --> may sleep

To fix it, GFP_KERNEL is replaced with GFP_ATOMIC.

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>
Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qedi/qedi_fw.c