mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
kernel: GetMountNamespace has to check that mntns isn't nil
Reported-by: syzbot+e21bed832e505430bb27@syzkaller.appspotmail.com PiperOrigin-RevId: 553568085
This commit is contained in:
@@ -795,8 +795,11 @@ func (t *Task) MountNamespace() *vfs.MountNamespace {
|
||||
func (t *Task) GetMountNamespace() *vfs.MountNamespace {
|
||||
t.mu.Lock()
|
||||
defer t.mu.Unlock()
|
||||
t.mountNamespace.IncRef()
|
||||
return t.mountNamespace
|
||||
mntns := t.mountNamespace
|
||||
if mntns != nil {
|
||||
mntns.IncRef()
|
||||
}
|
||||
return mntns
|
||||
}
|
||||
|
||||
// AbstractSockets returns t's AbstractSocketNamespace.
|
||||
|
||||
@@ -288,12 +288,11 @@ func (*runExitMain) execute(t *Task) taskRunState {
|
||||
mntns := t.mountNamespace
|
||||
t.mountNamespace = nil
|
||||
ipcns := t.ipcns
|
||||
t.ipcns = nil
|
||||
netns := t.netns
|
||||
t.netns = nil
|
||||
t.mu.Unlock()
|
||||
if mntns != nil {
|
||||
mntns.DecRef(t)
|
||||
}
|
||||
mntns.DecRef(t)
|
||||
ipcns.DecRef(t)
|
||||
netns.DecRef(t)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user