lkml.org 
[lkml]   [2012]   [Jun]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[ 27/61] hfsplus: fix bless ioctl when used with hardlinks
    3.4-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Matthew Garrett <mjg@redhat.com>

    commit 7dea9665fee828fb56db3bae5b9685d9fa006d33 upstream.

    HFS+ doesn't really implement hard links - instead, hardlinks are indicated
    by a magic file type which refers to an indirect node in a hidden
    directory. The spec indicates that stat() should return the inode number
    of the indirect node, but it turns out that this doesn't satisfy the
    firmware when it's looking for a bootloader - it wants the catalog ID of
    the hardlink file instead. Fix up this case.

    Signed-off-by: Matthew Garrett <mjg@redhat.com>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    fs/hfsplus/ioctl.c | 9 +++++++--
    1 file changed, 7 insertions(+), 2 deletions(-)

    --- a/fs/hfsplus/ioctl.c
    +++ b/fs/hfsplus/ioctl.c
    @@ -31,6 +31,7 @@ static int hfsplus_ioctl_bless(struct fi
    struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb);
    struct hfsplus_vh *vh = sbi->s_vhdr;
    struct hfsplus_vh *bvh = sbi->s_backup_vhdr;
    + u32 cnid = (unsigned long)dentry->d_fsdata;

    if (!capable(CAP_SYS_ADMIN))
    return -EPERM;
    @@ -41,8 +42,12 @@ static int hfsplus_ioctl_bless(struct fi
    vh->finder_info[0] = bvh->finder_info[0] =
    cpu_to_be32(parent_ino(dentry));

    - /* Bootloader */
    - vh->finder_info[1] = bvh->finder_info[1] = cpu_to_be32(inode->i_ino);
    + /*
    + * Bootloader. Just using the inode here breaks in the case of
    + * hard links - the firmware wants the ID of the hard link file,
    + * but the inode points at the indirect inode
    + */
    + vh->finder_info[1] = bvh->finder_info[1] = cpu_to_be32(cnid);

    /* Per spec, the OS X system folder - same as finder_info[0] here */
    vh->finder_info[5] = bvh->finder_info[5] =



    \
     
     \ /
      Last update: 2012-06-20 21:01    [W:4.096 / U:0.004 seconds]
    ©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site