Re: 2.6.0-test4-mm3.1 oops with ext3 extended attributes on R/O filesystem

From: Andrew Morton (akpm_at_osdl.org)
Date: 08/31/03

  • Next message: David S. Miller: "Re: x86, ARM, PARISC, PPC, MIPS and Sparc folks please run this"
    Date:	Sat, 30 Aug 2003 21:47:51 -0700
    To: Valdis.Kletnieks@vt.edu
    
    

    Valdis.Kletnieks@vt.edu wrote:
    >
    > Working on installing SELINUX, and I get to the part where all the file labels
    > get added. Unfortunately, I had some file systems mounted R/O (intentionally,
    > forgot to mount them R/W for this). The ext3 code upchucked while trying
    > to set extended attributes on the filesystem it couldn't write to.

    Thanks. It's a very straightforward bug; I'll fix it with the below patch.

    A wider question is whether we should have got this far into the filesystem
    code if the fs is mounted read-only. A check right up at the VFS
    setxattr() level might make sense.

    Regardless of that, this fix is needed because journal_start() could fail
    for other reasons.

    diff -puN fs/ext3/xattr.c~ext3-xattr-oops-fix fs/ext3/xattr.c
    --- 25/fs/ext3/xattr.c~ext3-xattr-oops-fix 2003-08-30 21:41:24.000000000 -0700
    +++ 25-akpm/fs/ext3/xattr.c 2003-08-30 21:42:41.000000000 -0700
    @@ -873,17 +873,22 @@ ext3_xattr_set(struct inode *inode, int
                    const void *value, size_t value_len, int flags)
     {
             handle_t *handle;
    - int error, error2;
    + int error;
     
             handle = ext3_journal_start(inode, EXT3_DATA_TRANS_BLOCKS);
    - if (IS_ERR(handle))
    + if (IS_ERR(handle)) {
                     error = PTR_ERR(handle);
    - else
    + } else {
    + int error2;
    +
                     error = ext3_xattr_set_handle(handle, inode, name_index, name,
                                                   value, value_len, flags);
    - error2 = ext3_journal_stop(handle);
    + error2 = ext3_journal_stop(handle);
    + if (error == 0)
    + error = error2;
    + }
     
    - return error ? error : error2;
    + return error;
     }
     
     /*

    _

    -
    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: David S. Miller: "Re: x86, ARM, PARISC, PPC, MIPS and Sparc folks please run this"

    Relevant Pages

    • [PATCH] tmpfs surplus page miscounted
      ... primed page cache with a tmpfs page, but the subsequent shmem_readpage ... or shmem_prepare_write failed because filesystem max size was exceeded: ... and just fix this up within shmem.c: ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 2.6.0-test4-mm3.1 oops with ext3 extended attributes on R/O filesystem
      ... and I get to the part where all the file labels ... it should happen below the xattr handler level, ... SuSE Labs, SuSE Linux AG ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)