1. 28 Oct, 2023 18 commits
    • Zhihao Cheng's avatar
      ubifs: ubifs_link: Fix wrong name len calculating when UBIFS is encrypted · 75690493
      Zhihao Cheng authored
      The length of dentry name is calculated after the raw name is encrypted,
      except for ubifs_link(), which could make the size of dir underflow.
      Here is a reproducer:
      
       touch $TMP/file
       mkdir $TMP/dir
       stat $TMP/dir
       for i in $(seq 1 8)
       do
         ln $TMP/file $TMP/dir/$i
         unlink $TMP/dir/$i
       done
       stat $TMP/dir
      
      The size of dir will be underflow(-96).
      
      Fix it by calculating dentry name's length after the name is encrypted.
      
      Fixes: f4f61d2c ("ubifs: Implement encrypted filenames")
      Reported-by: default avatarRoland Ruckerbauer <roland.ruckerbauer@robart.cc>
      Link: https://lore.kernel.org/linux-mtd/1638777819.2925845.1695222544742.JavaMail.zimbra@robart.cc/T/#uSigned-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      75690493
    • ZhaoLong Wang's avatar
      ubi: block: Fix use-after-free in ubiblock_cleanup · d07cec9c
      ZhaoLong Wang authored
      The following BUG is reported when a ubiblock is removed:
      
       ==================================================================
       BUG: KASAN: slab-use-after-free in ubiblock_cleanup+0x88/0xa0 [ubi]
       Read of size 4 at addr ffff88810c8f3804 by task ubiblock/1716
      
       CPU: 5 PID: 1716 Comm: ubiblock Not tainted 6.6.0-rc2+ #135
       Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_073836-buildvm-ppc64le-16.ppc.fedoraproject.org-3.fc31 04/01/2014
       Call Trace:
        <TASK>
        dump_stack_lvl+0x37/0x50
        print_report+0xd0/0x620
        kasan_report+0xb6/0xf0
        ubiblock_cleanup+0x88/0xa0 [ubi]
        ubiblock_remove+0x121/0x190 [ubi]
        vol_cdev_ioctl+0x355/0x630 [ubi]
        __x64_sys_ioctl+0xc7/0x100
        do_syscall_64+0x3f/0x90
        entry_SYSCALL_64_after_hwframe+0x6e/0xd8
       RIP: 0033:0x7f08d7445577
       Code: b3 66 90 48 8b 05 11 89 2c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d e1 8
       RSP: 002b:00007ffde05a3018 EFLAGS: 00000206 ORIG_RAX: 0000000000000010
       RAX: ffffffffffffffda RBX: 00000000ffffffff RCX: 00007f08d7445577
       RDX: 0000000000000000 RSI: 0000000000004f08 RDI: 0000000000000003
       RBP: 0000000000816010 R08: 00000000008163a7 R09: 0000000000000000
       R10: 0000000000000003 R11: 0000000000000206 R12: 0000000000000003
       R13: 00007ffde05a3130 R14: 0000000000000000 R15: 0000000000000000
        </TASK>
      
       Allocated by task 1715:
        kasan_save_stack+0x22/0x50
        kasan_set_track+0x25/0x30
        __kasan_kmalloc+0x7f/0x90
        __alloc_disk_node+0x40/0x2b0
        __blk_mq_alloc_disk+0x3e/0xb0
        ubiblock_create+0x2ba/0x620 [ubi]
        vol_cdev_ioctl+0x581/0x630 [ubi]
        __x64_sys_ioctl+0xc7/0x100
        do_syscall_64+0x3f/0x90
        entry_SYSCALL_64_after_hwframe+0x6e/0xd8
      
       Freed by task 0:
        kasan_save_stack+0x22/0x50
        kasan_set_track+0x25/0x30
        kasan_save_free_info+0x2b/0x50
        __kasan_slab_free+0x10e/0x190
        __kmem_cache_free+0x96/0x220
        bdev_free_inode+0xa4/0xf0
        rcu_core+0x496/0xec0
        __do_softirq+0xeb/0x384
      
       The buggy address belongs to the object at ffff88810c8f3800
        which belongs to the cache kmalloc-1k of size 1024
       The buggy address is located 4 bytes inside of
        freed 1024-byte region [ffff88810c8f3800, ffff88810c8f3c00)
      
       The buggy address belongs to the physical page:
       page:00000000d03de848 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10c8f0
       head:00000000d03de848 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
       flags: 0x200000000000840(slab|head|node=0|zone=2)
       page_type: 0xffffffff()
       raw: 0200000000000840 ffff888100042dc0 ffffea0004244400 dead000000000002
       raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
       page dumped because: kasan: bad access detected
      
       Memory state around the buggy address:
        ffff88810c8f3700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
        ffff88810c8f3780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
       >ffff88810c8f3800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                          ^
        ffff88810c8f3880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
        ffff88810c8f3900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
       ==================================================================
      
      Fix it by using a local variable to record the gendisk ID.
      
      Fixes: 77567b25 ("ubi: use blk_mq_alloc_disk and blk_cleanup_disk")
      Signed-off-by: default avatarZhaoLong Wang <wangzhaolong1@huawei.com>
      Reviewed-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      d07cec9c
    • Konstantin Meskhidze's avatar
      ubifs: fix possible dereference after free · d81efd66
      Konstantin Meskhidze authored
      'old_idx' could be dereferenced after free via 'rb_link_node' function
      call.
      
      Fixes: b5fda08e ("ubifs: Fix memleak when insert_old_idx() failed")
      Co-developed-by: default avatarIvanov Mikhail <ivanov.mikhail1@huawei-partners.com>
      Signed-off-by: default avatarKonstantin Meskhidze <konstantin.meskhidze@huawei.com>
      Reviewed-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      d81efd66
    • Zhihao Cheng's avatar
      ubi: fastmap: Add control in 'UBI_IOCATT' ioctl to reserve PEBs for filling pools · ac085cfe
      Zhihao Cheng authored
      This patch imports a new field 'need_resv_pool' in struct 'ubi_attach_req'
      to control whether or not reserving free PEBs for filling pool/wl_pool.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=217787Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      ac085cfe
    • Zhihao Cheng's avatar
      ubi: fastmap: Add module parameter to control reserving filling pool PEBs · d4c48e5b
      Zhihao Cheng authored
      Adding 6th module parameter in 'mtd=xxx' to control whether or not
      reserving PEBs for filling pool/wl_pool.
      Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      d4c48e5b
    • Zhihao Cheng's avatar
      ubi: fastmap: Fix lapsed wear leveling for first 64 PEBs · 90e0be56
      Zhihao Cheng authored
      The anchor PEB must be picked from first 64 PEBs, these PEBs could have
      large erase counter greater than other PEBs especially when free space
      is nearly running out.
      The ubi_update_fastmap will be called as long as pool/wl_pool is empty,
      old anchor PEB is erased when updating fastmap. Given an UBI device with
      N PEBs, free PEBs is nearly running out and pool will be filled with 1
      PEB every time ubi_update_fastmap invoked. So t=N/POOL_SIZE[1]/64 means
      that in worst case the erase counter of first 64 PEBs is t times greater
      than other PEBs in theory.
      After running fsstress for 24h, the erase counter statistics for two UBI
      devices shown as follow(CONFIG_MTD_UBI_WL_THRESHOLD=128):
      
      Device A(1024 PEBs, pool=50, wl_pool=25):
      =========================================================
      from              to     count      min      avg      max
      ---------------------------------------------------------
      0        ..        9:        0        0        0        0
      10       ..       99:        0        0        0        0
      100      ..      999:        0        0        0        0
      1000     ..     9999:        0        0        0        0
      10000    ..    99999:      960    29224    29282    29362
      100000   ..      inf:       64   117897   117934   117940
      ---------------------------------------------------------
      Total               :     1024    29224    34822   117940
      
      Device B(8192 PEBs, pool=256, wl_pool=128):
      =========================================================
      from              to     count      min      avg      max
      ---------------------------------------------------------
      0        ..        9:        0        0        0        0
      10       ..       99:        0        0        0        0
      100      ..      999:        0        0        0        0
      1000     ..     9999:     8128     2253     2321     2387
      10000    ..    99999:       64    35387    35387    35388
      100000   ..      inf:        0        0        0        0
      ---------------------------------------------------------
      Total               :     8192     2253     2579    35388
      
      The key point is reducing fastmap updating frequency by enlarging
      POOL_SIZE, so let UBI reserve ubi->fm_pool.max_size PEBs during
      attaching. Then POOL_SIZE will become ubi->fm_pool.max_size/2 even
      in free space running out case.
      Given an UBI device with 8192 PEBs(16384\8192\4096 is common
      large-capacity flash), t=8192/128/64=1. The fastmap updating will
      happen in either wl_pool or pool is empty, so setting fm_pool_rsv_cnt
      as ubi->fm_pool.max_size can fill wl_pool in full state.
      
      After pool reservation, running fsstress for 24h:
      
      Device A(1024 PEBs, pool=50, wl_pool=25):
      =========================================================
      from              to     count      min      avg      max
      ---------------------------------------------------------
      0        ..        9:        0        0        0        0
      10       ..       99:        0        0        0        0
      100      ..      999:        0        0        0        0
      1000     ..     9999:        0        0        0        0
      10000    ..    99999:     1024    33801    33997    34056
      100000   ..      inf:        0        0        0        0
      ---------------------------------------------------------
      Total               :     1024    33801    33997    34056
      
      Device B(8192 PEBs, pool=256, wl_pool=128):
      =========================================================
      from              to     count      min      avg      max
      ---------------------------------------------------------
      0        ..        9:        0        0        0        0
      10       ..       99:        0        0        0        0
      100      ..      999:        0        0        0        0
      1000     ..     9999:     8192     2205     2397     2460
      10000    ..    99999:        0        0        0        0
      100000   ..      inf:        0        0        0        0
      ---------------------------------------------------------
      Total               :     8192     2205     2397     2460
      
      The difference of erase counter between first 64 PEBs and others is
      under WL_FREE_MAX_DIFF(2*UBI_WL_THRESHOLD=2*128=256).
        Device A: 34056 - 33801 = 255
        Device B: 2460 - 2205 = 255
      
      Next patch will add a switch to control whether UBI needs to reserve
      PEBs for filling pool.
      
      Fixes: dbb7d2a8 ("UBI: Add fastmap core")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=217787Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      90e0be56
    • Zhihao Cheng's avatar
      ubi: fastmap: Get wl PEB even ec beyonds the 'max' if free PEBs are run out · 761893bd
      Zhihao Cheng authored
      This is the part 2 to fix cyclically reusing single fastmap data PEBs.
      
      Consider one situation, if there are four free PEBs for fm_anchor, pool,
      wl_pool and fastmap data PEB with erase counter 100, 100, 100, 5096
      (ubi->beb_rsvd_pebs is 0). PEB with erase counter 5096 is always picked
      for fastmap data according to the realization of find_wl_entry(), since
      fastmap data PEB is not scheduled for wl, finally there are two PEBs
      (fm data) with great erase counter than other PEBS.
      Get wl PEB even its erase counter exceeds the 'max' in find_wl_entry()
      when free PEBs are run out after filling pools and fm data. Then the PEB
      with biggest erase conter is taken as wl PEB, it can be scheduled for wl.
      
      Fixes: dbb7d2a8 ("UBI: Add fastmap core")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=217787Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      761893bd
    • Zhihao Cheng's avatar
      ubi: fastmap: may_reserve_for_fm: Don't reserve PEB if fm_anchor exists · eada823e
      Zhihao Cheng authored
      This is the part 1 to fix cyclically reusing single fastmap data PEBs.
      
      After running fsstress on UBIFS for a while, UBI (16384 blocks, fastmap
      takes 2 blocks) has an erase block(PEB: 8031) with big erase counter
      greater than any other pebs:
      
      =========================================================
      from              to     count      min      avg      max
      ---------------------------------------------------------
      0        ..        9:        0        0        0        0
      10       ..       99:      532       84       92       99
      100      ..      999:    15787      100      147      229
      1000     ..     9999:       64     4699     4765     4826
      10000    ..    99999:        0        0        0        0
      100000   ..      inf:        1   272935   272935   272935
      ---------------------------------------------------------
      Total               :    16384       84      180   272935
      
      Not like fm_anchor, there is no candidate PEBs for fastmap data area,
      so old fastmap data pebs will be reused after all free pebs are filled
      into pool/wl_pool:
      ubi_update_fastmap
       for (i = 1; i < new_fm->used_blocks; i++)
        erase_block(ubi, old_fm->e[i]->pnum)
        new_fm->e[i] = old_fm->e[i]
      
      According to wear leveling algorithm, UBI selects one small erase
      counter PEB from ubi->used and one big erase counter PEB from wl_pool,
      the reused fastmap data PEB is not in these trees. UBI won't schedule
      this PEB for wl even it is in ubi->used because wl algorithm expects
      small erase counter for used PEB.
      
      Don't reserve PEB for fastmap in may_reserve_for_fm() if fm_anchor
      already exists. Otherwise, when UBI is running out of free PEBs,
      the only one free PEB (pnum < 64) will be skipped and fastmap data
      will be written on the same old PEB.
      
      Fixes: dbb7d2a8 ("UBI: Add fastmap core")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=217787Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      eada823e
    • Zhihao Cheng's avatar
      ubi: fastmap: Remove unneeded break condition while filling pools · 415e4723
      Zhihao Cheng authored
      Change pool filling stop condition. Commit d09e9a2b ("ubi:
      fastmap: Fix high cpu usage of ubi_bgt by making sure wl_pool
      not empty") reserves fastmap data PEBs after filling 1 PEB in
      wl_pool. Now wait_free_pebs_for_pool() makes enough free PEBs
      before filling pool, there will still be at least 1 PEB in pool
      and 1 PEB in wl_pool after doing ubi_refill_pools().
      Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      415e4723
    • Zhihao Cheng's avatar
      ubi: fastmap: Wait until there are enough free PEBs before filling pools · a2ea69da
      Zhihao Cheng authored
      Wait until there are enough free PEBs before filling pool/wl_pool,
      sometimes erase_worker is not scheduled in time, which causes two
      situations:
       A. There are few PEBs filled in pool, which makes ubi_update_fastmap
          is frequently called and leads first 64 PEBs are erased more times
          than other PEBs. So waiting free PEBs before filling pool reduces
          fastmap updating frequency and prolongs flash service life.
       B. In situation that space is nearly running out, ubi_refill_pools()
          cannot make sure pool and wl_pool are filled with free PEBs, caused
          by the delay of erase_worker. After this patch applied, there must
          exist free PEBs in pool after one call of ubi_update_fastmap.
      
      Besides, this patch is a preparetion for fixing large erase counter in
      fastmap data block and fixing lapsed wear leveling for first 64 PEBs.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=217787Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      a2ea69da
    • Zhihao Cheng's avatar
      ubi: fastmap: Use free pebs reserved for bad block handling · 8ff4e620
      Zhihao Cheng authored
      If new bad PEBs occur, UBI firstly consumes ubi->beb_rsvd_pebs, and then
      ubi->avail_pebs, finally UBI becomes read-only if above two items are 0,
      which means that the amount of PEBs for user volumes is not effected.
      Besides, UBI reserves count of free PBEs is ubi->beb_rsvd_pebs while
      filling wl pool or getting free PEBs, but ubi->avail_pebs is not reserved.
      So ubi->beb_rsvd_pebs and ubi->avail_pebs have nothing to do with the
      usage of free PEBs, UBI can use all free PEBs.
      
      Commit 78d6d497 ("UBI: Move fastmap specific functions out of wl.c")
      has removed beb_rsvd_pebs checking while filling pool. Now, don't reserve
      ubi->beb_rsvd_pebs while filling wl_pool. This will fill more PEBs in pool
      and also reduce fastmap updating frequency.
      
      Also remove beb_rsvd_pebs checking in ubi_wl_get_fm_peb.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=217787Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      8ff4e620
    • Zhihao Cheng's avatar
      ubi: Replace erase_block() with sync_erase() · c19286d7
      Zhihao Cheng authored
      Since erase_block() has same logic with sync_erase(), just replace it
      with sync_erase(), also rename 'sync_erase()' to 'ubi_sync_erase()'.
      Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      c19286d7
    • Zhihao Cheng's avatar
      ubi: fastmap: Allocate memory with GFP_NOFS in ubi_update_fastmap · a033ab4f
      Zhihao Cheng authored
      Function ubi_update_fastmap could be called in IO context, for example:
       ubifs_writepage
        do_writepage
         ubifs_jnl_write_data
          write_head
           ubifs_wbuf_write_nolock
            ubifs_leb_write
             ubi_leb_write
              ubi_eba_write_leb
      	 try_write_vid_and_data
      	  ubi_wl_get_peb
      	   ubi_update_fastmap
      	    erase_block
      
      So it's better to allocate memory with GFP_NOFS mode, in case waiting
      page writeback(dead loop).
      Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      a033ab4f
    • Zhihao Cheng's avatar
      ubi: fastmap: erase_block: Get erase counter from wl_entry rather than flash · 08a42678
      Zhihao Cheng authored
      Just like sync_erase() does, getting erase counter from wl_entry is
      faster than reading from flash.
      Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      08a42678
    • Zhihao Cheng's avatar
      ubi: fastmap: Fix missed ec updating after erasing old fastmap data block · 4d18b5a5
      Zhihao Cheng authored
      After running fsstress on ubifs for a long time, UBI(16384 blocks,
      fastmap takes 2 blocks) has an erase block with different erase
      counters displayed from two views:
      
      From ubiscan view: PEB 8031 has erase counter 31581
      =========================================================
      from              to     count      min      avg      max
      ---------------------------------------------------------
      0        ..        9:        0        0        0        0
      10       ..       99:        0        0        0        0
      100      ..      999:    16383      290      315      781
      1000     ..     9999:        0        0        0        0
      10000    ..    99999:        1    31581    31581    31581
      100000   ..      inf:        0        0        0        0
      ---------------------------------------------------------
      Total               :    16384      290      317    31581
      
      From detailed_erase_block_info view: PEB 8031 has erase counter 7
      physical_block_number   erase_count
      8030                    421
      8031                    7   # mem info is different from disk info
      8032                    434
      8033                    425
      8034                    431
      
      Following process missed updating erase counter in wl_entry(in memory):
      ubi_update_fastmap
       for (i = 1; i < new_fm->used_blocks; i++) // update fastmap data
        if (!tmp_e)
         if (old_fm && old_fm->e[i])
          erase_block(ubi, old_fm->e[i]->pnum)
           ret = ubi_io_sync_erase(ubi, pnum, 0)
           ec = be64_to_cpu(ec_hdr->ec)
           ec += ret
           ec_hdr->ec = cpu_to_be64(ec)
           ubi_io_write_ec_hdr(ubi, pnum, ec_hdr)  // ec is updated on flash
         // ec is not updated in old_fm->e[i] (in memory)
      
      Fix it by passing wl_enter into erase_block() and updating erase
      counter in erase_block().
      
      Fixes: dbb7d2a8 ("UBI: Add fastmap core")
      Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      4d18b5a5
    • Ferry Meng's avatar
      ubifs: Fix missing error code err · 60f2f4a8
      Ferry Meng authored
      Fix smatch warning:
      
      fs/ubifs/journal.c:1610 ubifs_jnl_truncate() warn: missing error code
      'err'
      Signed-off-by: default avatarFerry Meng <mengferry@linux.alibaba.com>
      Reviewed-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      60f2f4a8
    • Vincent Whitchurch's avatar
      ubifs: Fix memory leak of bud->log_hash · f4a04c97
      Vincent Whitchurch authored
      Ensure that the allocated bud->log_hash (if any) is freed in all cases
      when the bud itself is freed, to fix this leak caught by kmemleak:
      
       # keyctl add logon foo:bar data @s
       # echo clear > /sys/kernel/debug/kmemleak
       # mount -t ubifs /dev/ubi0_0 mnt -o auth_hash_name=sha256,auth_key=foo:bar
       # echo a > mnt/x
       # umount mnt
       # mount -t ubifs /dev/ubi0_0 mnt -o auth_hash_name=sha256,auth_key=foo:bar
       # umount mnt
       # sleep 5
       # echo scan > /sys/kernel/debug/kmemleak
       # echo scan > /sys/kernel/debug/kmemleak
       # cat /sys/kernel/debug/kmemleak
       unreferenced object 0xff... (size 128):
         comm "mount"
         backtrace:
           __kmalloc
           __ubifs_hash_get_desc+0x5d/0xe0 ubifs
           ubifs_replay_journal
           ubifs_mount
           ...
      
      Fixes: da8ef65f ("ubifs: Authenticate replayed journal")
      Signed-off-by: default avatarVincent Whitchurch <vincent.whitchurch@axis.com>
      Reviewed-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      f4a04c97
    • Yang Li's avatar
      ubifs: Fix some kernel-doc comments · 48ec6328
      Yang Li authored
      Add description of @time and @flags in ubifs_update_time().
      
      to silence the warnings:
      fs/ubifs/file.c:1383: warning: Function parameter or member 'time' not described in 'ubifs_update_time'
      fs/ubifs/file.c:1383: warning: Function parameter or member 'flags' not described in 'ubifs_update_time'
      Reported-by: default avatarAbaci Robot <abaci@linux.alibaba.com>
      Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5848Signed-off-by: default avatarYang Li <yang.lee@linux.alibaba.com>
      Reviewed-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      48ec6328
  2. 15 Oct, 2023 11 commits
    • Linus Torvalds's avatar
      Linux 6.6-rc6 · 58720809
      Linus Torvalds authored
      58720809
    • Linus Torvalds's avatar
      Revert "x86/smp: Put CPUs into INIT on shutdown if possible" · fbe1bf1e
      Linus Torvalds authored
      This reverts commit 45e34c8a, and the
      two subsequent fixes to it:
      
        3f874c9b ("x86/smp: Don't send INIT to non-present and non-booted CPUs")
        b1472a60 ("x86/smp: Don't send INIT to boot CPU")
      
      because it seems to result in hung machines at shutdown.  Particularly
      some Dell machines, but Thomas says
      
       "The rest seems to be Lenovo and Sony with Alderlake/Raptorlake CPUs -
        at least that's what I could figure out from the various bug reports.
      
        I don't know which CPUs the DELL machines have, so I can't say it's a
        pattern.
      
        I agree with the revert for now"
      
      Ashok Raj chimes in:
      
       "There was a report (probably this same one), and it turns out it was a
        bug in the BIOS SMI handler.
      
        The client BIOS's were waiting for the lowest APICID to be the SMI
        rendevous master. If this is MeteorLake, the BSP wasn't the one with
        the lowest APIC and it triped here.
      
        The BIOS change is also being pushed to others for assimilation :)
      
        Server BIOS's had this correctly for a while now"
      
      and it does look likely to be some bad interaction between SMI and the
      non-BSP cores having put into INIT (and thus unresponsive until reset).
      
      Link: https://bbs.archlinux.org/viewtopic.php?pid=2124429
      Link: https://www.reddit.com/r/openSUSE/comments/16qq99b/tumbleweed_shutdown_did_not_finish_completely/
      Link: https://forum.artixlinux.org/index.php/topic,5997.0.html
      Link: https://bugzilla.redhat.com/show_bug.cgi?id=2241279Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fbe1bf1e
    • Xuan Zhuo's avatar
      virtio_net: fix the missing of the dma cpu sync · 5720c43d
      Xuan Zhuo authored
      Commit 295525e2 ("virtio_net: merge dma operations when filling
      mergeable buffers") unmaps the buffer with DMA_ATTR_SKIP_CPU_SYNC when
      the dma->ref is zero. We do that with DMA_ATTR_SKIP_CPU_SYNC, because we
      do not want to do the sync for the entire page_frag. But that misses the
      sync for the current area.
      
      This patch does cpu sync regardless of whether the ref is zero or not.
      
      Fixes: 295525e2 ("virtio_net: merge dma operations when filling mergeable buffers")
      Reported-by: default avatarMichael Roth <michael.roth@amd.com>
      Closes: http://lore.kernel.org/all/20230926130451.axgodaa6tvwqs3ut@amd.comSigned-off-by: default avatarXuan Zhuo <xuanzhuo@linux.alibaba.com>
      Acked-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5720c43d
    • Linus Torvalds's avatar
      Merge tag 'usb-6.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 11d3f726
      Linus Torvalds authored
      Pull USB / Thunderbolt fixes from Greg KH:
       "Here are some USB and Thunderbolt driver fixes for 6.6-rc6 to resolve
        a number of small reported issues. Included in here are:
      
         - thunderbolt driver fixes
      
         - xhci driver fixes
      
         - cdns3 driver fixes
      
         - musb driver fixes
      
         - a number of typec driver fixes
      
         - a few other small driver fixes
      
        All of these have been in linux-next with no reported issues"
      
      * tag 'usb-6.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (22 commits)
        usb: typec: ucsi: Use GET_CAPABILITY attributes data to set power supply scope
        usb: typec: ucsi: Fix missing link removal
        usb: typec: altmodes/displayport: Signal hpd low when exiting mode
        xhci: Preserve RsvdP bits in ERSTBA register correctly
        xhci: Clear EHB bit only at end of interrupt handler
        xhci: track port suspend state correctly in unsuccessful resume cases
        usb: xhci: xhci-ring: Use sysdev for mapping bounce buffer
        usb: typec: ucsi: Clear EVENT_PENDING bit if ucsi_send_command fails
        usb: misc: onboard_hub: add support for Microchip USB2412 USB 2.0 hub
        usb: gadget: udc-xilinx: replace memcpy with memcpy_toio
        usb: cdns3: Modify the return value of cdns_set_active () to void when CONFIG_PM_SLEEP is disabled
        usb: dwc3: Soft reset phy on probe for host
        usb: hub: Guard against accesses to uninitialized BOS descriptors
        usb: typec: qcom: Update the logic of regulator enable and disable
        usb: gadget: ncm: Handle decoding of multiple NTB's in unwrap call
        usb: musb: Get the musb_qh poniter after musb_giveback
        usb: musb: Modify the "HWVers" register address
        usb: cdnsp: Fixes issue with dequeuing not queued requests
        thunderbolt: Restart XDomain discovery handshake after failure
        thunderbolt: Correct TMU mode initialization from hardware
        ...
      11d3f726
    • Linus Torvalds's avatar
      Merge tag 'tty-6.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · 41226a36
      Linus Torvalds authored
      Pull tty/serial driver fixes from Greg KH:
       "Here are some small tty/serial driver fixes for 6.6-rc6 that resolve
        some reported issues. Included in here are:
      
         - serial core pm runtime fix for issue reported by many
      
         - 8250_omap driver fix
      
         - rs485 spinlock fix for reported problem
      
         - ams-delta bugfix for previous tty api changes in -rc1 that missed
           this driver that never seems to get built in any test systems
      
        All of these have been in linux-next for over a week with no reported
        problems"
      
      * tag 'tty-6.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        ASoC: ti: ams-delta: Fix cx81801_receive() argument types
        serial: core: Fix checks for tx runtime PM state
        serial: 8250_omap: Fix errors with no_console_suspend
        serial: Reduce spinlocked portion of uart_rs485_config()
      41226a36
    • Linus Torvalds's avatar
      Merge tag 'char-misc-6.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · a477e3a7
      Linus Torvalds authored
      Pull char/misc driver fixes from Greg KH:
       "Here is a small set of char/misc and other smaller driver subsystem
        fixes for 6.6-rc6. Included in here are:
      
         - lots of iio driver fixes
      
         - binder memory leak fix
      
         - mcb driver fixes
      
         - counter driver fixes
      
         - firmware loader documentation fix
      
         - documentation update for embargoed hardware issues
      
        All of these have been in linux-next for over a week with no reported
        issues"
      
      * tag 'char-misc-6.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (22 commits)
        iio: pressure: ms5611: ms5611_prom_is_valid false negative bug
        dt-bindings: iio: adc: adi,ad7292: Fix additionalProperties on channel nodes
        iio: adc: ad7192: Correct reference voltage
        iio: light: vcnl4000: Don't power on/off chip in config
        iio: addac: Kconfig: update ad74413r selections
        iio: pressure: dps310: Adjust Timeout Settings
        iio: imu: bno055: Fix missing Kconfig dependencies
        iio: adc: imx8qxp: Fix address for command buffer registers
        iio: cros_ec: fix an use-after-free in cros_ec_sensors_push_data()
        iio: irsd200: fix -Warray-bounds bug in irsd200_trigger_handler
        dt-bindings: iio: rohm,bu27010: add missing vdd-supply to example
        binder: fix memory leaks of spam and pending work
        firmware_loader: Update contact emails for ABI docs
        Documentation: embargoed-hardware-issues.rst: Clarify prenotifaction
        mcb: remove is_added flag from mcb_device struct
        coresight: tmc-etr: Disable warnings for allocation failures
        coresight: Fix run time warnings while reusing ETR buffer
        iio: admv1013: add mixer_vgate corner cases
        iio: pressure: bmp280: Fix NULL pointer exception
        iio: dac: ad3552r: Correct device IDs
        ...
      a477e3a7
    • Linus Torvalds's avatar
      Merge tag 'ovl-fixes-6.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/overlayfs/vfs · 19fd4a91
      Linus Torvalds authored
      Pull overlayfs fixes from Amir Goldstein:
      
       - Various fixes for regressions due to conversion to new mount
         api in v6.5
      
       - Disable a new mount option syntax (append lowerdir) that was
         added in v6.5 because we plan to add a different lowerdir
         append syntax in v6.7
      
      * tag 'ovl-fixes-6.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/overlayfs/vfs:
        ovl: temporarily disable appending lowedirs
        ovl: fix regression in showing lowerdir mount option
        ovl: fix regression in parsing of mount options with escaped comma
        fs: factor out vfs_parse_monolithic_sep() helper
      19fd4a91
    • Linus Torvalds's avatar
      Merge tag 'powerpc-6.6-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · f8bf101b
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
      
       - Fix softlockup/crash when using hcall tracing
      
       - Fix pte_access_permitted() for PAGE_NONE on 8xx
      
       - Fix inverted pte_young() test in __ptep_test_and_clear_young()
         on 64-bit BookE
      
       - Fix unhandled math emulation exception on 85xx
      
       - Fix kernel crash on syscall return on 476
      
      Thanks to Athira Rajeev, Christophe Leroy, Eddie James, and Naveen N
      Rao.
      
      * tag 'powerpc-6.6-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/47x: Fix 47x syscall return crash
        powerpc/85xx: Fix math emulation exception
        powerpc/64e: Fix wrong test in __ptep_test_and_clear_young()
        powerpc/8xx: Fix pte_access_permitted() for PAGE_NONE
        powerpc/pseries: Remove unused r0 in the hcall tracing code
        powerpc/pseries: Fix STK_PARAM access in the hcall tracing code
      f8bf101b
    • Linus Torvalds's avatar
      Merge tag 'smp-urgent-2023-10-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ddf20855
      Linus Torvalds authored
      Pull CPU hotplug fix from Ingo Molnar:
       "Fix a Longsoon build warning by harmonizing the
        arch_[un]register_cpu() prototypes between architectures"
      
      * tag 'smp-urgent-2023-10-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        cpu-hotplug: Provide prototypes for arch CPU registration
      ddf20855
    • Linus Torvalds's avatar
      Merge tag '6.6-rc5-ksmbd-server-fixes' of git://git.samba.org/ksmbd · 9a3dad63
      Linus Torvalds authored
      Pull smb server fixes from Steve French:
      
       - Fix for possible double free in RPC read
      
       - Add additional check to clarify smb2_open path and quiet Coverity
      
       - Fix incorrect error rsp in a compounding path
      
       - Fix to properly fail open of file with pending delete on close
      
      * tag '6.6-rc5-ksmbd-server-fixes' of git://git.samba.org/ksmbd:
        ksmbd: fix potential double free on smb2_read_pipe() error path
        ksmbd: fix Null pointer dereferences in ksmbd_update_fstate()
        ksmbd: fix wrong error response status by using set_smb2_rsp_status()
        ksmbd: not allow to open file if delelete on close bit is set
      9a3dad63
    • Linus Torvalds's avatar
      Merge tag '6.6-rc5-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6 · bf2069d1
      Linus Torvalds authored
      Pull smb client fixes from Steve French:
      
       - fix caching race with open_cached_dir and laundromat cleanup of
         cached dirs (addresses a problem spotted with xfstest run with
         directory leases enabled)
      
       - reduce excessive resource usage of laundromat threads
      
      * tag '6.6-rc5-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        smb: client: prevent new fids from being removed by laundromat
        smb: client: make laundromat a delayed worker
      bf2069d1
  3. 14 Oct, 2023 11 commits