mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
tmpfs: make sure that a dentry will not be destroyed before the open() call
If we don't hold a reference, the dentry can be destroyed by another thread. Reported-by: syzbot+f2132e50060c41f6d41f@syzkaller.appspotmail.com PiperOrigin-RevId: 342951940
This commit is contained in:
@@ -381,6 +381,8 @@ afterTrailingSymlink:
|
||||
creds := rp.Credentials()
|
||||
child := fs.newDentry(fs.newRegularFile(creds.EffectiveKUID, creds.EffectiveKGID, opts.Mode))
|
||||
parentDir.insertChildLocked(child, name)
|
||||
child.IncRef()
|
||||
defer child.DecRef(ctx)
|
||||
unlock()
|
||||
fd, err := child.open(ctx, rp, &opts, true)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user