mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 09:11:27 +00:00
iscsi-scst: handle a case in target_del() where the target was already freed
target_del() calls handle_iscsi_events() which may recursively call target_del(). The 1st target_del() may resume its execution after the target object was already freed. Signed-off-by: Erez Zilber <erezzi.list@gmail.com> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6908 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -357,6 +357,13 @@ int target_del(u32 tid, u32 cookie)
|
||||
/* We might need to handle session(s) removal event(s) from the kernel */
|
||||
while (handle_iscsi_events(nl_fd, false) == 0);
|
||||
|
||||
/* Someone else may have already freed the target object by now. */
|
||||
target = target_find_by_id(tid);
|
||||
if (!target) {
|
||||
log_info("%s: the target with tid = %u was already freed", __func__, tid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (list_empty(&target->sessions_list))
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user