Page MenuHomeFreeBSD

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

Authored by afedorov on Apr 27 2020, 11:13 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 19, 10:22 AM
Unknown Object (File)
Tue, Dec 10, 5:33 AM
Unknown Object (File)
Nov 22 2024, 11:55 PM
Unknown Object (File)
Oct 5 2024, 12:01 AM
Unknown Object (File)
Oct 3 2024, 2:52 PM
Unknown Object (File)
Oct 1 2024, 9:15 AM
Unknown Object (File)
Sep 27 2024, 5:25 PM
Unknown Object (File)
Sep 17 2024, 12:14 AM
Subscribers

Details

Summary

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: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=244792
And debug output: https://bz-attachments.freebsd.org/attachment.cgi?id=212383

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
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.

+1
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.