01 Dec, 2018

1 commit

  • hfs_bmap_free() frees node via hfs_bnode_put(node). However it then
    reads node->this when dumping error message on an error path, which may
    result in a use-after-free bug. This patch frees node only when it is
    never used.

    Link: http://lkml.kernel.org/r/1543053441-66942-1-git-send-email-bianpan2016@163.com
    Signed-off-by: Pan Bian
    Reviewed-by: Andrew Morton
    Cc: Ernesto A. Fernandez
    Cc: Joe Perches
    Cc: Viacheslav Dubeyko
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Pan Bian
     

31 Oct, 2018

1 commit

  • Inserting or deleting a record in a btree may require splitting several of
    its nodes. If we hit ENOSPC halfway through, the new nodes will be left
    orphaned and their records will be lost. This could mean lost inodes,
    extents or xattrs.

    Henceforth, check the available disk space before making any changes.
    This still leaves the potential problem of corruption on ENOMEM.

    The patch can be tested with xfstests generic/027.

    Link: http://lkml.kernel.org/r/4596eef22fbda137b4ffa0272d92f0da15364421.1536269129.git.ernesto.mnd.fernandez@gmail.com
    Signed-off-by: Ernesto A. Fernández
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ernesto A. Fernández
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

05 Apr, 2016

1 commit

  • PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
    ago with promise that one day it will be possible to implement page
    cache with bigger chunks than PAGE_SIZE.

    This promise never materialized. And unlikely will.

    We have many places where PAGE_CACHE_SIZE assumed to be equal to
    PAGE_SIZE. And it's constant source of confusion on whether
    PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
    especially on the border between fs and mm.

    Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
    breakage to be doable.

    Let's stop pretending that pages in page cache are special. They are
    not.

    The changes are pretty straight-forward:

    - << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> ;

    - >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> ;

    - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};

    - page_cache_get() -> get_page();

    - page_cache_release() -> put_page();

    This patch contains automated changes generated with coccinelle using
    script below. For some reason, coccinelle doesn't patch header files.
    I've called spatch for them manually.

    The only adjustment after coccinelle is revert of changes to
    PAGE_CAHCE_ALIGN definition: we are going to drop it later.

    There are few places in the code where coccinelle didn't reach. I'll
    fix them manually in a separate patch. Comments and documentation also
    will be addressed with the separate patch.

    virtual patch

    @@
    expression E;
    @@
    - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
    + E

    @@
    expression E;
    @@
    - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
    + E

    @@
    @@
    - PAGE_CACHE_SHIFT
    + PAGE_SHIFT

    @@
    @@
    - PAGE_CACHE_SIZE
    + PAGE_SIZE

    @@
    @@
    - PAGE_CACHE_MASK
    + PAGE_MASK

    @@
    expression E;
    @@
    - PAGE_CACHE_ALIGN(E)
    + PAGE_ALIGN(E)

    @@
    expression E;
    @@
    - page_cache_get(E)
    + get_page(E)

    @@
    expression E;
    @@
    - page_cache_release(E)
    + put_page(E)

    Signed-off-by: Kirill A. Shutemov
    Acked-by: Michal Hocko
    Signed-off-by: Linus Torvalds

    Kirill A. Shutemov
     

07 Jun, 2014

1 commit

  • Zero newly allocated extents in the catalog tree if volume attributes
    tell us to. Not doing so we risk getting the "unused node is not
    erased" error. See kHFSUnusedNodeFix flag in Apple's source code for
    reference.

    There was a previous commit clearing the node when it is freed: commit
    899bed05e9f6 ("hfsplus: fix issue with unzeroed unused b-tree nodes").
    But it did not handle newly allocated extents (this patch fixes it).
    And it zeroed nodes in all trees unconditionally which is an overkill.

    This patch adds a condition and also switches to 'tree->node_size' as a
    simpler method of getting the length to zero.

    Signed-off-by: Sergei Antonov
    Cc: Anton Altaparmakov
    Cc: Al Viro
    Cc: Christoph Hellwig
    Cc: Vyacheslav Dubeyko
    Cc: Hin-Tak Leung
    Cc: Kyle Laracey
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sergei Antonov
     

13 Nov, 2013

1 commit

  • There are situation when HFS+ volume had been created without
    AttributesFile. Such situation can take place because of using old
    mkfs.hfs utility or creation HFS+ volume without taking in mind
    necessity to use xattrs. For example, Mac OS X 10.4 (Tiger) doesn't
    create AttributesFile during mkfs phase. Also it is a very frequent
    situation for the case of users that created HFS+ volumes under Linux.
    As a result, xattrs and POSIX ACLs on HFS+ volume are unavailable for
    such users.

    This patchset implements functionality of AttributesFile creation on
    HFS+ volume in the case of this metadata file absence during operation
    of xattr creation.

    This patch:

    Add functionality of metadata file's clump size calculation. Operation
    of AttributesFile creation needs in clump size setting. This value will
    be used when AttributesFile will be extended.

    This code is adopted from code of newfs_hfs utility of diskdev_cmds packet
    http://opensource.apple.com/tarballs/diskdev_cmds/.

    Signed-off-by: Vyacheslav Dubeyko
    Cc: Al Viro
    Cc: Christoph Hellwig
    Cc: Hin-Tak Leung
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vyacheslav Dubeyko
     

01 May, 2013

2 commits

  • Use a more current logging style.

    Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
    hfsplus now uses "hfsplus: " for all messages.
    Coalesce formats.
    Prefix debugging messages too.

    Signed-off-by: Joe Perches
    Cc: Vyacheslav Dubeyko
    Cc: Hin-Tak Leung
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Use a more current logging style.

    Rename macro and uses.
    Add do {} while (0) to macro.
    Add DBG_ to macro.
    Add and use hfs_dbg_cont variant where appropriate.

    Signed-off-by: Joe Perches
    Cc: Vyacheslav Dubeyko
    Cc: Hin-Tak Leung
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

28 Feb, 2013

1 commit


21 Dec, 2012

1 commit

  • Add to hfs_btree_write() a return of -EIO on failure of b-tree node
    searching. Also add logic ofor processing errors from hfs_btree_write()
    in hfsplus_system_write_inode() with a message about b-tree writing
    failure.

    [akpm@linux-foundation.org: reduce scope of `err', print errno on error]
    Signed-off-by: Vyacheslav Dubeyko
    Cc: Christoph Hellwig
    Cc: Al Viro
    Acked-by: Hin-Tak Leung
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vyacheslav Dubeyko