fix: prevent nil deref on session reinstatement during cleanup race
When a new login arrives while the previous connection's async cleanup is still running, LookupISCSISession finds the stale session but LookupConnection returns nil (old connection already closed). This caused a nil pointer dereference when accessing existConn.session during session reinstatement. Fix by checking existConn != nil before reinstatement. If the old connection is already gone, unbind the stale session and create a fresh one instead. Also add sync.Once to removeConnectionFromSession to prevent concurrent goroutine and main-path cleanup from racing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -88,7 +88,8 @@ type iscsiConnection struct {
|
||||
rxTask *iscsiTask
|
||||
txTask *iscsiTask
|
||||
|
||||
readLock *sync.RWMutex
|
||||
readLock *sync.RWMutex
|
||||
cleanupOnce sync.Once
|
||||
}
|
||||
|
||||
type taskState int
|
||||
|
||||
Reference in New Issue
Block a user