lkml.org 
[lkml]   [2010]   [Dec]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] gen_init_cpio: Avoid race between call to stat() and call to open()
On 12/24/2010 03:28 PM, Jesper Juhl wrote:
> Hi,
>
> In usr/gen_init_cpio.c::cpio_mkfile() a call to stat() is made based on
> pathname, subsequently the file is open()'ed and then the value of the
> initial stat() call is used to allocate a buffer. This is not safe since
> the file may change between the call to stat() and the call to open().
> Safer to just open() the file and then do fstat() using the filedescriptor
> returned by open.
>
>
> Signed-off-by: Jesper Juhl<jj@chaosbits.net>

Acked-by: Jeff Garzik <jgarzik@redhat.com>




\
 
 \ /
  Last update: 2010-12-24 23:37    [W:0.065 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site