26 Oct, 2020

1 commit


18 Sep, 2020

1 commit

  • Fix some potential memory leaks in error handling branches while
    iterating xattr entries. For example, function ubifs_tnc_remove_ino()
    forgets to free pxent if it exists. Similar problems also exist in
    ubifs_purge_xattrs(), ubifs_add_orphan() and ubifs_jnl_write_inode().

    Signed-off-by: Zhihao Cheng
    Cc:
    Fixes: 1e51764a3c2ac05a2 ("UBIFS: add new flash file system")
    Signed-off-by: Richard Weinberger

    Zhihao Cheng
     

06 Nov, 2019

1 commit

  • Add a flag option to get xattr method that could have a bit flag of
    XATTR_NOSECURITY passed to it. XATTR_NOSECURITY is generally then
    set in the __vfs_getxattr path when called by security
    infrastructure.

    This handles the case of a union filesystem driver that is being
    requested by the security layer to report back the xattr data.

    For the use case where access is to be blocked by the security layer.

    The path then could be security(dentry) ->
    __vfs_getxattr(dentry...XATTR_NOSECURITY) ->
    handler->get(dentry...XATTR_NOSECURITY) ->
    __vfs_getxattr(lower_dentry...XATTR_NOSECURITY) ->
    lower_handler->get(lower_dentry...XATTR_NOSECURITY)
    which would report back through the chain data and success as
    expected, the logging security layer at the top would have the
    data to determine the access permissions and report back the target
    context that was blocked.

    Without the get handler flag, the path on a union filesystem would be
    the errant security(dentry) -> __vfs_getxattr(dentry) ->
    handler->get(dentry) -> vfs_getxattr(lower_dentry) -> nested ->
    security(lower_dentry, log off) -> lower_handler->get(lower_dentry)
    which would report back through the chain no data, and -EACCES.

    For selinux for both cases, this would translate to a correctly
    determined blocked access. In the first case with this change a correct avc
    log would be reported, in the second legacy case an incorrect avc log
    would be reported against an uninitialized u:object_r:unlabeled:s0
    context making the logs cosmetically useless for audit2allow.

    This patch series is inert and is the wide-spread addition of the
    flags option for xattr functions, and a replacement of __vfs_getxattr
    with __vfs_getxattr(...XATTR_NOSECURITY).

    Signed-off-by: Mark Salyzyn
    Reviewed-by: Jan Kara
    Acked-by: Jan Kara
    Acked-by: Jeff Layton
    Acked-by: David Sterba
    Acked-by: Darrick J. Wong
    Acked-by: Mike Marshall
    Cc: Stephen Smalley
    Cc: linux-kernel@vger.kernel.org
    Cc: kernel-team@android.com
    Cc: linux-security-module@vger.kernel.org

    (cherry picked from (rejected from archive because of too many recipients))
    Signed-off-by: Mark Salyzyn
    Bug: 133515582
    Bug: 136124883
    Bug: 129319403
    Change-Id: Iabbb8771939d5f66667a26bb23ddf4c562c349a1

    Mark Salyzyn
     

05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation this program is
    distributed in the hope that it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details you should have received a copy of the gnu general
    public license along with this program if not write to the free
    software foundation inc 51 franklin st fifth floor boston ma 02110
    1301 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 246 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Alexios Zavras
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190530000436.674189849@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

16 May, 2019

1 commit

  • UBIFS stores inode numbers as LE64 integers.
    We have to convert them to host oder, otherwise
    BE hosts won't be able to use the integer correctly.

    Reported-by: kbuild test robot
    Fixes: 9ca2d7326444 ("ubifs: Limit number of xattrs per inode")
    Signed-off-by: Richard Weinberger

    Richard Weinberger
     

08 May, 2019

1 commit

  • Since we have to write one deletion inode per xattr
    into the journal, limit the max number of xattrs.

    In theory UBIFS supported up to 65535 xattrs per inode.
    But this never worked correctly, expect no powercuts happened.
    Now we support only as many xattrs as we can store in 50% of a
    LEB.
    Even for tiny flashes this allows dozens of xattrs per inode,
    which is for an embedded filesystem still fine.

    In case someone has existing inodes with much more xattrs, it is
    still possible to delete them.
    UBIFS will fall back to an non-atomic deletion mode.

    Reported-by: Stefan Agner
    Fixes: 1e51764a3c2ac ("UBIFS: add new flash file system")
    Signed-off-by: Richard Weinberger

    Richard Weinberger
     

21 Sep, 2018

1 commit

  • This reverts commit 11a6fc3dc743e22fb50f2196ec55bee5140d3c52.
    UBIFS wants to assert that xattr operations are only issued on files
    with positive link count. The said patch made this operations return
    -ENOENT for unlinked files such that the asserts will no longer trigger.
    This was wrong since xattr operations are perfectly fine on unlinked
    files.
    Instead the assertions need to be fixed/removed.

    Cc:
    Fixes: 11a6fc3dc743 ("ubifs: xattr: Don't operate on deleted inodes")
    Reported-by: Koen Vandeputte
    Tested-by: Joel Stanley
    Signed-off-by: Richard Weinberger

    Richard Weinberger
     

15 Aug, 2018

2 commits


07 Jun, 2018

1 commit

  • Originally, Yang Dongsheng added quota support
    for ubifs, but it turned out upstream won't accept it.

    Since ubifs don't touch any quota code, S_NOQUOTA flag
    is misguided here, and currently it is mainly used to
    avoid recursion for system quota files.

    Let's make things clearly and remove unnecessary and
    misguied quota flags here.

    Reported-by: Rock Lee
    Signed-off-by: Wang Shilong
    Signed-off-by: Richard Weinberger

    Wang Shilong
     

18 Jan, 2018

1 commit

  • There is a situation that other modules, like overlayfs, try to get
    xattr value with a small buffer, if they get -ERANGE, they will try
    again with the proper buffer size. No need to report an error.

    Signed-off-by: Rock Lee
    Signed-off-by: Richard Weinberger

    Rock Lee
     

19 Oct, 2017

1 commit

  • Introduce a flag S_ENCRYPTED which can be set in ->i_flags to indicate
    that the inode is encrypted using the fscrypt (fs/crypto/) mechanism.

    Checking this flag will give the same information that
    inode->i_sb->s_cop->is_encrypted(inode) currently does, but will be more
    efficient. This will be useful for adding higher-level helper functions
    for filesystems to use. For example we'll be able to replace this:

    if (ext4_encrypted_inode(inode)) {
    ret = fscrypt_get_encryption_info(inode);
    if (ret)
    return ret;
    if (!fscrypt_has_encryption_key(inode))
    return -ENOKEY;
    }

    with this:

    ret = fscrypt_require_key(inode);
    if (ret)
    return ret;

    ... since we'll be able to retain the fast path for unencrypted files as
    a single flag check, using an inline function. This wasn't possible
    before because we'd have had to frequently call through the
    ->i_sb->s_cop->is_encrypted function pointer, even when the encryption
    support was disabled or not being used.

    Note: we don't define S_ENCRYPTED to 0 if CONFIG_FS_ENCRYPTION is
    disabled because we want to continue to return an error if an encrypted
    file is accessed without encryption support, rather than pretending that
    it is unencrypted.

    Reviewed-by: Chao Yu
    Acked-by: Dave Chinner
    Signed-off-by: Eric Biggers
    Signed-off-by: Theodore Ts'o

    Eric Biggers
     

15 Jul, 2017

2 commits

  • The inode is not locked in init_xattrs when creating a new inode.

    Without this patch, there will occurs assert when booting or creating
    a new file, if the kernel config CONFIG_SECURITY_SMACK is enabled.

    Log likes:

    UBIFS assert failed in ubifs_xattr_set at 298 (pid 1156)
    CPU: 1 PID: 1156 Comm: ldconfig Tainted: G S 4.12.0-rc1-207440-g1e70b02 #2
    Hardware name: MediaTek MT2712 evaluation board (DT)
    Call trace:
    [] dump_backtrace+0x0/0x238
    [] show_stack+0x14/0x20
    [] dump_stack+0x9c/0xc0
    [] ubifs_xattr_set+0x374/0x5e0
    [] init_xattrs+0x5c/0xb8
    [] security_inode_init_security+0x110/0x190
    [] ubifs_init_security+0x30/0x68
    [] ubifs_mkdir+0x100/0x200
    [] vfs_mkdir+0x11c/0x1b8
    [] SyS_mkdirat+0x74/0xd0
    [] __sys_trace_return+0x0/0x4

    Signed-off-by: Xiaolei Li
    Signed-off-by: Richard Weinberger

    Xiaolei Li
     
  • UBIFS handles extended attributes just like files, as consequence of
    that, they also have inodes.
    Therefore UBIFS does all the inode machinery also for xattrs. Since new
    inodes have i_nlink of 1, a file or xattr inode will be evicted
    if i_nlink goes down to 0 after an unlink. UBIFS assumes this model also
    for xattrs, which is not correct.
    One can create a file "foo" with xattr "user.test". By reading
    "user.test" an inode will be created, and by deleting "user.test" it
    will get evicted later. The assumption breaks if the file "foo", which
    hosts the xattrs, will be removed. VFS nor UBIFS does not remove each
    xattr via ubifs_xattr_remove(), it just removes the host inode from
    the TNC and all underlying xattr nodes too and the inode will remain
    in the cache and wastes memory.

    To solve this problem, remove xattr inodes from the VFS inode cache in
    ubifs_xattr_remove() to make sure that they get evicted.

    Fixes: 1e51764a3c2ac05a ("UBIFS: add new flash file system")
    Cc:
    Signed-off-by: Richard Weinberger

    Richard Weinberger
     

14 May, 2017

1 commit

  • Pull UBI/UBIFS updates from Richard Weinberger:

    - new config option CONFIG_UBIFS_FS_SECURITY

    - minor improvements

    - random fixes

    * tag 'upstream-4.12-rc1' of git://git.infradead.org/linux-ubifs:
    ubi: Add debugfs file for tracking PEB state
    ubifs: Fix a typo in comment of ioctl2ubifs & ubifs2ioctl
    ubifs: Remove unnecessary assignment
    ubifs: Fix cut and paste error on sb type comparisons
    ubi: fastmap: Fix slab corruption
    ubifs: Add CONFIG_UBIFS_FS_SECURITY to disable/enable security labels
    ubi: Make mtd parameter readable
    ubi: Fix section mismatch

    Linus Torvalds
     

09 May, 2017

2 commits

  • 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 transition CURRENT_TIME_SEC to use y2038 safe time interfaces.

    current_time() returns timestamps according to the granularities set in
    the inode's super_block. The granularity check to call
    current_fs_time() or CURRENT_TIME_SEC is not required.

    Use current_time() directly to update inode timestamp. Use
    timespec_trunc during file system creation, before the first inode is
    created.

    Link: http://lkml.kernel.org/r/1491613030-11599-9-git-send-email-deepa.kernel@gmail.com
    Signed-off-by: Deepa Dinamani
    Reviewed-by: Arnd Bergmann
    Cc: Richard Weinberger
    Cc: Artem Bityutskiy
    Cc: Adrian Hunter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Deepa Dinamani
     
  • When write syscall is called, every time security label is searched to
    determine that file's privileges should be changed.
    If LSM(Linux Security Model) is not used, this is useless.

    So introduce CONFIG_UBIFS_SECURITY to disable security labels. it's default
    value is "y".

    Signed-off-by: Hyunchul Lee
    Signed-off-by: Richard Weinberger

    Hyunchul Lee
     

13 Dec, 2016

5 commits


20 Oct, 2016

1 commit


03 Oct, 2016

1 commit

  • When an extended attribute is changed, xattr_len of host inode is
    recalculated. ui->data_len is updated before computation and result
    is wrong. This patch adds a temporary variable to fix computation.

    To reproduce the issue:

    ~# > a.txt
    ~# attr -s an-attr -V a-value a.txt
    ~# attr -s an-attr -V a-bit-bigger-value a.txt

    Now host inode xattr_len is wrong. Forcing dbg_check_filesystem()
    generates the following error:

    [ 130.620140] UBIFS (ubi0:2): background thread "ubifs_bgt0_2" started, PID 565
    [ 131.470790] UBIFS error (ubi0:2 pid 564): check_inodes: inode 646 has xattr size 240, but calculated size is 256
    [ 131.481697] UBIFS (ubi0:2): dump of the inode 646 sitting in LEB 29:114688
    [ 131.488953] magic 0x6101831
    [ 131.492876] crc 0x9fce9091
    [ 131.496836] node_type 0 (inode node)
    [ 131.501193] group_type 1 (in node group)
    [ 131.505788] sqnum 9278
    [ 131.509191] len 160
    [ 131.512549] key (646, inode)
    [ 131.516688] creat_sqnum 9270
    [ 131.520133] size 0
    [ 131.523264] nlink 1
    [ 131.526398] atime 1053025857.0
    [ 131.530574] mtime 1053025857.0
    [ 131.534714] ctime 1053025906.0
    [ 131.538849] uid 0
    [ 131.542009] gid 0
    [ 131.545140] mode 33188
    [ 131.548636] flags 0x1
    [ 131.551977] xattr_cnt 1
    [ 131.555108] xattr_size 240
    [ 131.558420] xattr_names 12
    [ 131.561670] compr_type 0x1
    [ 131.564983] data len 0
    [ 131.568125] UBIFS error (ubi0:2 pid 564): dbg_check_filesystem: file-system check failed with error -22
    [ 131.578074] CPU: 0 PID: 564 Comm: mount Not tainted 4.4.12-g3639bea54a #24
    [ 131.585352] Hardware name: Generic AM33XX (Flattened Device Tree)
    [ 131.591918] [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
    [ 131.600177] [] (show_stack) from [] (dbg_check_filesystem+0x464/0x4d0)
    [ 131.608934] [] (dbg_check_filesystem) from [] (ubifs_mount+0x14f8/0x2130)
    [ 131.617991] [] (ubifs_mount) from [] (mount_fs+0x14/0x98)
    [ 131.625572] [] (mount_fs) from [] (vfs_kern_mount+0x4c/0xd4)
    [ 131.633435] [] (vfs_kern_mount) from [] (do_mount+0x988/0xb50)
    [ 131.641471] [] (do_mount) from [] (SyS_mount+0x74/0xa0)
    [ 131.648837] [] (SyS_mount) from [] (ret_fast_syscall+0x0/0x3c)
    [ 131.665315] UBIFS (ubi0:2): background thread "ubifs_bgt0_2" stops

    Signed-off-by: Pascal Eberhard
    Signed-off-by: Richard Weinberger

    Pascal Eberhard
     

24 Aug, 2016

1 commit

  • UBIFS uses full names to work with xattrs, therefore we have to use
    xattr_full_name() to obtain the xattr prefix as string.

    Cc:
    Cc: Andreas Gruenbacher
    Fixes: 2b88fc21ca ("ubifs: Switch to generic xattr handlers")
    Signed-off-by: Richard Weinberger
    Reviewed-by: Andreas Gruenbacher
    Tested-by: Dongsheng Yang

    Richard Weinberger
     

29 Jul, 2016

1 commit

  • Fix sparse warnings from the use of "struct xattr_handler"
    structures that are not exported by making them static. Fixes
    the following sparse warnings:

    /fs/ubifs/xattr.c:595:28: warning: symbol 'ubifs_user_xattr_handler' was not declared. Should it be static?
    /fs/ubifs/xattr.c:601:28: warning: symbol 'ubifs_trusted_xattr_handler' was not declared. Should it be static?
    /fs/ubifs/xattr.c:607:28: warning: symbol 'ubifs_security_xattr_handler' was not declared. Should it be static?

    Signed-off-by: Ben Dooks
    Signed-off-by: Richard Weinberger

    Ben Dooks
     

28 May, 2016

1 commit


18 May, 2016

1 commit

  • Ubifs internally uses special inodes for storing xattrs. Those inodes
    had NULL {get,set,remove}xattr inode operations before this change, so
    xattr operations on them would fail. The super block's s_xattr field
    would also apply to those special inodes. However, the inodes are not
    visible outside of ubifs, and so no xattr operations will ever be
    carried out on them anyway.

    Signed-off-by: Andreas Gruenbacher
    Reviewed-by: Richard Weinberger
    Signed-off-by: Al Viro

    Andreas Gruenbacher
     

11 Apr, 2016

1 commit


21 Mar, 2016

1 commit


23 Jan, 2016

1 commit

  • parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
    inode_foo(inode) being mutex_foo(&inode->i_mutex).

    Please, use those for access to ->i_mutex; over the coming cycle
    ->i_mutex will become rwsem, with ->lookup() done with it held
    only shared.

    Signed-off-by: Al Viro

    Al Viro
     

10 Jan, 2016

1 commit


14 Nov, 2015

2 commits

  • Pull vfs xattr cleanups from Al Viro.

    * 'for-linus-3' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    f2fs: xattr simplifications
    squashfs: xattr simplifications
    9p: xattr simplifications
    xattr handlers: Pass handler to operations instead of flags
    jffs2: Add missing capability check for listing trusted xattrs
    hfsplus: Remove unused xattr handler list operations
    ubifs: Remove unused security xattr handler
    vfs: Fix the posix_acl_xattr_list return value
    vfs: Check attribute names in posix acl xattr handers

    Linus Torvalds
     
  • Ubifs installs a security xattr handler in sb->s_xattr but doesn't use the
    generic_{get,set,list,remove}xattr inode operations needed for processing
    this list of attribute handlers; the handler is never called. Instead,
    ubifs uses its own xattr handlers which also process security xattrs.

    Remove the dead code.

    Signed-off-by: Andreas Gruenbacher
    Reviewed-by: Richard Weinberger
    Cc: Artem Bityutskiy
    Cc: Adrian Hunter
    Cc: linux-mtd@lists.infradead.org
    Cc: Subodh Nijsure
    Signed-off-by: Al Viro

    Andreas Gruenbacher
     

11 Nov, 2015

1 commit

  • Pull UBI/UBIFS updates from Richard Weinberger:

    - access time support for UBIFS by Dongsheng Yang

    - random cleanups and bug fixes all over the place

    * tag 'upstream-4.4-rc1' of git://git.infradead.org/linux-ubifs:
    ubifs: introduce UBIFS_ATIME_SUPPORT to ubifs
    ubifs: make ubifs_[get|set]xattr atomic
    UBIFS: Delete unnecessary checks before the function call "iput"
    UBI: Remove in vain semicolon
    UBI: Fastmap: Fix PEB array type
    UBIFS: Fix possible memory leak in ubifs_readdir()
    fs/ubifs: remove unnecessary new_valid_dev check
    ubi: fastmap: Implement produce_free_peb()
    UBIFS: print verbose message when rescanning a corrupted node
    UBIFS: call dbg_is_power_cut() instead of reading c->dbg->pc_happened
    UBI: drop null test before destroy functions
    UBI: Update comments to reflect UBI_METAONLY flag
    UBI: Fix debug message
    UBI: Fix typo in comment
    UBI: Fastmap: Simplify expression
    UBIFS: fix a typo in comment of ubifs_budget_req
    UBIFS: use kmemdup rather than duplicating its implementation

    Linus Torvalds
     

07 Nov, 2015

1 commit

  • This commit make the ubifs_[get|set]xattr protected by ui_mutex.

    Originally, there is a possibility that ubifs_getxattr to get
    a wrong value.

    P1 P2
    ---------- ----------
    ubifs_getxattr ubifs_setxattr
    - kfree()
    - memcpy()
    - kmemdup()

    Then ubifs_getxattr() would get a non-sense data. To solve this
    problem, this commit make the xattr of ubifs_inode updated in
    atomic.

    Signed-off-by: Dongsheng Yang
    Signed-off-by: Richard Weinberger

    Dongsheng Yang
     

29 Sep, 2015

1 commit

  • Fixes the following lockdep splat:
    [ 1.244527] =============================================
    [ 1.245193] [ INFO: possible recursive locking detected ]
    [ 1.245193] 4.2.0-rc1+ #37 Not tainted
    [ 1.245193] ---------------------------------------------
    [ 1.245193] cp/742 is trying to acquire lock:
    [ 1.245193] (&sb->s_type->i_mutex_key#9){+.+.+.}, at: [] ubifs_init_security+0x29/0xb0
    [ 1.245193]
    [ 1.245193] but task is already holding lock:
    [ 1.245193] (&sb->s_type->i_mutex_key#9){+.+.+.}, at: [] path_openat+0x3af/0x1280
    [ 1.245193]
    [ 1.245193] other info that might help us debug this:
    [ 1.245193] Possible unsafe locking scenario:
    [ 1.245193]
    [ 1.245193] CPU0
    [ 1.245193] ----
    [ 1.245193] lock(&sb->s_type->i_mutex_key#9);
    [ 1.245193] lock(&sb->s_type->i_mutex_key#9);
    [ 1.245193]
    [ 1.245193] *** DEADLOCK ***
    [ 1.245193]
    [ 1.245193] May be due to missing lock nesting notation
    [ 1.245193]
    [ 1.245193] 2 locks held by cp/742:
    [ 1.245193] #0: (sb_writers#5){.+.+.+}, at: [] mnt_want_write+0x1f/0x50
    [ 1.245193] #1: (&sb->s_type->i_mutex_key#9){+.+.+.}, at: [] path_openat+0x3af/0x1280
    [ 1.245193]
    [ 1.245193] stack backtrace:
    [ 1.245193] CPU: 2 PID: 742 Comm: cp Not tainted 4.2.0-rc1+ #37
    [ 1.245193] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.7.5-0-ge51488c-20140816_022509-build35 04/01/2014
    [ 1.245193] ffffffff8252d530 ffff88007b023a38 ffffffff814f6f49 ffffffff810b56c5
    [ 1.245193] ffff88007c30cc80 ffff88007b023af8 ffffffff810a150d ffff88007b023a68
    [ 1.245193] 000000008101302a ffff880000000000 00000008f447e23f ffffffff8252d500
    [ 1.245193] Call Trace:
    [ 1.245193] [] dump_stack+0x4c/0x65
    [ 1.245193] [] ? console_unlock+0x1c5/0x510
    [ 1.245193] [] __lock_acquire+0x1a6d/0x1ea0
    [ 1.245193] [] ? __lock_is_held+0x58/0x80
    [ 1.245193] [] lock_acquire+0xd3/0x270
    [ 1.245193] [] ? ubifs_init_security+0x29/0xb0
    [ 1.245193] [] mutex_lock_nested+0x6b/0x3a0
    [ 1.245193] [] ? ubifs_init_security+0x29/0xb0
    [ 1.245193] [] ? ubifs_init_security+0x29/0xb0
    [ 1.245193] [] ubifs_init_security+0x29/0xb0
    [ 1.245193] [] ubifs_create+0xa6/0x1f0
    [ 1.245193] [] ? path_openat+0x3af/0x1280
    [ 1.245193] [] vfs_create+0x95/0xc0
    [ 1.245193] [] path_openat+0x7cc/0x1280
    [ 1.245193] [] ? __lock_acquire+0x543/0x1ea0
    [ 1.245193] [] ? sched_clock_cpu+0x90/0xc0
    [ 1.245193] [] ? calc_global_load_tick+0x60/0x90
    [ 1.245193] [] ? sched_clock_cpu+0x90/0xc0
    [ 1.245193] [] ? __alloc_fd+0xaf/0x180
    [ 1.245193] [] do_filp_open+0x75/0xd0
    [ 1.245193] [] ? _raw_spin_unlock+0x26/0x40
    [ 1.245193] [] ? __alloc_fd+0xaf/0x180
    [ 1.245193] [] do_sys_open+0x129/0x200
    [ 1.245193] [] SyS_open+0x19/0x20
    [ 1.245193] [] entry_SYSCALL_64_fastpath+0x12/0x6f

    While the lockdep splat is a false positive, becuase path_openat holds i_mutex
    of the parent directory and ubifs_init_security() tries to acquire i_mutex
    of a new inode, it reveals that taking i_mutex in ubifs_init_security() is
    in vain because it is only being called in the inode allocation path
    and therefore nobody else can see the inode yet.

    Cc: stable@vger.kernel.org # 3.20-
    Reported-and-tested-by: Boris Brezillon
    Reviewed-and-tested-by: Dongsheng Yang
    Signed-off-by: Richard Weinberger
    Signed-off-by: dedekind1@gmail.com

    Richard Weinberger
     

27 Apr, 2015

1 commit

  • Pull fourth vfs update from Al Viro:
    "d_inode() annotations from David Howells (sat in for-next since before
    the beginning of merge window) + four assorted fixes"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    RCU pathwalk breakage when running into a symlink overmounting something
    fix I_DIO_WAKEUP definition
    direct-io: only inc/dec inode->i_dio_count for file systems
    fs/9p: fix readdir()
    VFS: assorted d_backing_inode() annotations
    VFS: fs/inode.c helpers: d_inode() annotations
    VFS: fs/cachefiles: d_backing_inode() annotations
    VFS: fs library helpers: d_inode() annotations
    VFS: assorted weird filesystems: d_inode() annotations
    VFS: normal filesystems (and lustre): d_inode() annotations
    VFS: security/: d_inode() annotations
    VFS: security/: d_backing_inode() annotations
    VFS: net/: d_inode() annotations
    VFS: net/unix: d_backing_inode() annotations
    VFS: kernel/: d_inode() annotations
    VFS: audit: d_backing_inode() annotations
    VFS: Fix up some ->d_inode accesses in the chelsio driver
    VFS: Cachefiles should perform fs modifications on the top layer only
    VFS: AF_UNIX sockets should call mknod on the top layer only

    Linus Torvalds
     

16 Apr, 2015

1 commit


25 Mar, 2015

1 commit

  • In the case where we have more than one volumes on different UBI
    devices, it may be not that easy to tell which volume prints the
    messages. Add ubi number and volume id in ubifs_msg/warn/error
    to help debug. These two values are passed by struct ubifs_info.

    For those where ubifs_info is not initialized yet, ubifs_* is
    replaced by pr_*. For those where ubifs_info is not avaliable,
    ubifs_info is passed to the calling function as a const parameter.

    The output looks like,

    [ 95.444879] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 696
    [ 95.484688] UBIFS (ubi0:1): UBIFS: mounted UBI device 0, volume 1, name "test1"
    [ 95.484694] UBIFS (ubi0:1): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
    [ 95.484699] UBIFS (ubi0:1): FS size: 30220288 bytes (28 MiB, 238 LEBs), journal size 1523712 bytes (1 MiB, 12 LEBs)
    [ 95.484703] UBIFS (ubi0:1): reserved for root: 1427378 bytes (1393 KiB)
    [ 95.484709] UBIFS (ubi0:1): media format: w4/r0 (latest is w4/r0), UUID 40DFFC0E-70BE-4193-8905-F7D6DFE60B17, small LPT model
    [ 95.489875] UBIFS (ubi1:0): background thread "ubifs_bgt1_0" started, PID 699
    [ 95.529713] UBIFS (ubi1:0): UBIFS: mounted UBI device 1, volume 0, name "test2"
    [ 95.529718] UBIFS (ubi1:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
    [ 95.529724] UBIFS (ubi1:0): FS size: 19808256 bytes (18 MiB, 156 LEBs), journal size 1015809 bytes (0 MiB, 8 LEBs)
    [ 95.529727] UBIFS (ubi1:0): reserved for root: 935592 bytes (913 KiB)
    [ 95.529733] UBIFS (ubi1:0): media format: w4/r0 (latest is w4/r0), UUID EEB7779D-F419-4CA9-811B-831CAC7233D4, small LPT model

    [ 954.264767] UBIFS error (ubi1:0 pid 756): ubifs_read_node: bad node type (255 but expected 6)
    [ 954.367030] UBIFS error (ubi1:0 pid 756): ubifs_read_node: bad node at LEB 0:0, LEB mapping status 1

    Signed-off-by: Sheng Yong
    Signed-off-by: Artem Bityutskiy

    Sheng Yong