network/protocols/unix: Recheck fShutdown{Read|Write} before socket notify.

They may have changed, and we must not use the socket object if they
are set.

Related to #18535.
This commit is contained in:
Augustin Cavalier
2023-08-04 12:59:15 -04:00
parent 967ab75d8e
commit 5590a8194b
@@ -288,14 +288,16 @@ UnixDatagramEndpoint::Send(const iovec* vecs, size_t vecCount,
fifoLocker.Unlock();
targetLocker.Lock();
if (notifyRead)
// We must recheck fShutdownRead after reacquiring the lock, as it may have changed.
if (notifyRead && !targetEndpoint->fShutdownRead)
gSocketModule->notify(targetEndpoint->socket, B_SELECT_READ, readable);
targetLocker.Unlock();
if (notifyWrite) {
endpointLocker.Lock();
gSocketModule->notify(socket, B_SELECT_WRITE, writable);
if (!fShutdownWrite)
gSocketModule->notify(socket, B_SELECT_WRITE, writable);
}
switch (result) {