Skip to content

Commit 39e487f

Browse files
XidianGeneraljgunthorpe
authored andcommitted
infiniband: i40iw: Replace GFP_ATOMIC with GFP_KERNEL in i40iw_add_mqh_4
i40iw_add_mqh_4() is never called in atomic context, because it calls rtnl_lock() that can sleep. Despite never getting called from atomic context, i40iw_add_mqh_4() 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. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai <[email protected]> Acked-by: Shiraz Saleem <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 76be045 commit 39e487f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/infiniband/hw/i40iw/i40iw_cm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1788,7 +1788,7 @@ static enum i40iw_status_code i40iw_add_mqh_4(
17881788
&ifa->ifa_address,
17891789
rdma_vlan_dev_vlan_id(dev),
17901790
dev->dev_addr);
1791-
child_listen_node = kzalloc(sizeof(*child_listen_node), GFP_ATOMIC);
1791+
child_listen_node = kzalloc(sizeof(*child_listen_node), GFP_KERNEL);
17921792
cm_parent_listen_node->cm_core->stats_listen_nodes_created++;
17931793
i40iw_debug(&iwdev->sc_dev,
17941794
I40IW_DEBUG_CM,

0 commit comments

Comments
 (0)