19 Sep, 2020

1 commit


05 Jun, 2020

1 commit

  • If FAT length == 0, the image doesn't have any data. And it can be the
    cause of overlapping the root dir and FAT entries.

    Also Windows treats it as invalid format.

    Reported-by: syzbot+6f1624f937d9d6911e2d@syzkaller.appspotmail.com
    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Cc: Marco Elver
    Cc: Dmitry Vyukov
    Link: http://lkml.kernel.org/r/87r1wz8mrd.fsf@mail.parknet.co.jp
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

03 Jun, 2020

1 commit

  • Implement the new readahead aop and convert all callers (block_dev,
    exfat, ext2, fat, gfs2, hpfs, isofs, jfs, nilfs2, ocfs2, omfs, qnx6,
    reiserfs & udf).

    The callers are all trivial except for GFS2 & OCFS2.

    Signed-off-by: Matthew Wilcox (Oracle)
    Signed-off-by: Andrew Morton
    Reviewed-by: Junxiao Bi # ocfs2
    Reviewed-by: Joseph Qi # ocfs2
    Reviewed-by: Dave Chinner
    Reviewed-by: John Hubbard
    Reviewed-by: Christoph Hellwig
    Reviewed-by: William Kucharski
    Cc: Chao Yu
    Cc: Cong Wang
    Cc: Darrick J. Wong
    Cc: Eric Biggers
    Cc: Gao Xiang
    Cc: Jaegeuk Kim
    Cc: Michal Hocko
    Cc: Zi Yan
    Cc: Johannes Thumshirn
    Cc: Miklos Szeredi
    Link: http://lkml.kernel.org/r/20200414150233.24495-17-willy@infradead.org
    Signed-off-by: Linus Torvalds

    Matthew Wilcox (Oracle)
     

06 Mar, 2020

1 commit

  • When get an error in the middle of reading an inode, some fields in the
    inode might be still not initialized. And then the evict_inode path may
    access those fields via iput().

    To fix, this makes sure that inode fields are initialized.

    Reported-by: syzbot+9d82b8de2992579da5d0@syzkaller.appspotmail.com
    Signed-off-by: Andrew Morton
    Signed-off-by: OGAWA Hirofumi
    Cc:
    Link: http://lkml.kernel.org/r/871rqnreqx.fsf@mail.parknet.co.jp
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

19 Dec, 2019

1 commit


30 Aug, 2019

1 commit

  • Fill in the appropriate limits to avoid inconsistencies
    in the vfs cached inode times when timestamps are
    outside the permitted range.

    Some FAT variants indicate that the years after 2099 are not supported.
    Since commit 7decd1cb0305 ("fat: Fix and cleanup timestamp conversion")
    we support the full range of years that can be represented, up to 2107.

    Signed-off-by: Deepa Dinamani
    Acked-by: Jeff Layton
    Cc: hirofumi@mail.parknet.co.jp

    Deepa Dinamani
     

21 May, 2019

1 commit

  • Add SPDX license identifiers to all files which:

    - Have no license information of any form

    - Have MODULE_LICENCE("GPL*") inside which was used in the initial
    scan/conversion to ignore the file

    These files fall under the project license, GPL v2 only. The resulting SPDX
    license identifier is:

    GPL-2.0-only

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

02 May, 2019

1 commit


05 Jan, 2019

3 commits

  • This patch introduces 3 new inline functions - is_fat12, is_fat16 and
    is_fat32, and replaces every occurrence in the code in which the FS
    variant (whether this is FAT12, FAT16 or FAT32) was previously checked
    using msdos_sb_info->fat_bits.

    Link: http://lkml.kernel.org/r/1544990640-11604-4-git-send-email-carmeli.tamir@gmail.com
    Signed-off-by: Carmeli Tamir
    Acked-by: OGAWA Hirofumi
    Reviewed-by: Sergey Senozhatsky
    Cc: Johannes Thumshirn
    Cc: Bart Van Assche
    Cc: Martin K. Petersen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Carmeli Tamir
     
  • MAX_FAT is useless in msdos_fs.h, since it uses the MSDOS_SB function
    that is defined in fat.h. So really, this macro can be only called from
    code that already includes fat.h.

    Hence, this patch moves it to fat.h, right after MSDOS_SB is defined. I
    also changed it to an inline function in order to save the double call
    to MSDOS_SB. This was suggested by joe@perches.com in the previous
    version.

    This patch is required for the next in the series, in which the variant
    (whether this is FAT12, FAT16 or FAT32) checks are replaced with new
    macros.

    Link: http://lkml.kernel.org/r/1544990640-11604-3-git-send-email-carmeli.tamir@gmail.com
    Signed-off-by: Carmeli Tamir
    Acked-by: OGAWA Hirofumi
    Reviewed-by: Sergey Senozhatsky
    Cc: Bart Van Assche
    Cc: Johannes Thumshirn
    Cc: Martin K. Petersen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Carmeli Tamir
     
  • The comment edited in this patch was the only reference to the
    FAT_FIRST_ENT macro, which is not used anymore. Moreover, the commented
    line of code does not compile with the current code.

    Since the FAT_FIRST_ENT macro checks the FAT variant in a way that the
    patch series changes, I removed it, and instead wrote a clear
    explanation of what was checked.

    I verified that the changed comment is correct according to Microsoft
    FAT spec, search for "BPB_Media" in the following references:

    1. Microsoft FAT specification 2005
    (http://read.pudn.com/downloads77/ebook/294884/FAT32%20Spec%20%28SDA%20Contribution%29.pdf).
    Search for 'volume label'.
    2. Microsoft Extensible Firmware Initiative, FAT32 File System Specification
    (https://staff.washington.edu/dittrich/misc/fatgen103.pdf).
    Search for 'volume label'.

    Link: http://lkml.kernel.org/r/1544990640-11604-2-git-send-email-carmeli.tamir@gmail.com
    Signed-off-by: Carmeli Tamir
    Acked-by: OGAWA Hirofumi
    Reviewed-by: Sergey Senozhatsky
    Cc: Bart Van Assche
    Cc: Johannes Thumshirn
    Cc: Martin K. Petersen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Carmeli Tamir
     

31 Oct, 2018

2 commits

  • Convert the inode timestamp updates to use fat_truncate_time.

    Link: http://lkml.kernel.org/r/2663d3083c4dd62f00b64612c8eaf5542bb05a4c.1538363961.git.sorenson@redhat.com
    Signed-off-by: Frank Sorenson
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Frank Sorenson
     
  • Add the fat-specific inode_operation ->update_time() and
    fat_truncate_time() function to truncate the inode timestamps from 1
    nanosecond to the appropriate granularity.

    Link: http://lkml.kernel.org/r/38af1ba3c3cf0d7381ce7b63077ef8af75901532.1538363961.git.sorenson@redhat.com
    Signed-off-by: Frank Sorenson
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Frank Sorenson
     

23 Aug, 2018

1 commit

  • Now that we pass down 64-bit timestamps from VFS, we just need to convert
    that correctly into on-disk timestamps. To make that work correctly, this
    changes the last use of time_to_tm() in the kernel to time64_to_tm(),
    which also lets use remove that deprecated interfaces.

    Similarly, the time_t use in fat_time_fat2unix() truncates the timestamp
    on the way in, which can be avoided by using types that are wide enough to
    hold the intermediate values during the conversion.

    [hirofumi@mail.parknet.co.jp: remove useless temporary variable, needless long long]
    Link: http://lkml.kernel.org/r/20180619153646.3637529-1-arnd@arndb.de
    Signed-off-by: Arnd Bergmann
    Acked-by: OGAWA Hirofumi
    Cc: Jeff Layton
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     

22 Jul, 2018

1 commit

  • In parse_options(), if match_strdup() failed, parse_options() leaves
    opts->iocharset in unexpected state (i.e. still pointing the freed
    string). And this can be the cause of double free.

    To fix, this initialize opts->iocharset always when freeing.

    Link: http://lkml.kernel.org/r/8736wp9dzc.fsf@mail.parknet.co.jp
    Signed-off-by: OGAWA Hirofumi
    Reported-by: syzbot+90b8e10515ae88228a92@syzkaller.appspotmail.com
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

15 Jun, 2018

2 commits

  • Merge more updates from Andrew Morton:

    - MM remainders

    - various misc things

    - kcov updates

    * emailed patches from Andrew Morton : (27 commits)
    lib/test_printf.c: call wait_for_random_bytes() before plain %p tests
    hexagon: drop the unused variable zero_page_mask
    hexagon: fix printk format warning in setup.c
    mm: fix oom_kill event handling
    treewide: use PHYS_ADDR_MAX to avoid type casting ULLONG_MAX
    mm: use octal not symbolic permissions
    ipc: use new return type vm_fault_t
    sysvipc/sem: mitigate semnum index against spectre v1
    fault-injection: reorder config entries
    arm: port KCOV to arm
    sched/core / kcov: avoid kcov_area during task switch
    kcov: prefault the kcov_area
    kcov: ensure irq code sees a valid area
    kernel/relay.c: change return type to vm_fault_t
    exofs: avoid VLA in structures
    coredump: fix spam with zero VMA process
    fat: use fat_fs_error() instead of BUG_ON() in __fat_get_block()
    proc: skip branch in /proc/*/* lookup
    mremap: remove LATENCY_LIMIT from mremap to reduce the number of TLB shootdowns
    mm/memblock: add missing include
    ...

    Linus Torvalds
     
  • If file size and FAT cluster chain is not matched (corrupted image), we
    can hit BUG_ON(!phys) in __fat_get_block().

    So, use fat_fs_error() instead.

    [hirofumi@mail.parknet.co.jp: fix printk warning]
    Link: http://lkml.kernel.org/r/87po12aq5p.fsf@mail.parknet.co.jp
    Link: http://lkml.kernel.org/r/874lilcu67.fsf@mail.parknet.co.jp
    Signed-off-by: OGAWA Hirofumi
    Reported-by: Anatoly Trosinenko
    Tested-by: Anatoly Trosinenko
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

06 Jun, 2018

1 commit

  • struct timespec is not y2038 safe. Transition vfs to use
    y2038 safe struct timespec64 instead.

    The change was made with the help of the following cocinelle
    script. This catches about 80% of the changes.
    All the header file and logic changes are included in the
    first 5 rules. The rest are trivial substitutions.
    I avoid changing any of the function signatures or any other
    filesystem specific data structures to keep the patch simple
    for review.

    The script can be a little shorter by combining different cases.
    But, this version was sufficient for my usecase.

    virtual patch

    @ depends on patch @
    identifier now;
    @@
    - struct timespec
    + struct timespec64
    current_time ( ... )
    {
    - struct timespec now = current_kernel_time();
    + struct timespec64 now = current_kernel_time64();
    ...
    - return timespec_trunc(
    + return timespec64_trunc(
    ... );
    }

    @ depends on patch @
    identifier xtime;
    @@
    struct \( iattr \| inode \| kstat \) {
    ...
    - struct timespec xtime;
    + struct timespec64 xtime;
    ...
    }

    @ depends on patch @
    identifier t;
    @@
    struct inode_operations {
    ...
    int (*update_time) (...,
    - struct timespec t,
    + struct timespec64 t,
    ...);
    ...
    }

    @ depends on patch @
    identifier t;
    identifier fn_update_time =~ "update_time$";
    @@
    fn_update_time (...,
    - struct timespec *t,
    + struct timespec64 *t,
    ...) { ... }

    @ depends on patch @
    identifier t;
    @@
    lease_get_mtime( ... ,
    - struct timespec *t
    + struct timespec64 *t
    ) { ... }

    @te depends on patch forall@
    identifier ts;
    local idexpression struct inode *inode_node;
    identifier i_xtime =~ "^i_[acm]time$";
    identifier ia_xtime =~ "^ia_[acm]time$";
    identifier fn_update_time =~ "update_time$";
    identifier fn;
    expression e, E3;
    local idexpression struct inode *node1;
    local idexpression struct inode *node2;
    local idexpression struct iattr *attr1;
    local idexpression struct iattr *attr2;
    local idexpression struct iattr attr;
    identifier i_xtime1 =~ "^i_[acm]time$";
    identifier i_xtime2 =~ "^i_[acm]time$";
    identifier ia_xtime1 =~ "^ia_[acm]time$";
    identifier ia_xtime2 =~ "^ia_[acm]time$";
    @@
    (
    (
    - struct timespec ts;
    + struct timespec64 ts;
    |
    - struct timespec ts = current_time(inode_node);
    + struct timespec64 ts = current_time(inode_node);
    )

    i_xtime, &ts)
    + timespec64_equal(&inode_node->i_xtime, &ts)
    |
    - timespec_equal(&ts, &inode_node->i_xtime)
    + timespec64_equal(&ts, &inode_node->i_xtime)
    |
    - timespec_compare(&inode_node->i_xtime, &ts)
    + timespec64_compare(&inode_node->i_xtime, &ts)
    |
    - timespec_compare(&ts, &inode_node->i_xtime)
    + timespec64_compare(&ts, &inode_node->i_xtime)
    |
    ts = current_time(e)
    |
    fn_update_time(..., &ts,...)
    |
    inode_node->i_xtime = ts
    |
    node1->i_xtime = ts
    |
    ts = inode_node->i_xtime
    |
    ia_xtime ...+> = ts
    |
    ts = attr1->ia_xtime
    |
    ts.tv_sec
    |
    ts.tv_nsec
    |
    btrfs_set_stack_timespec_sec(..., ts.tv_sec)
    |
    btrfs_set_stack_timespec_nsec(..., ts.tv_nsec)
    |
    - ts = timespec64_to_timespec(
    + ts =
    ...
    -)
    |
    - ts = ktime_to_timespec(
    + ts = ktime_to_timespec64(
    ...)
    |
    - ts = E3
    + ts = timespec_to_timespec64(E3)
    |
    - ktime_get_real_ts(&ts)
    + ktime_get_real_ts64(&ts)
    |
    fn(...,
    - ts
    + timespec64_to_timespec(ts)
    ,...)
    )
    ...+>
    (

    )
    |
    - timespec_equal(&node1->i_xtime1, &node2->i_xtime2)
    + timespec64_equal(&node1->i_xtime2, &node2->i_xtime2)
    |
    - timespec_equal(&node1->i_xtime1, &attr2->ia_xtime2)
    + timespec64_equal(&node1->i_xtime2, &attr2->ia_xtime2)
    |
    - timespec_compare(&node1->i_xtime1, &node2->i_xtime2)
    + timespec64_compare(&node1->i_xtime1, &node2->i_xtime2)
    |
    node1->i_xtime1 =
    - timespec_trunc(attr1->ia_xtime1,
    + timespec64_trunc(attr1->ia_xtime1,
    ...)
    |
    - attr1->ia_xtime1 = timespec_trunc(attr2->ia_xtime2,
    + attr1->ia_xtime1 = timespec64_trunc(attr2->ia_xtime2,
    ...)
    |
    - ktime_get_real_ts(&attr1->ia_xtime1)
    + ktime_get_real_ts64(&attr1->ia_xtime1)
    |
    - ktime_get_real_ts(&attr.ia_xtime1)
    + ktime_get_real_ts64(&attr.ia_xtime1)
    )

    @ depends on patch @
    struct inode *node;
    struct iattr *attr;
    identifier fn;
    identifier i_xtime =~ "^i_[acm]time$";
    identifier ia_xtime =~ "^ia_[acm]time$";
    expression e;
    @@
    (
    - fn(node->i_xtime);
    + fn(timespec64_to_timespec(node->i_xtime));
    |
    fn(...,
    - node->i_xtime);
    + timespec64_to_timespec(node->i_xtime));
    |
    - e = fn(attr->ia_xtime);
    + e = fn(timespec64_to_timespec(attr->ia_xtime));
    )

    @ depends on patch forall @
    struct inode *node;
    struct iattr *attr;
    identifier i_xtime =~ "^i_[acm]time$";
    identifier ia_xtime =~ "^ia_[acm]time$";
    identifier fn;
    @@
    {
    + struct timespec ts;
    i_xtime);
    fn (...,
    - &node->i_xtime,
    + &ts,
    ...);
    |
    + ts = timespec64_to_timespec(attr->ia_xtime);
    fn (...,
    - &attr->ia_xtime,
    + &ts,
    ...);
    )
    ...+>
    }

    @ depends on patch forall @
    struct inode *node;
    struct iattr *attr;
    struct kstat *stat;
    identifier ia_xtime =~ "^ia_[acm]time$";
    identifier i_xtime =~ "^i_[acm]time$";
    identifier xtime =~ "^[acm]time$";
    identifier fn, ret;
    @@
    {
    + struct timespec ts;
    i_xtime);
    ret = fn (...,
    - &node->i_xtime,
    + &ts,
    ...);
    |
    + ts = timespec64_to_timespec(node->i_xtime);
    ret = fn (...,
    - &node->i_xtime);
    + &ts);
    |
    + ts = timespec64_to_timespec(attr->ia_xtime);
    ret = fn (...,
    - &attr->ia_xtime,
    + &ts,
    ...);
    |
    + ts = timespec64_to_timespec(attr->ia_xtime);
    ret = fn (...,
    - &attr->ia_xtime);
    + &ts);
    |
    + ts = timespec64_to_timespec(stat->xtime);
    ret = fn (...,
    - &stat->xtime);
    + &ts);
    )
    ...+>
    }

    @ depends on patch @
    struct inode *node;
    struct inode *node2;
    identifier i_xtime1 =~ "^i_[acm]time$";
    identifier i_xtime2 =~ "^i_[acm]time$";
    identifier i_xtime3 =~ "^i_[acm]time$";
    struct iattr *attrp;
    struct iattr *attrp2;
    struct iattr attr ;
    identifier ia_xtime1 =~ "^ia_[acm]time$";
    identifier ia_xtime2 =~ "^ia_[acm]time$";
    struct kstat *stat;
    struct kstat stat1;
    struct timespec64 ts;
    identifier xtime =~ "^[acmb]time$";
    expression e;
    @@
    (
    ( node->i_xtime2 \| attrp->ia_xtime2 \| attr.ia_xtime2 \) = node->i_xtime1 ;
    |
    node->i_xtime2 = \( node2->i_xtime1 \| timespec64_trunc(...) \);
    |
    node->i_xtime2 = node->i_xtime1 = node->i_xtime3 = \(ts \| current_time(...) \);
    |
    node->i_xtime1 = node->i_xtime3 = \(ts \| current_time(...) \);
    |
    stat->xtime = node2->i_xtime1;
    |
    stat1.xtime = node2->i_xtime1;
    |
    ( node->i_xtime2 \| attrp->ia_xtime2 \) = attrp->ia_xtime1 ;
    |
    ( attrp->ia_xtime1 \| attr.ia_xtime1 \) = attrp2->ia_xtime2;
    |
    - e = node->i_xtime1;
    + e = timespec64_to_timespec( node->i_xtime1 );
    |
    - e = attrp->ia_xtime1;
    + e = timespec64_to_timespec( attrp->ia_xtime1 );
    |
    node->i_xtime1 = current_time(...);
    |
    node->i_xtime2 = node->i_xtime1 = node->i_xtime3 =
    - e;
    + timespec_to_timespec64(e);
    |
    node->i_xtime1 = node->i_xtime3 =
    - e;
    + timespec_to_timespec64(e);
    |
    - node->i_xtime1 = e;
    + node->i_xtime1 = timespec_to_timespec64(e);
    )

    Signed-off-by: Deepa Dinamani
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:

    Deepa Dinamani
     

29 Jan, 2018

1 commit


30 Nov, 2017

1 commit

  • Commit bc98a42c1f7d ("VFS: Convert sb->s_flags & MS_RDONLY to
    sb_rdonly(sb)") converted fat_remount():new_rdonly from a bool to an
    int.

    However fat_remount() depends upon the compiler's conversion of a
    non-zero integer into boolean `true'.

    Fix it by switching `new_rdonly' back into a bool.

    Link: http://lkml.kernel.org/r/87mv3d5x51.fsf@mail.parknet.co.jp
    Fixes: bc98a42c1f7d0f8 ("VFS: Convert sb->s_flags & MS_RDONLY to sb_rdonly(sb)")
    Signed-off-by: OGAWA Hirofumi
    Cc: Joe Perches
    Cc: David Howells
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

28 Nov, 2017

1 commit

  • This is a pure automated search-and-replace of the internal kernel
    superblock flags.

    The s_flags are now called SB_*, with the names and the values for the
    moment mirroring the MS_* flags that they're equivalent to.

    Note how the MS_xyz flags are the ones passed to the mount system call,
    while the SB_xyz flags are what we then use in sb->s_flags.

    The script to do this was:

    # places to look in; re security/*: it generally should *not* be
    # touched (that stuff parses mount(2) arguments directly), but
    # there are two places where we really deal with superblock flags.
    FILES="drivers/mtd drivers/staging/lustre fs ipc mm \
    include/linux/fs.h include/uapi/linux/bfs_fs.h \
    security/apparmor/apparmorfs.c security/apparmor/include/lib.h"
    # the list of MS_... constants
    SYMS="RDONLY NOSUID NODEV NOEXEC SYNCHRONOUS REMOUNT MANDLOCK \
    DIRSYNC NOATIME NODIRATIME BIND MOVE REC VERBOSE SILENT \
    POSIXACL UNBINDABLE PRIVATE SLAVE SHARED RELATIME KERNMOUNT \
    I_VERSION STRICTATIME LAZYTIME SUBMOUNT NOREMOTELOCK NOSEC BORN \
    ACTIVE NOUSER"

    SED_PROG=
    for i in $SYMS; do SED_PROG="$SED_PROG -e s/MS_$i/SB_$i/g"; done

    # we want files that contain at least one of MS_...,
    # with fs/namespace.c and fs/pnode.c excluded.
    L=$(for i in $SYMS; do git grep -w -l MS_$i $FILES; done| sort|uniq|grep -v '^fs/namespace.c'|grep -v '^fs/pnode.c')

    for f in $L; do sed -i $f $SED_PROG; done

    Requested-by: Al Viro
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

17 Jul, 2017

1 commit

  • Firstly by applying the following with coccinelle's spatch:

    @@ expression SB; @@
    -SB->s_flags & MS_RDONLY
    +sb_rdonly(SB)

    to effect the conversion to sb_rdonly(sb), then by applying:

    @@ expression A, SB; @@
    (
    -(!sb_rdonly(SB)) && A
    +!sb_rdonly(SB) && A
    |
    -A != (sb_rdonly(SB))
    +A != sb_rdonly(SB)
    |
    -A == (sb_rdonly(SB))
    +A == sb_rdonly(SB)
    |
    -!(sb_rdonly(SB))
    +!sb_rdonly(SB)
    |
    -A && (sb_rdonly(SB))
    +A && sb_rdonly(SB)
    |
    -A || (sb_rdonly(SB))
    +A || sb_rdonly(SB)
    |
    -(sb_rdonly(SB)) != A
    +sb_rdonly(SB) != A
    |
    -(sb_rdonly(SB)) == A
    +sb_rdonly(SB) == A
    |
    -(sb_rdonly(SB)) && A
    +sb_rdonly(SB) && A
    |
    -(sb_rdonly(SB)) || A
    +sb_rdonly(SB) || A
    )

    @@ expression A, B, SB; @@
    (
    -(sb_rdonly(SB)) ? 1 : 0
    +sb_rdonly(SB)
    |
    -(sb_rdonly(SB)) ? A : B
    +sb_rdonly(SB) ? A : B
    )

    to remove left over excess bracketage and finally by applying:

    @@ expression A, SB; @@
    (
    -(A & MS_RDONLY) != sb_rdonly(SB)
    +(bool)(A & MS_RDONLY) != sb_rdonly(SB)
    |
    -(A & MS_RDONLY) == sb_rdonly(SB)
    +(bool)(A & MS_RDONLY) == sb_rdonly(SB)
    )

    to make comparisons against the result of sb_rdonly() (which is a bool)
    work correctly.

    Signed-off-by: David Howells

    David Howells
     

10 Mar, 2017

1 commit

  • Recently fallocate patch was merged and it uses
    MSDOS_I(inode)->mmu_private at fat_evict_inode(). However,
    fat_inode/fsinfo_inode that was introduced in past didn't initialize
    MSDOS_I(inode) properly.

    With those combinations, it became the cause of accessing random entry
    in FAT area.

    Link: http://lkml.kernel.org/r/87pohrj4i8.fsf@mail.parknet.co.jp
    Signed-off-by: OGAWA Hirofumi
    Reported-by: Moreno Bartalucci
    Tested-by: Moreno Bartalucci
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

28 Sep, 2016

1 commit

  • CURRENT_TIME_SEC is not y2038 safe. current_time() will
    be transitioned to use 64 bit time along with vfs in a
    separate patch.
    There is no plan to transistion CURRENT_TIME_SEC to use
    y2038 safe time interfaces.

    current_time() will also be extended to use superblock
    range checking parameters when range checking is introduced.

    This works because alloc_super() fills in the the s_time_gran
    in super block to NSEC_PER_SEC.

    Signed-off-by: Deepa Dinamani
    Acked-by: Jan Kara
    Signed-off-by: Al Viro

    Deepa Dinamani
     

24 Jun, 2016

1 commit

  • "bogus directory-entries per block" was reported for what was instead
    bogus number of directory entries. The message also mismatched the
    argument passed to printk(), which was sbi->dir_entries.

    Fix this by replacing the message with "bogus number of directory
    entries". printk() argument was kept unchanged.

    Signed-off-by: Zheng Lv
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Jiri Kosina

    Zheng Lv
     

21 Jun, 2016

1 commit


02 May, 2016

1 commit


23 Mar, 2016

1 commit

  • FAT has long supported its own default file name encoding config
    setting, separate from CONFIG_NLS_DEFAULT.

    However, if UTF-8 encoded file names are desired FAT character set
    should not be set to utf8 since this would make file names case
    sensitive even if case insensitive matching is requested. Instead,
    "utf8" mount options should be provided to enable UTF-8 file names in
    FAT file system.

    Unfortunately, there was no possibility to set the default value of this
    option so on UTF-8 system "utf8" mount option had to be added manually
    to most FAT mounts.

    This patch adds config option to set such default value.

    Signed-off-by: Maciej S. Szmigiero
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Maciej S. Szmigiero
     

21 Jan, 2016

5 commits

  • Make the fibmap call return the proper physical block number for any
    offset request in the fallocated range.

    Signed-off-by: Namjae Jeon
    Signed-off-by: Amit Sahrawat
    Cc: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     
  • Skip new cluster allocation after checking i_blocks limit in _fat_get_block,
    because the blocks are already allocated in fallocated region.

    Signed-off-by: Namjae Jeon
    Signed-off-by: Amit Sahrawat
    Cc: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     
  • Implement preallocation via the fallocate syscall on VFAT partitions.
    This patch is based on an earlier patch of the same name which had some
    issues detailed below and did not get accepted. Refer
    https://lkml.org/lkml/2007/12/22/130.

    a) The preallocated space was not persistent when the
    FALLOC_FL_KEEP_SIZE flag was set. It will deallocate cluster at evict
    time.

    b) There was no need to zero out the clusters when the flag was set
    Instead of doing an expanding truncate, just allocate clusters and add
    them to the fat chain. This reduces preallocation time.

    Compatibility with windows:

    There are no issues when FALLOC_FL_KEEP_SIZE is not set because it just
    does an expanding truncate. Thus reading from the preallocated area on
    windows returns null until data is written to it.

    When a file with preallocated area using the FALLOC_FL_KEEP_SIZE was
    written to on windows, the windows driver freed-up the preallocated
    clusters and allocated new clusters for the new data. The freed up
    clusters gets reflected in the free space available for the partition
    which can be seen from the Volume properties.

    The windows chkdsk tool also does not report any errors on a disk
    containing files with preallocated space.

    And there is also no issue using linux fat fsck. because discard
    preallocated clusters at repair time.

    Signed-off-by: Namjae Jeon
    Signed-off-by: Amit Sahrawat
    Cc: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     
  • This detects simple corruption cases of directory, and tries to avoid
    further damage to user data.

    And performance impact of this validation should be very low, or not
    measurable.

    Signed-off-by: OGAWA Hirofumi
    Reported-by: Vegard Nossum
    Tested-by: Vegard Nossum
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • Currently we limit values of time_offset mount option to be between -12
    and 12 hours. However e.g. zone GMT+12 can have a DST correction on top
    which makes the total time difference 13 hours. Update the checks in
    mount option parsing to allow offset of upto 24 hours to allow for unusual
    cases.

    Signed-off-by: Jan Kara
    Reported-by: Volker Kuhlmann
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Kara
     

15 Jan, 2016

1 commit

  • Mark those kmem allocations that are known to be easily triggered from
    userspace as __GFP_ACCOUNT/SLAB_ACCOUNT, which makes them accounted to
    memcg. For the list, see below:

    - threadinfo
    - task_struct
    - task_delay_info
    - pid
    - cred
    - mm_struct
    - vm_area_struct and vm_region (nommu)
    - anon_vma and anon_vma_chain
    - signal_struct
    - sighand_struct
    - fs_struct
    - files_struct
    - fdtable and fdtable->full_fds_bits
    - dentry and external_name
    - inode for all filesystems. This is the most tedious part, because
    most filesystems overwrite the alloc_inode method.

    The list is far from complete, so feel free to add more objects.
    Nevertheless, it should be close to "account everything" approach and
    keep most workloads within bounds. Malevolent users will be able to
    breach the limit, but this was possible even with the former "account
    everything" approach (simply because it did not account everything in
    fact).

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Vladimir Davydov
    Acked-by: Johannes Weiner
    Acked-by: Michal Hocko
    Cc: Tejun Heo
    Cc: Greg Thelen
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: David Rientjes
    Cc: Joonsoo Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vladimir Davydov
     

02 Jun, 2015

1 commit

  • With the planned cgroup writeback support, backing-dev related
    declarations will be more widely used across block and cgroup;
    unfortunately, including backing-dev.h from include/linux/blkdev.h
    makes cyclic include dependency quite likely.

    This patch separates out backing-dev-defs.h which only has the
    essential definitions and updates blkdev.h to include it. c files
    which need access to more backing-dev details now include
    backing-dev.h directly. This takes backing-dev.h off the common
    include dependency chain making it a lot easier to use it across block
    and cgroup.

    v2: fs/fat build failure fixed.

    Signed-off-by: Tejun Heo
    Reviewed-by: Jan Kara
    Cc: Jens Axboe
    Signed-off-by: Jens Axboe

    Tejun Heo
     

17 Apr, 2015

3 commits

  • Merge third patchbomb from Andrew Morton:

    - various misc things

    - a couple of lib/ optimisations

    - provide DIV_ROUND_CLOSEST_ULL()

    - checkpatch updates

    - rtc tree

    - befs, nilfs2, hfs, hfsplus, fatfs, adfs, affs, bfs

    - ptrace fixes

    - fork() fixes

    - seccomp cleanups

    - more mmap_sem hold time reductions from Davidlohr

    * emailed patches from Andrew Morton : (138 commits)
    proc: show locks in /proc/pid/fdinfo/X
    docs: add missing and new /proc/PID/status file entries, fix typos
    drivers/rtc/rtc-at91rm9200.c: make IO endian agnostic
    Documentation/spi/spidev_test.c: fix warning
    drivers/rtc/rtc-s5m.c: allow usage on device type different than main MFD type
    .gitignore: ignore *.tar
    MAINTAINERS: add Mediatek SoC mailing list
    tomoyo: reduce mmap_sem hold for mm->exe_file
    powerpc/oprofile: reduce mmap_sem hold for exe_file
    oprofile: reduce mmap_sem hold for mm->exe_file
    mips: ip32: add platform data hooks to use DS1685 driver
    lib/Kconfig: fix up HAVE_ARCH_BITREVERSE help text
    x86: switch to using asm-generic for seccomp.h
    sparc: switch to using asm-generic for seccomp.h
    powerpc: switch to using asm-generic for seccomp.h
    parisc: switch to using asm-generic for seccomp.h
    mips: switch to using asm-generic for seccomp.h
    microblaze: use asm-generic for seccomp.h
    arm: use asm-generic for seccomp.h
    seccomp: allow COMPAT sigreturn overrides
    ...

    Linus Torvalds
     
  • 'fat.h' includes which includes which
    includes all the header files required for all *.c files fat filesystem.

    [akpm@linux-foundation.org: fs/fat/iode.c needs seq_file.h]
    [sfr@canb.auug.org.au: put one actually necessary include file back]
    Signed-off-by: Alexander Kuleshov
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Stephen Rothwell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Kuleshov
     
  • '*sb' never used, so let's remote it and pass inode->i_sb directly to the
    MSDOS_SB.

    Signed-off-by: Alexander Kuleshov
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Kuleshov
     

12 Apr, 2015

2 commits