All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iscsi: Fix a sleep-in-atomic bug
@ 2017-05-31  3:26 Jia-Ju Bai
  2017-06-01  6:21 ` Nicholas A. Bellinger
  0 siblings, 1 reply; 4+ messages in thread
From: Jia-Ju Bai @ 2017-05-31  3:26 UTC (permalink / raw)
  To: nab, bart.vanassche, davem, hare, elfring
  Cc: linux-scsi, target-devel, linux-kernel, Jia-Ju Bai

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-02  3:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-31  3:26 [PATCH] iscsi: Fix a sleep-in-atomic bug Jia-Ju Bai
2017-06-01  6:21 ` Nicholas A. Bellinger
2017-06-02  1:13   ` Jia-Ju Bai
2017-06-02  3:20     ` Nicholas A. Bellinger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.