mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-04 05:19:58 +03:00
Kernel: Don't update write_pos in DoubleBuffer if userspace copy fails
This commit is contained in:
parent
c3b670c092
commit
63a1be1406
Notes:
sideshowbarker
2024-07-18 17:50:38 +09:00
Author: https://github.com/ccapitalK Commit: https://github.com/SerenityOS/serenity/commit/63a1be14066 Pull-request: https://github.com/SerenityOS/serenity/pull/7070 Issue: https://github.com/SerenityOS/serenity/issues/7069
@ -47,10 +47,10 @@ ssize_t DoubleBuffer::write(const UserOrKernelBuffer& data, size_t size)
|
||||
Locker locker(m_lock);
|
||||
size_t bytes_to_write = min(size, m_space_for_writing);
|
||||
u8* write_ptr = m_write_buffer->data + m_write_buffer->size;
|
||||
m_write_buffer->size += bytes_to_write;
|
||||
compute_lockfree_metadata();
|
||||
if (!data.read(write_ptr, bytes_to_write))
|
||||
return -EFAULT;
|
||||
m_write_buffer->size += bytes_to_write;
|
||||
compute_lockfree_metadata();
|
||||
if (m_unblock_callback && !m_empty)
|
||||
m_unblock_callback();
|
||||
return (ssize_t)bytes_to_write;
|
||||
|
Loading…
Reference in New Issue
Block a user