summaryrefslogtreecommitdiff
path: root/arch/powerpc/platforms/cell/spufs/coredump.c
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2007-09-19 14:38:12 +1000
committerPaul Mackerras <paulus@samba.org>2007-09-19 15:12:19 +1000
commit9e25ae6d91e7fb058c8957c2a64dc3ca0377dd5b (patch)
treef7bec2069ae5df356f959df3aad82d44a493066e /arch/powerpc/platforms/cell/spufs/coredump.c
parent7af1443a9d319132087e1e9a3984b94c6998835c (diff)
[POWERPC] spufs: Respect RLIMIT_CORE in spu coredump code
Currently the spu coredump code doesn't respect the ulimit, it should. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/coredump.c')
-rw-r--r--arch/powerpc/platforms/cell/spufs/coredump.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c
index 6b8aef6d7e68..80f62363e1ce 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -53,8 +53,12 @@ static ssize_t do_coredump_read(int num, struct spu_context *ctx, void *buffer,
*/
static int spufs_dump_write(struct file *file, const void *addr, int nr, loff_t *foffset)
{
+ unsigned long limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
ssize_t written;
+ if (*foffset + nr > limit)
+ return -EIO;
+
written = file->f_op->write(file, addr, nr, &file->f_pos);
*foffset += written;