AddSeals has to take the write lock to modify seals

Reported-by: syzbot+355993d42d99b011ea73@syzkaller.appspotmail.com
Reported-by: syzbot+f758f7983773e0a60c7b@syzkaller.appspotmail.com
PiperOrigin-RevId: 488764524
This commit is contained in:
Andrei Vagin
2022-11-15 14:49:20 -08:00
committed by gVisor bot
parent b4e810c944
commit 374e716c7c
+2 -2
View File
@@ -778,8 +778,8 @@ func AddSeals(fd *vfs.FileDescription, val uint32) error {
rf := f.inode().impl.(*regularFile)
rf.mapsMu.Lock()
defer rf.mapsMu.Unlock()
rf.dataMu.RLock()
defer rf.dataMu.RUnlock()
rf.dataMu.Lock()
defer rf.dataMu.Unlock()
if rf.seals&linux.F_SEAL_SEAL != 0 {
// Seal applied which prevents addition of any new seals.