Page MenuHomeFreeBSD

[iscsi] Fix initiator kernel panic if target ctl(4) port is disabled

Authored by afedorov on Apr 27 2020, 11:13 AM.



If the target ctl(4) port is disabled using ctladm -p X -o off, the initiator creates incomplete sessions that lead to panic when calling 'ctladm islist'.

See detailed description:
And debug output:

Diff Detail

rS FreeBSD src repository - subversion
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

I think this looks right, but I think there are other places that also need the lock perhaps? I think there's at least one other place that does these two statements without holding the session lock when I looked.

There are more places where the cv_signal(cs->xxx) is not called with the cs lock held. We could take the chance and fix them all.

mav requested changes to this revision.EditedApr 30 2020, 8:17 PM

I think it is correct, except the same should be added also 48 lines lower.

But also looking on cfiscsi_ioctl_list() I am curios why (cs->cs_target == NULL) there is under #ifdef ICL_KERNEL_PROXY? Without one defined there is still a chance to crash before maintenance thread call cfiscsi_session_delete(). I think the ifdef should be removed.

This revision now requires changes to proceed.Apr 30 2020, 8:17 PM

I will try to fix all the places.

This revision was not accepted when it landed; it landed in state Needs Revision.May 3 2020, 4:15 PM
This revision was automatically updated to reflect the committed changes.