]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
scsi: megaraid: Fix a sleep-in-atomic bug
authorJia-Ju Bai <baijiaju1990@163.com>
Wed, 31 May 2017 02:56:56 +0000 (10:56 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 13 Jun 2017 00:48:08 +0000 (20:48 -0400)
The driver may sleep under a spin lock, and the function call path is:
mraid_mm_attach_buf (acquire the lock by spin_lock_irqsave)
  pci_pool_alloc(GFP_KERNEL) --> may sleep

To fix it, the "GFP_KERNEL" is replaced with "GFP_ATOMIC".

[mkp: fixed whitespace]

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/megaraid/megaraid_mm.c

index 4cf9ed96414f05c881221dabcc18ca5717bd2c11..544d6f7e6138e203332c792c4e98ac4532f17f64 100644 (file)
@@ -574,7 +574,7 @@ mraid_mm_attach_buf(mraid_mmadp_t *adp, uioc_t *kioc, int xferlen)
 
        kioc->pool_index        = right_pool;
        kioc->free_buf          = 1;
-       kioc->buf_vaddr         = pci_pool_alloc(pool->handle, GFP_KERNEL,
+       kioc->buf_vaddr         = pci_pool_alloc(pool->handle, GFP_ATOMIC,
                                                        &kioc->buf_paddr);
        spin_unlock_irqrestore(&pool->lock, flags);