mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:57:43 +00:00
Kernel: Handle OOM when allocating Packet KBuffers
This commit is contained in:
parent
8c4785bd10
commit
720a686a76
6 changed files with 47 additions and 38 deletions
|
@ -241,11 +241,11 @@ KResultOr<size_t> IPv4Socket::sendto(FileDescription&, const UserOrKernelBuffer&
|
|||
return ENOMEM;
|
||||
routing_decision.adapter->fill_in_ipv4_header(*packet, local_address(), routing_decision.next_hop,
|
||||
m_peer_address, (IPv4Protocol)protocol(), data_length, m_ttl);
|
||||
if (!data.read(packet->buffer.data() + ipv4_payload_offset, data_length)) {
|
||||
if (!data.read(packet->buffer->data() + ipv4_payload_offset, data_length)) {
|
||||
routing_decision.adapter->release_packet_buffer(*packet);
|
||||
return EFAULT;
|
||||
}
|
||||
routing_decision.adapter->send_packet({ packet->buffer.data(), packet->buffer.size() });
|
||||
routing_decision.adapter->send_packet(packet->bytes());
|
||||
routing_decision.adapter->release_packet_buffer(*packet);
|
||||
return data_length;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue