Skip to content

Commit 9eb5f15

Browse files
XidianGeneralBoris Ostrovsky
authored andcommitted
xen: xen-pciback: Replace GFP_ATOMIC with GFP_KERNEL in pcistub_device_alloc
pcistub_device_alloc() is never called in atomic context. The call chain ending up at pcistub_device_alloc() is: [1] pcistub_device_alloc() <- pcistub_seize() <- pcistub_probe() pcistub_probe() is only set as ".probe" in struct pci_driver. This function is not called in atomic context. Despite never getting called from atomic context, pcistub_device_alloc() calls kzalloc() with GFP_ATOMIC, which does not sleep for allocation. GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL, which can sleep and improve the possibility of sucessful allocation. Signed-off-by: Jia-Ju Bai <[email protected]> Reviewed-by: Boris Ostrovsky <[email protected]> Signed-off-by: Boris Ostrovsky <[email protected]>
1 parent bb52e31 commit 9eb5f15

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/xen/xen-pciback/pci_stub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static struct pcistub_device *pcistub_device_alloc(struct pci_dev *dev)
7171

7272
dev_dbg(&dev->dev, "pcistub_device_alloc\n");
7373

74-
psdev = kzalloc(sizeof(*psdev), GFP_ATOMIC);
74+
psdev = kzalloc(sizeof(*psdev), GFP_KERNEL);
7575
if (!psdev)
7676
return NULL;
7777

0 commit comments

Comments
 (0)