25 Oct, 2020

1 commit

  • Pull misc vfs updates from Al Viro:
    "Assorted stuff all over the place (the largest group here is
    Christoph's stat cleanups)"

    * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    fs: remove KSTAT_QUERY_FLAGS
    fs: remove vfs_stat_set_lookup_flags
    fs: move vfs_fstatat out of line
    fs: implement vfs_stat and vfs_lstat in terms of vfs_fstatat
    fs: remove vfs_statx_fd
    fs: omfs: use kmemdup() rather than kmalloc+memcpy
    [PATCH] reduce boilerplate in fsid handling
    fs: Remove duplicated flag O_NDELAY occurring twice in VALID_OPEN_FLAGS
    selftests: mount: add nosymfollow tests
    Add a "nosymfollow" mount option.

    Linus Torvalds
     

29 Sep, 2020

3 commits


22 Sep, 2020

2 commits

  • udf_process_sequence() allocates temporary array for processing
    partition descriptors on volume which it fails to free. Free the array
    when it is not needed anymore.

    Fixes: 7b78fd02fb19 ("udf: Fix handling of Partition Descriptors")
    CC: stable@vger.kernel.org
    Reported-by: syzbot+128f4dd6e796c98b3760@syzkaller.appspotmail.com
    Signed-off-by: Jan Kara

    Jan Kara
     
  • After commit 9293fcfbc181 ("udf: Remove struct ustr as non-needed
    intermediate storage"), the variable ret is being initialized with
    '-ENOMEM' that is meaningless. So remove it.

    Link: https://lore.kernel.org/r/20200922081322.70535-1-jingxiangfeng@huawei.com
    Signed-off-by: Jing Xiangfeng
    Signed-off-by: Jan Kara

    Jing Xiangfeng
     

19 Sep, 2020

1 commit


28 Aug, 2020

1 commit

  • Use kvzalloc() in udf_sb_alloc_bitmap() instead of open-coding it.
    Size computation wrapped in struct_size() macro to prevent potential
    integer overflows.

    Link: https://lore.kernel.org/r/20200827221652.64660-1-efremov@linux.com
    Signed-off-by: Denis Efremov
    Reviewed-by: Gustavo A. R. Silva
    Signed-off-by: Jan Kara

    Denis Efremov
     

24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

07 Aug, 2020

1 commit

  • Pull ext2, udf, reiserfs, quota cleanups and minor fixes from Jan Kara:
    "A few ext2 fixups and then several (mostly comment and documentation)
    cleanups in ext2, udf, reiserfs, and quota"

    * tag 'for_v5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
    reiserfs: delete duplicated words
    udf: osta_udf.h: delete a duplicated word
    reiserfs: reiserfs.h: delete a duplicated word
    ext2: ext2.h: fix duplicated word + typos
    udf: Replace HTTP links with HTTPS ones
    quota: Fixup http links in quota doc
    Replace HTTP links with HTTPS ones: DISKQUOTA
    ext2: initialize quota info in ext2_xattr_set()
    ext2: fix some incorrect comments in inode.c
    ext2: remove nocheck option
    ext2: fix missing percpu_counter_inc
    ext2: ext2_find_entry() return -ENOENT if no entry found
    ext2: propagate errors up to ext2_find_entry()'s callers
    ext2: fix improper assignment for e_value_offs

    Linus Torvalds
     

27 Jul, 2020

1 commit


17 Jul, 2020

1 commit

  • Using uninitialized_var() is dangerous as it papers over real bugs[1]
    (or can in the future), and suppresses unrelated compiler warnings
    (e.g. "unused variable"). If the compiler thinks it is uninitialized,
    either simply initialize the variable or make compiler changes.

    In preparation for removing[2] the[3] macro[4], remove all remaining
    needless uses with the following script:

    git grep '\buninitialized_var\b' | cut -d: -f1 | sort -u | \
    xargs perl -pi -e \
    's/\buninitialized_var\(([^\)]+)\)/\1/g;
    s:\s*/\* (GCC be quiet|to make compiler happy) \*/$::g;'

    drivers/video/fbdev/riva/riva_hw.c was manually tweaked to avoid
    pathological white-space.

    No outstanding warnings were found building allmodconfig with GCC 9.3.0
    for x86_64, i386, arm64, arm, powerpc, powerpc64le, s390x, mips, sparc64,
    alpha, and m68k.

    [1] https://lore.kernel.org/lkml/20200603174714.192027-1-glider@google.com/
    [2] https://lore.kernel.org/lkml/CA+55aFw+Vbj0i=1TGqCR5vQkCzWJ0QxK6CernOU6eedsudAixw@mail.gmail.com/
    [3] https://lore.kernel.org/lkml/CA+55aFwgbgqhbp1fkxvRKEpzyR5J8n1vKT1VZdz9knmPuXhOeg@mail.gmail.com/
    [4] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yVJu65TpLgN_ybYNv0VEOKA@mail.gmail.com/

    Reviewed-by: Leon Romanovsky # drivers/infiniband and mlx4/mlx5
    Acked-by: Jason Gunthorpe # IB
    Acked-by: Kalle Valo # wireless drivers
    Reviewed-by: Chao Yu # erofs
    Signed-off-by: Kees Cook

    Kees Cook
     

14 Jul, 2020

1 commit

  • Rationale:
    Reduces attack surface on kernel devs opening the links for MITM
    as HTTPS traffic is much harder to manipulate.

    Deterministic algorithm:
    For each file:
    If not .svg:
    For each line:
    If doesn't contain `\bxmlns\b`:
    For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
    If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`:
    If both the HTTP and HTTPS versions
    return 200 OK and serve the same content:
    Replace HTTP with HTTPS.

    Link: https://lore.kernel.org/r/20200713200738.37800-1-grandmaster@al2klimov.de
    Signed-off-by: Alexander A. Klimov
    Signed-off-by: Jan Kara

    Alexander A. Klimov
     

03 Jun, 2020

3 commits

  • Pull block updates from Jens Axboe:
    "Core block changes that have been queued up for this release:

    - Remove dead blk-throttle and blk-wbt code (Guoqing)

    - Include pid in blktrace note traces (Jan)

    - Don't spew I/O errors on wouldblock termination (me)

    - Zone append addition (Johannes, Keith, Damien)

    - IO accounting improvements (Konstantin, Christoph)

    - blk-mq hardware map update improvements (Ming)

    - Scheduler dispatch improvement (Salman)

    - Inline block encryption support (Satya)

    - Request map fixes and improvements (Weiping)

    - blk-iocost tweaks (Tejun)

    - Fix for timeout failing with error injection (Keith)

    - Queue re-run fixes (Douglas)

    - CPU hotplug improvements (Christoph)

    - Queue entry/exit improvements (Christoph)

    - Move DMA drain handling to the few drivers that use it (Christoph)

    - Partition handling cleanups (Christoph)"

    * tag 'for-5.8/block-2020-06-01' of git://git.kernel.dk/linux-block: (127 commits)
    block: mark bio_wouldblock_error() bio with BIO_QUIET
    blk-wbt: rename __wbt_update_limits to wbt_update_limits
    blk-wbt: remove wbt_update_limits
    blk-throttle: remove tg_drain_bios
    blk-throttle: remove blk_throtl_drain
    null_blk: force complete for timeout request
    blk-mq: drain I/O when all CPUs in a hctx are offline
    blk-mq: add blk_mq_all_tag_iter
    blk-mq: open code __blk_mq_alloc_request in blk_mq_alloc_request_hctx
    blk-mq: use BLK_MQ_NO_TAG in more places
    blk-mq: rename BLK_MQ_TAG_FAIL to BLK_MQ_NO_TAG
    blk-mq: move more request initialization to blk_mq_rq_ctx_init
    blk-mq: simplify the blk_mq_get_request calling convention
    blk-mq: remove the bio argument to ->prepare_request
    nvme: force complete cancelled requests
    blk-mq: blk-mq: provide forced completion method
    block: fix a warning when blkdev.h is included for !CONFIG_BLOCK builds
    block: blk-crypto-fallback: remove redundant initialization of variable err
    block: reduce part_stat_lock() scope
    block: use __this_cpu_add() instead of access by smp_processor_id()
    ...

    Linus Torvalds
     
  • Merge updates from Andrew Morton:
    "A few little subsystems and a start of a lot of MM patches.

    Subsystems affected by this patch series: squashfs, ocfs2, parisc,
    vfs. With mm subsystems: slab-generic, slub, debug, pagecache, gup,
    swap, memcg, pagemap, memory-failure, vmalloc, kasan"

    * emailed patches from Andrew Morton : (128 commits)
    kasan: move kasan_report() into report.c
    mm/mm_init.c: report kasan-tag information stored in page->flags
    ubsan: entirely disable alignment checks under UBSAN_TRAP
    kasan: fix clang compilation warning due to stack protector
    x86/mm: remove vmalloc faulting
    mm: remove vmalloc_sync_(un)mappings()
    x86/mm/32: implement arch_sync_kernel_mappings()
    x86/mm/64: implement arch_sync_kernel_mappings()
    mm/ioremap: track which page-table levels were modified
    mm/vmalloc: track which page-table levels were modified
    mm: add functions to track page directory modifications
    s390: use __vmalloc_node in stack_alloc
    powerpc: use __vmalloc_node in alloc_vm_stack
    arm64: use __vmalloc_node in arch_alloc_vmap_stack
    mm: remove vmalloc_user_node_flags
    mm: switch the test_vmalloc module to use __vmalloc_node
    mm: remove __vmalloc_node_flags_caller
    mm: remove both instances of __vmalloc_node_flags
    mm: remove the prot argument to __vmalloc_node
    mm: remove the pgprot argument to __vmalloc
    ...

    Linus Torvalds
     
  • 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)
     

05 May, 2020

1 commit


21 Apr, 2020

1 commit

  • Some filesystem references got broken by a previous patch
    series I submitted. Address those.

    Signed-off-by: Mauro Carvalho Chehab
    Acked-by: David Sterba # fs/affs/Kconfig
    Link: https://lore.kernel.org/r/57318c53008dbda7f6f4a5a9e5787f4d37e8565a.1586881715.git.mchehab+huawei@kernel.org
    Signed-off-by: Jonathan Corbet

    Mauro Carvalho Chehab
     

11 Apr, 2020

1 commit

  • For security reasons I stopped using gmail account and kernel address is
    now up-to-date alias to my personal address.

    People periodically send me emails to address which they found in source
    code of drivers, so this change reflects state where people can contact
    me.

    [ Added .mailmap entry as per Joe Perches - Linus ]
    Signed-off-by: Pali Rohár
    Signed-off-by: Andrew Morton
    Cc: Greg Kroah-Hartman
    Cc: Joe Perches
    Link: http://lkml.kernel.org/r/20200307104237.8199-1-pali@kernel.org
    Signed-off-by: Linus Torvalds

    Pali Rohár
     

16 Mar, 2020

1 commit

  • The current codebase makes use of the zero-length array language
    extension to the C90 standard, but the preferred mechanism to declare
    variable-length types such as these ones is a flexible array member[1][2],
    introduced in C99:

    struct foo {
    int stuff;
    struct boo array[];
    };

    By making use of the mechanism above, we will get a compiler warning
    in case the flexible array does not occur last in the structure, which
    will help us prevent some kind of undefined behavior bugs from being
    inadvertently introduced[3] to the codebase from now on.

    Also, notice that, dynamic memory allocations won't be affected by
    this change:

    "Flexible array members have incomplete type, and so the sizeof operator
    may not be applied. As a quirk of the original implementation of
    zero-length arrays, sizeof evaluates to zero."[1]

    This issue was found with the help of Coccinelle.

    [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
    [2] https://github.com/KSPP/linux/issues/21
    [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

    Link: https://lore.kernel.org/r/20200309202715.GA9428@embeddedor
    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Jan Kara

    Gustavo A. R. Silva
     

20 Jan, 2020

2 commits

  • UDF does not have separate preallocated table of inodes. So similarly to
    XFS we pretend that every free block is also a free inode in statfs(2)
    output. Clarify this in a comment.

    Signed-off-by: Jan Kara

    Jan Kara
     
  • UDF 2.60 standard states in section 2.2.14.2:

    A partition with Access Type 3 (rewritable) shall define a Freed
    Space Bitmap or a Freed Space Table, see 2.3.3. All other partitions
    shall not define a Freed Space Bitmap or a Freed Space Table.

    Rewritable partitions are used on media that require some form of
    preprocessing before re-writing data (for example legacy MO). Such
    partitions shall use Access Type 3.

    Overwritable partitions are used on media that do not require
    preprocessing before overwriting data (for example: CD-RW, DVD-RW,
    DVD+RW, DVD-RAM, BD-RE, HD DVD-Rewritable). Such partitions shall
    use Access Type 4.

    however older versions of the standard didn't have this wording and
    there are tools out there that create UDF filesystems with rewritable
    partitions but that don't contain a Freed Space Bitmap or a Freed Space
    Table on media that does not require pre-processing before overwriting a
    block. So instead of forcing media with rewritable partition read-only,
    base this decision on presence of a Freed Space Bitmap or a Freed Space
    Table.

    Reported-by: Pali Rohár
    Reviewed-by: Pali Rohár
    Fixes: b085fbe2ef7f ("udf: Fix crash during mount")
    Link: https://lore.kernel.org/linux-fsdevel/20200112144735.hj2emsoy4uwsouxz@pali
    Signed-off-by: Jan Kara

    Jan Kara
     

13 Jan, 2020

2 commits

  • Currently we do not support writing to UDF disks with Metadata partition.
    There is already check that disks with declared minimal write revision to
    UDF 2.50 or higher are mounted only in R/O mode but this does not cover
    situation when minimal write revision is set incorrectly (e.g. to 2.01).

    Link: https://lore.kernel.org/r/20200112144959.28104-1-pali.rohar@gmail.com
    Signed-off-by: Pali Rohár
    Signed-off-by: Jan Kara

    Pali Rohár
     
  • Currently ENTITYID_FLAGS_* macros definitions are written as hex numbers
    but their meaning is not bitwise-or flags. But rather bit position. This is
    unusual and could be misleading. So change meaning of ENTITYID_FLAGS_*
    macros definitions to be really bitwise-or flags.

    Link: https://lore.kernel.org/r/20200112221353.29711-1-pali.rohar@gmail.com
    Signed-off-by: Pali Rohár
    Signed-off-by: Jan Kara

    Pali Rohár
     

10 Jan, 2020

1 commit

  • Free space on filesystems with metadata or virtual partition maps
    currently gets misreported. This is because these partitions are just
    remapped onto underlying real partitions from which keep track of free
    blocks. Take this remapping into account when counting free blocks as
    well.

    Reviewed-by: Pali Rohár
    Reported-by: Pali Rohár
    Signed-off-by: Jan Kara

    Jan Kara
     

08 Jan, 2020

3 commits


05 Sep, 2019

3 commits

  • The brelse() function tests whether its argument is NULL
    and then returns immediately.
    Thus the test around the call is not needed.

    This issue was detected by using the Coccinelle software.

    Signed-off-by: Markus Elfring
    Link: https://lore.kernel.org/r/a254c1d1-0109-ab51-c67a-edc5c1c4b4cd@web.de
    Signed-off-by: Jan Kara

    Markus Elfring
     
  • Move some functions to make forward declarations unnecessary.

    Signed-off-by: Jan Kara

    Jan Kara
     
  • OSTA UDF standard defines that domain identifier in logical volume
    descriptor and file set descriptor should contain a particular string
    and the identifier suffix contains flags possibly making media
    write-protected. Verify these constraints and allow only read-only mount
    if they are not met.

    Tested-by: Steven J. Magnani
    Reviewed-by: Steven J. Magnani
    Signed-off-by: Jan Kara

    Jan Kara
     

27 Aug, 2019

1 commit

  • Windows presents files created within Linux as read-only, even when
    permissions in Linux indicate the file should be writable.

    UDF defines a slightly different set of basic file permissions than Linux.
    Specifically, UDF has "delete" and "change attribute" permissions for each
    access class (user/group/other). Linux has no equivalents for these.

    When the Linux UDF driver creates a file (or directory), no UDF delete or
    change attribute permissions are granted. The lack of delete permission
    appears to cause Windows to mark an item read-only when its permissions
    otherwise indicate that it should be read-write.

    Fix this by having UDF delete permissions track Linux write permissions.
    Also grant UDF change attribute permission to the owner when creating a
    new inode.

    Reported by: Ty Young
    Signed-off-by: Steven J. Magnani
    Link: https://lore.kernel.org/r/20190827121359.9954-1-steve@digidescorp.com
    Signed-off-by: Jan Kara

    Steven J. Magnani
     

26 Aug, 2019

2 commits

  • Instead of relying on UDFFS_DEBUG define for debug printing, just use
    standard pr_debug() prints and rely on CONFIG_DYNAMIC_DEBUG
    infrastructure for enabling or disabling prints.

    Signed-off-by: Jan Kara

    Jan Kara
     
  • Windows is capable of creating UDF files having named streams.
    One example is the "Zone.Identifier" stream attached automatically
    to files downloaded from a network. See:
    https://msdn.microsoft.com/en-us/library/dn392609.aspx

    Modification of a file having one or more named streams in Linux causes
    the stream directory to become detached from the file, essentially leaking
    all blocks pertaining to the file's streams.

    Fix by saving off information about an inode's streams when reading it,
    for later use when its on-disk data is updated.

    Link: https://lore.kernel.org/r/20190814125002.10869-1-steve@digidescorp.com
    Signed-off-by: Steven J. Magnani
    Signed-off-by: Jan Kara

    Steven J. Magnani
     

01 Aug, 2019

1 commit

  • The UDF bitmap allocation code assumes that a recorded
    Unallocated Space Bitmap is compliant with ECMA-167 4/13,
    which requires that pad bytes between the end of the bitmap
    and the end of a logical block are all zero.

    When a recorded bitmap does not comply with this requirement,
    for example one padded with FF to the block boundary instead
    of 00, the allocator may "allocate" blocks that are outside
    the UDF partition extent. This can result in UDF volume descriptors
    being overwritten by file data or by partition-level descriptors,
    and in extreme cases, even in scribbling on a subsequent disk partition.

    Add a check that the block selected by the allocator actually
    resides within the UDF partition extent.

    Signed-off-by: Steven J. Magnani

    Link: https://lore.kernel.org/r/1564341552-129750-1-git-send-email-steve@digidescorp.com
    Signed-off-by: Jan Kara

    Steve Magnani
     

31 Jul, 2019

2 commits

  • Some UDF creators (specifically Microsoft, but perhaps others) mishandle
    the ECMA-167 corner case that requires descriptors within a Volume
    Recognition Sequence to be placed at 4096-byte intervals on media where
    the block size is 4K. Instead, the descriptors are placed at the 2048-
    byte interval mandated for media with smaller blocks. This nonconformity
    currently prevents Linux from recognizing the filesystem as UDF.

    Modify the driver to tolerate a misformatted VRS on 4K media.

    [JK: Simplified descriptor checking]
    Signed-off-by: Steven J. Magnani
    Tested-by: Steven J. Magnani
    Link: https://lore.kernel.org/r/20190711133852.16887-2-steve@digidescorp.com
    Signed-off-by: Jan Kara

    Steven J. Magnani
     
  • Extract code that parses a Volume Recognition Sequence descriptor
    (component), in preparation for calling it twice against different
    locations in a block.

    Signed-off-by: Steven J. Magnani
    Link: https://lore.kernel.org/r/20190711133852.16887-1-steve@digidescorp.com
    Signed-off-by: Jan Kara

    Steven J. Magnani
     

11 Jul, 2019

1 commit

  • Pull ext2, udf and quota updates from Jan Kara:

    - some ext2 fixes and cleanups

    - a fix of udf bug when extending files

    - a fix of quota Q_XGETQSTAT[V] handling

    * tag 'for_v5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
    udf: Fix incorrect final NOT_ALLOCATED (hole) extent length
    ext2: Use kmemdup rather than duplicating its implementation
    quota: honor quota type in Q_XGETQSTAT[V] calls
    ext2: Always brelse bh on failure in ext2_iget()
    ext2: add missing brelse() in ext2_iget()
    ext2: Fix a typo in ext2_getattr argument
    ext2: fix a typo in comment
    ext2: add missing brelse() in ext2_new_inode()
    ext2: optimize ext2_xattr_get()
    ext2: introduce new helper for xattr entry comparison
    ext2: merge xattr next entry check to ext2_xattr_entry_valid()
    ext2: code cleanup for ext2_preread_inode()
    ext2: code cleanup by using test_opt() and clear_opt()
    doc: ext2: update description of quota options for ext2
    ext2: Strengthen xattr block checks
    ext2: Merge loops in ext2_xattr_set()
    ext2: introduce helper for xattr entry validation
    ext2: introduce helper for xattr header validation
    quota: add dqi_dirty_list description to comment of Dquot List Management

    Linus Torvalds
     

10 Jul, 2019

1 commit

  • In some cases, using the 'truncate' command to extend a UDF file results
    in a mismatch between the length of the file's extents (specifically, due
    to incorrect length of the final NOT_ALLOCATED extent) and the information
    (file) length. The discrepancy can prevent other operating systems
    (i.e., Windows 10) from opening the file.

    Two particular errors have been observed when extending a file:

    1. The final extent is larger than it should be, having been rounded up
    to a multiple of the block size.

    B. The final extent is not shorter than it should be, due to not having
    been updated when the file's information length was increased.

    [JK: simplified udf_do_extend_final_block(), fixed up some types]

    Fixes: 2c948b3f86e5 ("udf: Avoid IO in udf_clear_inode")
    CC: stable@vger.kernel.org
    Signed-off-by: Steven J. Magnani
    Link: https://lore.kernel.org/r/1561948775-5878-1-git-send-email-steve@digidescorp.com
    Signed-off-by: Jan Kara

    Steven J. Magnani
     

21 May, 2019

1 commit