scst: fix possible NULL dereference in TM code

TM command accessing a non-existing LUN might lead NULL dereference in
scst_call_dev_task_mgmt_fn_done().

Reported-By: <Ilan Steinberg <ilan.steinberg@kaminario.com>>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7190 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2017-05-20 03:00:28 +00:00
parent b3758b0db9
commit 36f2612eb1

View File

@@ -7393,7 +7393,8 @@ static int scst_mgmt_affected_cmds_done(struct scst_mgmt_cmd *mcmd)
case SCST_CLEAR_TASK_SET:
case SCST_PR_ABORT_ALL:
case SCST_LUN_RESET:
scst_call_dev_task_mgmt_fn_done(mcmd, mcmd->mcmd_tgt_dev);
if (mcmd->mcmd_tgt_dev != NULL)
scst_call_dev_task_mgmt_fn_done(mcmd, mcmd->mcmd_tgt_dev);
break;
case SCST_TARGET_RESET: