提交 bdb43f59 编写于 作者: L liuzhongzhu 提交者: Xie XiuQi

net: hns3: Modify the kcalloc memory request to not sleep

driver inclusion
category: bufgix
bugzilla: 12852
CVE: NA

When kcalloc uses GFP_KERNEL, if it encounters insufficient memory,
it will trigger sleep, so it may cause deadlock.
Modified to GFP_ATOMIC, if the request for memory fails,
it will be returned directly.
Signed-off-by: Nliuzhongzhu <liuzhongzhu@huawei.com>
Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 bfa56202
......@@ -303,7 +303,10 @@ static int hclge_mac_update_stats_complete(struct hclge_dev *hdev, u32 desc_num)
u16 i, k, n;
int ret;
desc = kcalloc(desc_num, sizeof(struct hclge_desc), GFP_KERNEL);
desc = kcalloc(desc_num, sizeof(struct hclge_desc), GFP_ATOMIC);
if (!desc)
return -ENOMEM;
hclge_cmd_setup_basic_desc(&desc[0], HCLGE_OPC_STATS_MAC_ALL, true);
ret = hclge_cmd_send(&hdev->hw, desc, desc_num);
if (ret) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册