diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-05-14 05:06:29 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-15 09:01:32 +0200 |
commit | a324d4d6a342ad6847697c32f127c31ea76f6e61 (patch) | |
tree | 8e5b1cbeeedf8b9b66e35f35cd248e61cbd9e5d3 /Kernel/VM/ScatterGatherList.h | |
parent | d45db06826461886b69a832ae34f933d3b613fc7 (diff) | |
download | serenity-a324d4d6a342ad6847697c32f127c31ea76f6e61.zip |
Kernel: Make AnonymousVMObject physical page APIs OOM safe
AnonymousVMObject::create_with_physical_page(s) can't be NonnullRefPtr
as it allocates internally. Fixing the API then surfaced an issue in
ScatterGatherList, where the code was attempting to create an
AnonymousVMObject in the constructor which will not be observable
during OOM.
Fix all of these issues and start propagating errors at the callers
of the AnonymousVMObject and ScatterGatherList APis.
Diffstat (limited to 'Kernel/VM/ScatterGatherList.h')
-rw-r--r-- | Kernel/VM/ScatterGatherList.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/VM/ScatterGatherList.h b/Kernel/VM/ScatterGatherList.h index 0d94cbcfa2..9998d677d4 100644 --- a/Kernel/VM/ScatterGatherList.h +++ b/Kernel/VM/ScatterGatherList.h @@ -18,13 +18,13 @@ namespace Kernel { class ScatterGatherList : public RefCounted<ScatterGatherList> { public: - static NonnullRefPtr<ScatterGatherList> create(AsyncBlockDeviceRequest&, NonnullRefPtrVector<PhysicalPage> allocated_pages, size_t device_block_size); + static RefPtr<ScatterGatherList> create(AsyncBlockDeviceRequest&, NonnullRefPtrVector<PhysicalPage> allocated_pages, size_t device_block_size); const VMObject& vmobject() const { return m_vm_object; } VirtualAddress dma_region() const { return m_dma_region->vaddr(); } size_t scatters_count() const { return m_vm_object->physical_pages().size(); } private: - ScatterGatherList(AsyncBlockDeviceRequest&, NonnullRefPtrVector<PhysicalPage> allocated_pages, size_t device_block_size); + ScatterGatherList(NonnullRefPtr<AnonymousVMObject>, AsyncBlockDeviceRequest&, size_t device_block_size); NonnullRefPtr<AnonymousVMObject> m_vm_object; OwnPtr<Region> m_dma_region; }; |