Kernel: Fix unix socket recv from
If connection on unix socket was closed and other end tries to recvfrom, the thread would enter a fucked up state where it held the socket's spinlock when returning to userspace.
This commit is contained in:
parent
cfeabc4580
commit
0f189d410e
|
@ -394,9 +394,15 @@ namespace Kernel
|
||||||
auto& connection_info = m_info.get<ConnectionInfo>();
|
auto& connection_info = m_info.get<ConnectionInfo>();
|
||||||
bool expected = true;
|
bool expected = true;
|
||||||
if (connection_info.target_closed.compare_exchange(expected, false))
|
if (connection_info.target_closed.compare_exchange(expected, false))
|
||||||
|
{
|
||||||
|
m_packet_lock.unlock(state);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
if (!connection_info.connection)
|
if (!connection_info.connection)
|
||||||
|
{
|
||||||
|
m_packet_lock.unlock(state);
|
||||||
return BAN::Error::from_errno(ENOTCONN);
|
return BAN::Error::from_errno(ENOTCONN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_packet_lock.unlock(state);
|
m_packet_lock.unlock(state);
|
||||||
|
|
Loading…
Reference in New Issue