Re: [PATCH] Possible race in sysfs_read_file() and sysfs_write_file()

From: Andrew Morton (akpm_at_osdl.org)
Date: 09/03/04

  • Next message: viro_at_parcelfarce.linux.theplanet.co.uk: "Re: The argument for fs assistance in handling archives (was: silent semantic changes with reiser4)"
    Date:	Thu, 2 Sep 2004 15:57:58 -0700
    To: Simon Derr <Simon.Derr@bull.net>
    
    

    Simon Derr <Simon.Derr@bull.net> wrote:
    >
    > @@ -140,13 +145,17 @@
    > struct sysfs_buffer * buffer = file->private_data;
    > ssize_t retval = 0;
    >
    > - if (!*ppos) {
    > + down(&buffer->sem);
    > + if ((!*ppos) || (!buffer->page)) {
    > if ((retval = fill_read_buffer(file->f_dentry,buffer)))
    > - return retval;
    > + goto out;

    Why are we testing *ppos at all in here?
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: viro_at_parcelfarce.linux.theplanet.co.uk: "Re: The argument for fs assistance in handling archives (was: silent semantic changes with reiser4)"

    Relevant Pages

    • [PATCH] mpcore_wdt.c bogus fpos check
      ... (ppos!= &file->f_pos). ... Such check used to make sense when a pointer to ... send the line "unsubscribe linux-kernel" in ... Please read the FAQ at http://www.tux.org/lkml/ ...
      (Linux-Kernel)
    • Re: sys_sendfile oops in 2.6.13?
      ... > That change can't fix a bug in 2.6.13, because ppos is forced to be ... Perhaps your patches? ... I'll find the patch that did the change ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: do_sendfile ppos check ...
      ... hmm, why a different max than with offset? ... the 'unnecessary' check (*ppos) would be a better ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: do_sendfile ppos check ...
      ... > currently investigating ... ... Look at the top of the do_sendfile function, it sets ppos if it is NULL. ... send the line "unsubscribe linux-kernel" in ... Please read the FAQ at http://www.tux.org/lkml/ ...
      (Linux-Kernel)
    • [PATCH 04/12] HPPFS: fix access to ppos and file->f_pos
      ... Also, this code is still in the pre-2.6.8 world, when ppos was compared ... there's no race as the fd has not yet been returned to userspace. ... static struct inode_operations hppfs_file_iops = { ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)