lkml.org 
[lkml]   [2012]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/2] proc: do not allow negative offsets on /proc/<pid>/environ
On 07/24, Djalal Harouni wrote:
>
> static int mem_open(struct inode *inode, struct file *file)
> {
> - return __mem_open(inode, file, PTRACE_MODE_ATTACH);
> + int ret = __mem_open(inode, file, PTRACE_MODE_ATTACH);
> +
> + /* OK to pass negative loff_t, we can catch out-of-range */
> + file->f_mode |= FMODE_UNSIGNED_OFFSET;
> +
> + return ret;
> }

It could be even simpler, I meant

file->f_mode |= FMODE_UNSIGNED_OFFSET;
return __mem_open(inode, file, PTRACE_MODE_ATTACH);

Never mind, this is very minor and the patch is already in -mm.

Oleg.



\
 
 \ /
  Last update: 2012-07-25 15:01    [W:0.079 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site