From 39501888025bad849d4b1bfa6123052cc9d891cc Mon Sep 17 00:00:00 2001 From: Guixin Liu Date: Mon, 4 Mar 2024 19:44:39 +0800 Subject: [PATCH] anolis: scsi: target: tcmu: fix possible mem reclaim recursion ANBZ: #8438 Prevent recursion into the IO path under low memory conditions by using GFP_NOIO in place of GFP_KERNEL when allocating a new command with tcmu_alloc_cmd(). Fixes: 1ebc514bd97e9 ("anolis: scsi:target: reduce one copy by using uio ioctl") Signed-off-by: Guixin Liu --- drivers/target/target_core_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index bf0289224856..370217610532 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -790,7 +790,7 @@ static struct tcmu_cmd *tcmu_alloc_cmd(struct se_cmd *se_cmd) if (zero_copy || !bypass_data_area) { tcmu_cmd_set_block_cnts(tcmu_cmd); tcmu_cmd->dbi = kcalloc(tcmu_cmd->dbi_cnt, sizeof(uint32_t), - GFP_KERNEL); + GFP_NOIO); if (!tcmu_cmd->dbi) { kmem_cache_free(tcmu_cmd_cache, tcmu_cmd); return NULL; -- Gitee