mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-21 06:36:27 +00:00
iscsi-scst, scst_local: Avoid that session reassignment triggers a crash
This patch fixes the following crash triggered by session reassignment when using a target driver that defines a report_aen callback in its target template (iscsi-scst and scst_local): BUG: unable to handle kernel NULL pointer dereference at 00000000000000c0 IP: [<ffffffffa0299e1f>] scst_alloc_aen+0xbf/0x220 [scst] RIP: 0010:[<ffffffffa0299e1f>] [<ffffffffa0299e1f>] scst_alloc_aen+0xbf/0x220 [scst] Call Trace: [<ffffffffa02a0aef>] scst_gen_aen_or_ua+0xff/0x2d0 [scst] [<ffffffffa02c3661>] scst_tg_change_tgt_dev_state+0x61/0xd0 [scst] [<ffffffffa02c428b>] scst_tg_init_tgt_dev+0x5b/0xa0 [scst] [<ffffffffa029c246>] scst_alloc_add_tgt_dev+0x686/0x750 [scst] [<ffffffffa02a2b57>] scst_check_reassign_sess+0x367/0x660 [scst] [<ffffffffa02a2ed8>] scst_check_reassign_sessions+0x88/0x140 [scst] [<ffffffffa02a323a>] scst_acg_add_acn+0x1ba/0x2b0 [scst] [<ffffffffa02a9fcf>] scst_process_acg_ini_mgmt_store+0x43f/0x570 [scst] [<ffffffffa02aa11e>] scst_acg_ini_mgmt_store_work_fn+0x1e/0x20 [scst] [<ffffffffa02b051f>] scst_process_sysfs_works+0xbf/0x190 [scst] [<ffffffffa02b07a0>] sysfs_work_thread_fn+0x110/0x2a0 [scst] [<ffffffff81069ea6>] kthread+0xd6/0xe0 [<ffffffff814debfc>] ret_from_fork+0x7c/0xb0 Signed-off-by: Bart Van Assche <bvanassche@acm.org> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5053 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
+1
-3
@@ -2486,7 +2486,7 @@ static void scst_check_reassign_sess(struct scst_session *sess)
|
||||
acg->acg_name);
|
||||
|
||||
old_acg = sess->acg;
|
||||
sess->acg = NULL; /* to catch implicit dependencies earlier */
|
||||
sess->acg = acg;
|
||||
|
||||
retry_add:
|
||||
add_failed = false;
|
||||
@@ -2559,8 +2559,6 @@ next:
|
||||
goto retry_add;
|
||||
}
|
||||
|
||||
sess->acg = acg;
|
||||
|
||||
TRACE_DBG("Moving sess %p from acg %s to acg %s", sess,
|
||||
old_acg->acg_name, acg->acg_name);
|
||||
list_move_tail(&sess->acg_sess_list_entry, &acg->acg_sess_list);
|
||||
|
||||
Reference in New Issue
Block a user