summaryrefslogtreecommitdiff
path: root/arch/powerpc/platforms/cell/spufs/syscalls.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2006-01-04 20:31:23 +0100
committerPaul Mackerras <paulus@samba.org>2006-01-09 15:44:38 +1100
commite80358ad8606382154d97165121602dfae213e4a (patch)
treeb63e3e21cd0f4c1c086f958d05c6fa3298408746 /arch/powerpc/platforms/cell/spufs/syscalls.c
parentc8ca0633e5f2bceab7b4eba4475820fd7674dece (diff)
[PATCH] spufs: check for proper file pointer in sys_spu_run
Only checking for SPUFS_MAGIC is not reliable, because it might not be unique in theory. Worse than that, we accidentally allow spu_run to be performed on any file in spufs, not just those returned from spu_create as intended. Noticed by Al Viro. Signed-off-by: Arnd Bergmann <arndb@de.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/syscalls.c')
-rw-r--r--arch/powerpc/platforms/cell/spufs/syscalls.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c
index 17a2b51c94bc..0c2896ac9518 100644
--- a/arch/powerpc/platforms/cell/spufs/syscalls.c
+++ b/arch/powerpc/platforms/cell/spufs/syscalls.c
@@ -39,8 +39,9 @@ long do_spu_run(struct file *filp, __u32 __user *unpc, __u32 __user *ustatus)
if (get_user(npc, unpc) || get_user(status, ustatus))
goto out;
+ /* check if this file was created by spu_create */
ret = -EINVAL;
- if (filp->f_vfsmnt->mnt_sb->s_magic != SPUFS_MAGIC)
+ if (filp->f_op != &spufs_context_fops)
goto out;
i = SPUFS_I(filp->f_dentry->d_inode);