Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1653799

[PATCH] iscsi: Fix a sleep-in-atomic bug

From Jia-Ju Bai <baijiaju1990@163.com>
Newsgroups linux.kernel
Subject [PATCH] iscsi: Fix a sleep-in-atomic bug
Date 2017-05-31 05:30 +0200
Message-ID <tN2uB-7Lw-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


The driver may sleep under a spin lock, and the function call path is:
iscsit_tpg_enable_portal_group (acquire the lock by spin_lock)
  iscsi_update_param_value
    kstrdup(GFP_KERNEL) --> may sleep

To fix it, the "GFP_KERNEL" is replaced with "GFP_ATOMIC".

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
---
 drivers/target/iscsi/iscsi_target_parameters.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c
index fce6276..8768916 100644
--- a/drivers/target/iscsi/iscsi_target_parameters.c
+++ b/drivers/target/iscsi/iscsi_target_parameters.c
@@ -702,7 +702,7 @@ int iscsi_update_param_value(struct iscsi_param *param, char *value)
 {
 	kfree(param->value);
 
-	param->value = kstrdup(value, GFP_KERNEL);
+	param->value = kstrdup(value, GFP_ATOMIC);
 	if (!param->value) {
 		pr_err("Unable to allocate memory for value.\n");
 		return -ENOMEM;
-- 
1.7.9.5

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] iscsi: Fix a sleep-in-atomic bug Jia-Ju Bai <baijiaju1990@163.com> - 2017-05-31 05:30 +0200
  Re: [PATCH] iscsi: Fix a sleep-in-atomic bug "Nicholas A. Bellinger" <nab@linux-iscsi.org> - 2017-06-01 08:30 +0200
    Re: [PATCH] iscsi: Fix a sleep-in-atomic bug Jia-Ju Bai <baijiaju1990@163.com> - 2017-06-02 03:20 +0200
      Re: [PATCH] iscsi: Fix a sleep-in-atomic bug "Nicholas A. Bellinger" <nab@linux-iscsi.org> - 2017-06-02 05:30 +0200

csiph-web