From b1df825bbef5587ee7dcff5f8e11c4a1c260673c Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 23 Sep 2018 03:03:38 +0000 Subject: [PATCH] qla2x00t: Avoid using higher order page allocations Avoid that qla2x00_get_node_name_list() fails as follows: kworker/0:2: page allocation failure: order:4, mode:0x240c0c0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO) CPU: 0 PID: 101 Comm: kworker/0:2 Not tainted 4.9.124-scst #3 Hardware name: Supermicro SYS-1028U-E1CR4+/X10DRU-i+, BIOS 3.1 06/08/2018 Workqueue: events q2t_del_sess_work_fn [qla2x00tgt] ffffa0954357f9e8 ffffffff9c2c2fd8 ffffffff9c721178 0000000000000001 ffffa0954357fa70 ffffffff9c13eb7a 0240c0c00240c0c0 ffffffff9c721178 ffffa0954357fa10 ffff9e6700000010 ffffa0954357fa80 ffffa0954357fa30 Call Trace: dump_stack+0x4d/0x65 warn_alloc+0x13a/0x170 __alloc_pages_nodemask+0x486/0xd70 alloc_pages_current+0x6f/0x100 kmalloc_order+0x18/0x40 kmalloc_order_trace+0x24/0xa0 __kmalloc+0x163/0x190 qla2x00_get_node_name_list+0x249/0x3e0 [qla2xxx] q2t_del_sess_work_fn+0xd8/0x4a0 [qla2x00tgt] process_one_work+0x14f/0x440 worker_thread+0x48/0x4e0 kthread+0xd9/0xf0 ret_from_fork+0x22/0x30 This is a slightly modified version of a patch from Pascal de Bruijn . git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7475 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t/qla2x00-target/qla2x00t.c | 2 +- qla2x00t/qla_attr.c | 2 +- qla2x00t/qla_mbx.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/qla2x00t/qla2x00-target/qla2x00t.c b/qla2x00t/qla2x00-target/qla2x00t.c index 32437a989..6e4893b97 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.c +++ b/qla2x00t/qla2x00-target/qla2x00t.c @@ -1256,7 +1256,7 @@ retry: } } - kfree(pmap); + vfree(pmap); if (!found) { res = false; diff --git a/qla2x00t/qla_attr.c b/qla2x00t/qla_attr.c index 9fdb3770f..d141659c9 100644 --- a/qla2x00t/qla_attr.c +++ b/qla2x00t/qla_attr.c @@ -411,7 +411,7 @@ qla2x00_show_port_database(struct device *dev, } } - kfree(pmap); + vfree(pmap); } next: diff --git a/qla2x00t/qla_mbx.c b/qla2x00t/qla_mbx.c index e674a9675..3ddae00ae 100644 --- a/qla2x00t/qla_mbx.c +++ b/qla2x00t/qla_mbx.c @@ -1315,8 +1315,8 @@ out: #ifdef CONFIG_SCSI_QLA2XXX_TARGET /* * qla2x00_get_node_name_list - * Issue get node name list mailbox command, kmalloc() - * and return the resulting list. Caller must kfree() it! + * Issue get node name list mailbox command, vmalloc() + * and return the resulting list. Caller must vfree() it! * * Input: * ha = adapter state pointer. @@ -1388,7 +1388,7 @@ qla2x00_get_node_name_list(scsi_qla_host_t *vha, bool include_initiators, left = 0; - list = kzalloc(dma_size, GFP_KERNEL); + list = vmalloc(dma_size); if (list == NULL) { printk(KERN_ERR "%s(%ld): failed to allocate node names" " list structure.\n", __func__, vha->host_no);