mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
splice: compare inode numbers only if both ends are pipes
It isn't allowed to splice data from and into the same pipe. But right now this check is broken, because we don't check that both ends are pipes. PiperOrigin-RevId: 272107022
This commit is contained in:
@@ -245,12 +245,12 @@ func Splice(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscal
|
||||
if inOffset != 0 || outOffset != 0 {
|
||||
return 0, nil, syserror.ESPIPE
|
||||
}
|
||||
default:
|
||||
return 0, nil, syserror.EINVAL
|
||||
}
|
||||
|
||||
// We may not refer to the same pipe; otherwise it's a continuous loop.
|
||||
if inFile.Dirent.Inode.StableAttr.InodeID == outFile.Dirent.Inode.StableAttr.InodeID {
|
||||
// We may not refer to the same pipe; otherwise it's a continuous loop.
|
||||
if inFile.Dirent.Inode.StableAttr.InodeID == outFile.Dirent.Inode.StableAttr.InodeID {
|
||||
return 0, nil, syserror.EINVAL
|
||||
}
|
||||
default:
|
||||
return 0, nil, syserror.EINVAL
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user