mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:57:43 +00:00
Kernel: Get RefPtr<Device> from the DeviceManagement::get_device method
Instead of returning a raw pointer, which could be technically invalid when using it in the caller function, we return a valid RefPtr of such device. This ensures that the code in DevPtsFS is now safe from a rare race condition in which the SlavePTY device is gone but we still have a pointer to it.
This commit is contained in:
parent
5dcf03ad9a
commit
11ead5c84f
6 changed files with 24 additions and 16 deletions
|
@ -23,7 +23,10 @@ public:
|
|||
DevPtsFS const& fs() const { return static_cast<DevPtsFS const&>(Inode::fs()); }
|
||||
|
||||
private:
|
||||
DevPtsFSInode(DevPtsFS&, InodeIndex, SlavePTY*);
|
||||
DevPtsFSInode(DevPtsFS&, InodeIndex, SlavePTY&);
|
||||
|
||||
// NOTE: This constructor is used for the root inode only.
|
||||
DevPtsFSInode(DevPtsFS&);
|
||||
|
||||
// ^Inode
|
||||
virtual ErrorOr<size_t> read_bytes_locked(off_t, size_t, UserOrKernelBuffer& buffer, OpenFileDescription*) const override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue