1. 23 Dec, 2021 4 commits
    • Petr Cvachoucek's avatar
      ubifs: Error path in ubifs_remount_rw() seems to wrongly free write buffers · 3fea4d9d
      Petr Cvachoucek authored
      it seems freeing the write buffers in the error path of the
      ubifs_remount_rw() is wrong. It leads later to a kernel oops like this:
      
      [10016.431274] UBIFS (ubi0:0): start fixing up free space
      [10090.810042] UBIFS (ubi0:0): free space fixup complete
      [10090.814623] UBIFS error (ubi0:0 pid 512): ubifs_remount_fs: cannot
      spawn "ubifs_bgt0_0", error -4
      [10101.915108] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started,
      PID 517
      [10105.275498] Unable to handle kernel NULL pointer dereference at
      virtual address 0000000000000030
      [10105.284352] Mem abort info:
      [10105.287160]   ESR = 0x96000006
      [10105.290252]   EC = 0x25: DABT (current EL), IL = 32 bits
      [10105.295592]   SET = 0, FnV = 0
      [10105.298652]   EA = 0, S1PTW = 0
      [10105.301848] Data abort info:
      [10105.304723]   ISV = 0, ISS = 0x00000006
      [10105.308573]   CM = 0, WnR = 0
      [10105.311564] user pgtable: 4k pages, 48-bit VAs, pgdp=00000000f03d1000
      [10105.318034] [0000000000000030] pgd=00000000f6cee003,
      pud=00000000f4884003, pmd=0000000000000000
      [10105.326783] Internal error: Oops: 96000006 [#1] PREEMPT SMP
      [10105.332355] Modules linked in: ath10k_pci ath10k_core ath mac80211
      libarc4 cfg80211 nvme nvme_core cryptodev(O)
      [10105.342468] CPU: 3 PID: 518 Comm: touch Tainted: G           O
      5.4.3 #1
      [10105.349517] Hardware name: HYPEX CPU (DT)
      [10105.353525] pstate: 40000005 (nZcv daif -PAN -UAO)
      [10105.358324] pc : atomic64_try_cmpxchg_acquire.constprop.22+0x8/0x34
      [10105.364596] lr : mutex_lock+0x1c/0x34
      [10105.368253] sp : ffff000075633aa0
      [10105.371563] x29: ffff000075633aa0 x28: 0000000000000001
      [10105.376874] x27: ffff000076fa80c8 x26: 0000000000000004
      [10105.382185] x25: 0000000000000030 x24: 0000000000000000
      [10105.387495] x23: 0000000000000000 x22: 0000000000000038
      [10105.392807] x21: 000000000000000c x20: ffff000076fa80c8
      [10105.398119] x19: ffff000076fa8000 x18: 0000000000000000
      [10105.403429] x17: 0000000000000000 x16: 0000000000000000
      [10105.408741] x15: 0000000000000000 x14: fefefefefefefeff
      [10105.414052] x13: 0000000000000000 x12: 0000000000000fe0
      [10105.419364] x11: 0000000000000fe0 x10: ffff000076709020
      [10105.424675] x9 : 0000000000000000 x8 : 00000000000000a0
      [10105.429986] x7 : ffff000076fa80f4 x6 : 0000000000000030
      [10105.435297] x5 : 0000000000000000 x4 : 0000000000000000
      [10105.440609] x3 : 0000000000000000 x2 : ffff00006f276040
      [10105.445920] x1 : ffff000075633ab8 x0 : 0000000000000030
      [10105.451232] Call trace:
      [10105.453676]  atomic64_try_cmpxchg_acquire.constprop.22+0x8/0x34
      [10105.459600]  ubifs_garbage_collect+0xb4/0x334
      [10105.463956]  ubifs_budget_space+0x398/0x458
      [10105.468139]  ubifs_create+0x50/0x180
      [10105.471712]  path_openat+0x6a0/0x9b0
      [10105.475284]  do_filp_open+0x34/0x7c
      [10105.478771]  do_sys_open+0x78/0xe4
      [10105.482170]  __arm64_sys_openat+0x1c/0x24
      [10105.486180]  el0_svc_handler+0x84/0xc8
      [10105.489928]  el0_svc+0x8/0xc
      [10105.492808] Code: 52800013 17fffffb d2800003 f9800011 (c85ffc05)
      [10105.498903] ---[ end trace 46b721d93267a586 ]---
      
      To reproduce the problem:
      
      1. Filesystem initially mounted read-only, free space fixup flag set.
      
      2. mount -o remount,rw <mountpoint>
      
      3. it takes some time (free space fixup running)
          ... try to terminate running mount by CTRL-C
          ... does not respond, only after free space fixup is complete
          ... then "ubifs_remount_fs: cannot spawn "ubifs_bgt0_0", error -4"
      
      4. mount -o remount,rw <mountpoint>
          ... now finished instantly (fixup already done).
      
      5. Create file or just unmount the filesystem and we get the oops.
      
      Cc: <stable@vger.kernel.org>
      Fixes: b50b9f40 ("UBIFS: do not free write-buffers when in R/O mode")
      Signed-off-by: default avatarPetr Cvachoucek <cvachoucek@gmail.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      3fea4d9d
    • Cai Huoqing's avatar
      ubifs: Make use of the helper macro kthread_run() · d98c6c35
      Cai Huoqing authored
      Repalce kthread_create/wake_up_process() with kthread_run()
      to simplify the code.
      Signed-off-by: default avatarCai Huoqing <caihuoqing@baidu.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      d98c6c35
    • Kai Song's avatar
      ubi: Fix a mistake in comment · bc7849e2
      Kai Song authored
      Fixes: 2a734bb8 ("UBI: use debugfs for the extra checks knobs")
      There is a mistake in docstrings, it should be ubi_debugfs_exit_dev
      instead of dbg_debug_exit_dev.
      Signed-off-by: default avatarKai Song <songkai01@inspur.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      bc7849e2
    • Alexander Dahl's avatar
      ubifs: Fix spelling mistakes · 7296c8af
      Alexander Dahl authored
      Found with `codespell -i 3 -w fs/ubifs/**` and proof reading that parts.
      Signed-off-by: default avatarAlexander Dahl <ada@thorsis.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      7296c8af
  2. 19 Dec, 2021 14 commits
  3. 18 Dec, 2021 11 commits
    • Linus Torvalds's avatar
      Merge tag 'tty-5.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · 3f667b5d
      Linus Torvalds authored
      Pull tty/serial fixes from Greg KH:
       "Here are two small tty/serial fixes for 5.16-rc6.  They include:
      
         - n_hdlc fix for syzbot reported problem that you were previously
           copied on.
      
         - 8250_fintek driver fix that resolved a console problem by removing
           a previous change.
      
        Both have been in linux-next with no reported issues"
      
      * tag 'tty-5.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        serial: 8250_fintek: Fix garbled text for console
        tty: n_hdlc: make n_hdlc_tty_wakeup() asynchronous
      3f667b5d
    • Linus Torvalds's avatar
      Merge tag 'usb-5.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · fb7d0829
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are a number of small USB driver fixes for reported problems.
        They include:
      
         - dwc2 driver fixes
      
         - xhci driver fixes
      
         - cdnsp driver fixes
      
         - typec driver fix
      
         - gadget u_ether driver fix
      
         - new quirk additions
      
         - usb gadget endpoint calculation fix
      
         - usb serial new device ids
      
         - revert of a xhci-dbg change that broke early debug booting
      
        All changes, except for the revert, have been in linux-next with no
        reported problems. The revert was from yesterday, and it was reported
        by the developers affected that it resolved their problem"
      
      * tag 'usb-5.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        Revert "usb: early: convert to readl_poll_timeout_atomic()"
        usb: typec: tcpm: fix tcpm unregister port but leave a pending timer
        usb: cdnsp: Fix lack of spin_lock_irqsave/spin_lock_restore
        USB: NO_LPM quirk Lenovo USB-C to Ethernet Adapher(RTL8153-04)
        usb: xhci: Extend support for runtime power management for AMD's Yellow carp.
        usb: dwc2: fix STM ID/VBUS detection startup delay in dwc2_driver_probe
        USB: gadget: bRequestType is a bitfield, not a enum
        USB: serial: option: add Telit FN990 compositions
        USB: serial: cp210x: fix CP2105 GPIO registration
        usb: cdnsp: Fix incorrect status for control request
        usb: cdnsp: Fix issue in cdnsp_log_ep trace event
        usb: cdnsp: Fix incorrect calling of cdnsp_died function
        usb: xhci-mtk: fix list_del warning when enable list debug
        usb: gadget: u_ether: fix race in setting MAC address in setup phase
      fb7d0829
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-fixes-for-v5.16-2021-12-18' of... · 0f03adcc
      Linus Torvalds authored
      Merge tag 'perf-tools-fixes-for-v5.16-2021-12-18' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
      
      Pull perf tools fixes from Arnaldo Carvalho de Melo:
      
       - Fix segfaults in 'perf inject' related to usage of unopened files
      
       - The return value of hashmap__new() should be checked using IS_ERR()
      
      * tag 'perf-tools-fixes-for-v5.16-2021-12-18' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
        perf inject: Fix segfault due to perf_data__fd() without open
        perf inject: Fix segfault due to close without open
        perf expr: Fix missing check for return value of hashmap__new()
      0f03adcc
    • Adrian Hunter's avatar
      perf inject: Fix segfault due to perf_data__fd() without open · c271a55b
      Adrian Hunter authored
      The fixed commit attempts to get the output file descriptor even if the
      file was never opened e.g.
      
        $ perf record uname
        Linux
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.002 MB perf.data (7 samples) ]
        $ perf inject -i perf.data --vm-time-correlation=dry-run
        Segmentation fault (core dumped)
        $ gdb --quiet perf
        Reading symbols from perf...
        (gdb) r inject -i perf.data --vm-time-correlation=dry-run
        Starting program: /home/ahunter/bin/perf inject -i perf.data --vm-time-correlation=dry-run
        [Thread debugging using libthread_db enabled]
        Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
      
        Program received signal SIGSEGV, Segmentation fault.
        __GI___fileno (fp=0x0) at fileno.c:35
        35      fileno.c: No such file or directory.
        (gdb) bt
        #0  __GI___fileno (fp=0x0) at fileno.c:35
        #1  0x00005621e48dd987 in perf_data__fd (data=0x7fff4c68bd08) at util/data.h:72
        #2  perf_data__fd (data=0x7fff4c68bd08) at util/data.h:69
        #3  cmd_inject (argc=<optimized out>, argv=0x7fff4c69c1f0) at builtin-inject.c:1017
        #4  0x00005621e4936783 in run_builtin (p=0x5621e4ee6878 <commands+600>, argc=4, argv=0x7fff4c69c1f0) at perf.c:313
        #5  0x00005621e4897d5c in handle_internal_command (argv=<optimized out>, argc=<optimized out>) at perf.c:365
        #6  run_argv (argcp=<optimized out>, argv=<optimized out>) at perf.c:409
        #7  main (argc=4, argv=0x7fff4c69c1f0) at perf.c:539
        (gdb)
      
      Fixes: 0ae03893 ("perf tools: Pass a fd to perf_file_header__read_pipe()")
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: stable@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20211213084829.114772-3-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c271a55b
    • Adrian Hunter's avatar
      perf inject: Fix segfault due to close without open · 0c8e32fe
      Adrian Hunter authored
      The fixed commit attempts to close inject.output even if it was never
      opened e.g.
      
        $ perf record uname
        Linux
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.002 MB perf.data (7 samples) ]
        $ perf inject -i perf.data --vm-time-correlation=dry-run
        Segmentation fault (core dumped)
        $ gdb --quiet perf
        Reading symbols from perf...
        (gdb) r inject -i perf.data --vm-time-correlation=dry-run
        Starting program: /home/ahunter/bin/perf inject -i perf.data --vm-time-correlation=dry-run
        [Thread debugging using libthread_db enabled]
        Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
      
        Program received signal SIGSEGV, Segmentation fault.
        0x00007eff8afeef5b in _IO_new_fclose (fp=0x0) at iofclose.c:48
        48      iofclose.c: No such file or directory.
        (gdb) bt
        #0  0x00007eff8afeef5b in _IO_new_fclose (fp=0x0) at iofclose.c:48
        #1  0x0000557fc7b74f92 in perf_data__close (data=data@entry=0x7ffcdafa6578) at util/data.c:376
        #2  0x0000557fc7a6b807 in cmd_inject (argc=<optimized out>, argv=<optimized out>) at builtin-inject.c:1085
        #3  0x0000557fc7ac4783 in run_builtin (p=0x557fc8074878 <commands+600>, argc=4, argv=0x7ffcdafb6a60) at perf.c:313
        #4  0x0000557fc7a25d5c in handle_internal_command (argv=<optimized out>, argc=<optimized out>) at perf.c:365
        #5  run_argv (argcp=<optimized out>, argv=<optimized out>) at perf.c:409
        #6  main (argc=4, argv=0x7ffcdafb6a60) at perf.c:539
        (gdb)
      
      Fixes: 02e6246f ("perf inject: Close inject.output on exit")
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: stable@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20211213084829.114772-2-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0c8e32fe
    • Miaoqian Lin's avatar
      perf expr: Fix missing check for return value of hashmap__new() · 0a515a06
      Miaoqian Lin authored
      The hashmap__new() function may return ERR_PTR(-ENOMEM) when malloc()
      fails, add IS_ERR() checking for ctx->ids.
      Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20211212062504.25841-1-linmq006@gmail.com
      [ s/kfree()/free()/ and add missing linux/err.h include ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0a515a06
    • Zqiang's avatar
      locking/rtmutex: Fix incorrect condition in rtmutex_spin_on_owner() · 8f556a32
      Zqiang authored
      Optimistic spinning needs to be terminated when the spinning waiter is not
      longer the top waiter on the lock, but the condition is negated. It
      terminates if the waiter is the top waiter, which is defeating the whole
      purpose.
      
      Fixes: c3123c43 ("locking/rtmutex: Dont dereference waiter lockless")
      Signed-off-by: default avatarZqiang <qiang1.zhang@intel.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20211217074207.77425-1-qiang1.zhang@intel.com
      8f556a32
    • Linus Torvalds's avatar
      Merge tag 'libata-5.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata · 9eaa88c7
      Linus Torvalds authored
      Pull libata fix from Damien Le Moal:
       "A single fix for this cycle:
      
         - Check that ATA16 passthrough commands that do not transfer any data
           have a DMA direction set to DMA_NONE (From George)"
      
      * tag 'libata-5.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata:
        libata: if T_LENGTH is zero, dma direction should be DMA_NONE
      9eaa88c7
    • Linus Torvalds's avatar
      Merge tag 'zonefs-5.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs · 1887bf5c
      Linus Torvalds authored
      Pull zonefs fixes from Damien Le Moal:
       "One fix and one trivial update for rc6:
      
         - Add MODULE_ALIAS_FS to get automatic module loading on mount
           (Naohiro)
      
         - Update Damien's email address in the MAINTAINERS file (me)"
      
      * tag 'zonefs-5.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs:
        MAITAINERS: Change zonefs maintainer email address
        zonefs: add MODULE_ALIAS_FS
      1887bf5c
    • Thiago Rafael Becker's avatar
      cifs: sanitize multiple delimiters in prepath · a3108089
      Thiago Rafael Becker authored
      mount.cifs can pass a device with multiple delimiters in it. This will
      cause rename(2) to fail with ENOENT.
      
      V2:
        - Make sanitize_path more readable.
        - Fix multiple delimiters between UNC and prepath.
        - Avoid a memory leak if a bad user starts putting a lot of delimiters
          in the path on purpose.
      
      BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=2031200
      Fixes: 24e0a1ef ("cifs: switch to new mount api")
      Cc: stable@vger.kernel.org # 5.11+
      Acked-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: default avatarThiago Rafael Becker <trbecker@gmail.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      a3108089
    • Shyam Prasad N's avatar
      cifs: ignore resource_id while getting fscache super cookie · b774302e
      Shyam Prasad N authored
      We have a cyclic dependency between fscache super cookie
      and root inode cookie. The super cookie relies on
      tcon->resource_id, which gets populated from the root inode
      number. However, fetching the root inode initializes inode
      cookie as a child of super cookie, which is yet to be populated.
      
      resource_id is only used as auxdata to check the validity of
      super cookie. We can completely avoid setting resource_id to
      remove the circular dependency. Since vol creation time and
      vol serial numbers are used for auxdata, we should be fine.
      Additionally, there will be auxiliary data check for each
      inode cookie as well.
      
      Fixes: 5bf91ef0 ("cifs: wait for tcon resource_id before getting fscache super")
      CC: David Howells <dhowells@redhat.com>
      Signed-off-by: default avatarShyam Prasad N <sprasad@microsoft.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      b774302e
  4. 17 Dec, 2021 11 commits