mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
fuse.DeviceFD needs to hold a reference on the associated filesystem.
This fixes a use-after-free in fuse.DeviceFD.Release. PiperOrigin-RevId: 332394146
This commit is contained in:
committed by
gVisor bot
parent
2fbd31e726
commit
07d832dbb5
@@ -95,9 +95,14 @@ type DeviceFD struct {
|
||||
}
|
||||
|
||||
// Release implements vfs.FileDescriptionImpl.Release.
|
||||
func (fd *DeviceFD) Release(context.Context) {
|
||||
func (fd *DeviceFD) Release(ctx context.Context) {
|
||||
if fd.fs != nil {
|
||||
fd.fs.conn.mu.Lock()
|
||||
fd.fs.conn.connected = false
|
||||
fd.fs.conn.mu.Unlock()
|
||||
|
||||
fd.fs.VFSFilesystem().DecRef(ctx)
|
||||
fd.fs = nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -218,6 +218,7 @@ func newFUSEFilesystem(ctx context.Context, devMinor uint32, opts *filesystemOpt
|
||||
conn: conn,
|
||||
}
|
||||
|
||||
fs.VFSFilesystem().IncRef()
|
||||
fuseFD.fs = fs
|
||||
|
||||
return fs, nil
|
||||
|
||||
Reference in New Issue
Block a user