fasync: release the FileAsync mutex before sending the signal

Reported-by: syzbot+dd952ecd2e4147d69edb@syzkaller.appspotmail.com
Reported-by: syzbot+d9a2afb847ffabe49fbe@syzkaller.appspotmail.com
PiperOrigin-RevId: 537942317
This commit is contained in:
Andrei Vagin
2023-06-05 12:01:47 -07:00
committed by gVisor bot
parent 7fa1ad8840
commit f3d87d3be1
+9 -4
View File
@@ -85,12 +85,12 @@ type FileAsync struct {
recipientT *kernel.Task
}
// NotifyEvent implements waiter.EventListener.NotifyEvent.
func (a *FileAsync) NotifyEvent(mask waiter.EventMask) {
func (a *FileAsync) recipient() *kernel.Task {
a.mu.Lock()
defer a.mu.Unlock()
if !a.registered {
return
// No recipient has been registered.
return nil
}
t := a.recipientT
tg := a.recipientTG
@@ -100,8 +100,13 @@ func (a *FileAsync) NotifyEvent(mask waiter.EventMask) {
if tg != nil {
t = tg.Leader()
}
return t
}
// NotifyEvent implements waiter.EventListener.NotifyEvent.
func (a *FileAsync) NotifyEvent(mask waiter.EventMask) {
t := a.recipient()
if t == nil {
// No recipient has been registered.
return
}
c := t.Credentials()