1. 22 Feb, 2021 2 commits
  2. 15 Feb, 2021 3 commits
  3. 12 Feb, 2021 1 commit
  4. 10 Feb, 2021 1 commit
    • Muchun Song's avatar
      printk: fix deadlock when kernel panic · 8a8109f3
      Muchun Song authored
      printk_safe_flush_on_panic() caused the following deadlock on our
      server:
      
      CPU0:                                         CPU1:
      panic                                         rcu_dump_cpu_stacks
        kdump_nmi_shootdown_cpus                      nmi_trigger_cpumask_backtrace
          register_nmi_handler(crash_nmi_callback)      printk_safe_flush
                                                          __printk_safe_flush
                                                            raw_spin_lock_irqsave(&read_lock)
          // send NMI to other processors
          apic_send_IPI_allbutself(NMI_VECTOR)
                                                              // NMI interrupt, dead loop
                                                              crash_nmi_callback
        printk_safe_flush_on_panic
          printk_safe_flush
            __printk_safe_flush
              // deadlock
              raw_spin_lock_irqsave(&read_lock)
      
      DEADLOCK: read_lock is taken on CPU1 and will never get released.
      
      It happens when panic() stops a CPU by NMI while it has been in
      the middle of printk_safe_flush().
      
      Handle the lock the same way as logbuf_lock. The printk_safe buffers
      are flushed only when both locks can be safely taken. It can avoid
      the deadlock _in this particular case_ at expense of losing contents
      of printk_safe buffers.
      
      Note: It would actually be safe to re-init the locks when all CPUs were
            stopped by NMI. But it would require passing this information
            from arch-specific code. It is not worth the complexity.
            Especially because logbuf_lock and printk_safe buffers have been
            obsoleted by the lockless ring buffer.
      
      Fixes: cf9b1106 ("printk/nmi: flush NMI messages on the system panic")
      Signed-off-by: default avatarMuchun Song <songmuchun@bytedance.com>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Cc: <stable@vger.kernel.org>
      Acked-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Signed-off-by: default avatarPetr Mladek <pmladek@suse.com>
      Link: https://lore.kernel.org/r/20210210034823.64867-1-songmuchun@bytedance.com
      8a8109f3
  5. 26 Jan, 2021 1 commit
  6. 25 Jan, 2021 2 commits
  7. 21 Jan, 2021 1 commit
  8. 19 Jan, 2021 1 commit
  9. 15 Jan, 2021 2 commits
  10. 08 Jan, 2021 2 commits
  11. 07 Jan, 2021 3 commits
  12. 06 Jan, 2021 2 commits
    • Valdis Klētnieks's avatar
      gcc-plugins: fix gcc 11 indigestion with plugins... · 67a5a680
      Valdis Klētnieks authored
      Fedora Rawhide has started including gcc 11,and the g++ compiler
      throws a wobbly when it hits scripts/gcc-plugins:
      
        HOSTCXX scripts/gcc-plugins/latent_entropy_plugin.so
      In file included from /usr/include/c++/11/type_traits:35,
                       from /usr/lib/gcc/x86_64-redhat-linux/11/plugin/include/system.h:244,
                       from /usr/lib/gcc/x86_64-redhat-linux/11/plugin/include/gcc-plugin.h:28,
                       from scripts/gcc-plugins/gcc-common.h:7,
                       from scripts/gcc-plugins/latent_entropy_plugin.c:78:
      /usr/include/c++/11/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO
       C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
         32 | #error This file requires compiler and library support \
      
      In fact, it works just fine with c++11, which has been in gcc since 4.8,
      and we now require 4.9 as a minimum.
      Signed-off-by: default avatarValdis Kletnieks <valdis.kletnieks@vt.edu>
      Acked-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Link: https://lore.kernel.org/r/82487.1609006918@turing-police
      67a5a680
    • Linus Torvalds's avatar
      Merge tag 'for-5.11-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 71c061d2
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
       "A few more fixes that arrived before the end of the year:
      
         - a bunch of fixes related to transaction handle lifetime wrt various
           operations (umount, remount, qgroup scan, orphan cleanup)
      
         - async discard scheduling fixes
      
         - fix item size calculation when item keys collide for extend refs
           (hardlinks)
      
         - fix qgroup flushing from running transaction
      
         - fix send, wrong file path when there is an inode with a pending
           rmdir
      
         - fix deadlock when cloning inline extent and low on free metadata
           space"
      
      * tag 'for-5.11-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: run delayed iputs when remounting RO to avoid leaking them
        btrfs: add assertion for empty list of transactions at late stage of umount
        btrfs: fix race between RO remount and the cleaner task
        btrfs: fix transaction leak and crash after cleaning up orphans on RO mount
        btrfs: fix transaction leak and crash after RO remount caused by qgroup rescan
        btrfs: merge critical sections of discard lock in workfn
        btrfs: fix racy access to discard_ctl data
        btrfs: fix async discard stall
        btrfs: tests: initialize test inodes location
        btrfs: send: fix wrong file path when there is an inode with a pending rmdir
        btrfs: qgroup: don't try to wait flushing if we're already holding a transaction
        btrfs: correctly calculate item size used when item key collision happens
        btrfs: fix deadlock when cloning inline extent and low on free metadata space
      71c061d2
  13. 05 Jan, 2021 7 commits
    • Linus Torvalds's avatar
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · 9f1abbe9
      Linus Torvalds authored
      Pull vhost bugfix from Michael Tsirkin:
       "This fixes configs with vhost vsock behind a viommu"
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
        vhost/vsock: add IOTLB API support
      9f1abbe9
    • Linus Torvalds's avatar
      Merge tag 'sound-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 1d011777
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "Here is a collection of USB- and HD-audio fixes.
      
        Most of them are device-specific quirks while one fix is for a
        regression due to an incorrect mutex unlock introduced in this merge
        window"
      
      * tag 'sound-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: hda/via: Fix runtime PM for Clevo W35xSS
        ALSA: usb-audio: Add quirk for RC-505
        ALSA: hda/hdmi: Fix incorrect mutex unlock in silent_stream_disable()
        ALSA: hda/realtek: Enable mute and micmute LED on HP EliteBook 850 G7
        ALSA: hda/realtek: Add two "Intel Reference board" SSID in the ALC256.
        ALSA: hda/realtek: Add mute LED quirk for more HP laptops
        ALSA: hda/conexant: add a new hda codec CX11970
        ALSA: usb-audio: Add quirk for BOSS AD-10
        ALSA: usb-audio: Fix UBSAN warnings for MIDI jacks
        ALSA: hda/realtek - Modify Dell platform name
        ALSA: hda/realtek - Fix speaker volume control on Lenovo C940
      1d011777
    • Linus Torvalds's avatar
      Merge tag 'arc-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc · f6e7a024
      Linus Torvalds authored
      Pull ARC updates from Vineet Gupta:
       "Things are quieter on upstreaming front as we are mostly focusing on
        ARCv3/ARC64 port.
      
        This contains just build system updates from Masahiro Yamada"
      
      * tag 'arc-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc:
        ARC: build: use $(READELF) instead of hard-coded readelf
        ARC: build: remove unneeded extra-y
        ARC: build: move symlink creation to arch/arc/Makefile to avoid race
        ARC: build: add boot_targets to PHONY
        ARC: build: add uImage.lzma to the top-level target
        ARC: build: remove non-existing bootpImage from KBUILD_IMAGE
      f6e7a024
    • Linus Torvalds's avatar
      Merge tag 'net-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · aa35e45c
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Networking fixes, including fixes from netfilter, wireless and bpf
        trees.
      
        Current release - regressions:
      
         - mt76: fix NULL pointer dereference in mt76u_status_worker and
           mt76s_process_tx_queue
      
         - net: ipa: fix interconnect enable bug
      
        Current release - always broken:
      
         - netfilter: fixes possible oops in mtype_resize in ipset
      
         - ath11k: fix number of coding issues found by static analysis tools
           and spurious error messages
      
        Previous releases - regressions:
      
         - e1000e: re-enable s0ix power saving flows for systems with the
           Intel i219-LM Ethernet controllers to fix power use regression
      
         - virtio_net: fix recursive call to cpus_read_lock() to avoid a
           deadlock
      
         - ipv4: ignore ECN bits for fib lookups in fib_compute_spec_dst()
      
         - sysfs: take the rtnl lock around XPS configuration
      
         - xsk: fix memory leak for failed bind and rollback reservation at
           NETDEV_TX_BUSY
      
         - r8169: work around power-saving bug on some chip versions
      
        Previous releases - always broken:
      
         - dcb: validate netlink message in DCB handler
      
         - tun: fix return value when the number of iovs exceeds MAX_SKB_FRAGS
           to prevent unnecessary retries
      
         - vhost_net: fix ubuf refcount when sendmsg fails
      
         - bpf: save correct stopping point in file seq iteration
      
         - ncsi: use real net-device for response handler
      
         - neighbor: fix div by zero caused by a data race (TOCTOU)
      
         - bareudp: fix use of incorrect min_headroom size and a false
           positive lockdep splat from the TX lock
      
         - mvpp2:
            - clear force link UP during port init procedure in case
              bootloader had set it
            - add TCAM entry to drop flow control pause frames
            - fix PPPoE with ipv6 packet parsing
            - fix GoP Networking Complex Control config of port 3
            - fix pkt coalescing IRQ-threshold configuration
      
         - xsk: fix race in SKB mode transmit with shared cq
      
         - ionic: account for vlan tag len in rx buffer len
      
         - stmmac: ignore the second clock input, current clock framework does
           not handle exclusive clock use well, other drivers may reconfigure
           the second clock
      
        Misc:
      
         - ppp: change PPPIOCUNBRIDGECHAN ioctl request number to follow
           existing scheme"
      
      * tag 'net-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (99 commits)
        net: dsa: lantiq_gswip: Fix GSWIP_MII_CFG(p) register access
        net: dsa: lantiq_gswip: Enable GSWIP_MII_CFG_EN also for internal PHYs
        net: lapb: Decrease the refcount of "struct lapb_cb" in lapb_device_event
        r8169: work around power-saving bug on some chip versions
        net: usb: qmi_wwan: add Quectel EM160R-GL
        selftests: mlxsw: Set headroom size of correct port
        net: macb: Correct usage of MACB_CAPS_CLK_HW_CHG flag
        ibmvnic: fix: NULL pointer dereference.
        docs: networking: packet_mmap: fix old config reference
        docs: networking: packet_mmap: fix formatting for C macros
        vhost_net: fix ubuf refcount incorrectly when sendmsg fails
        bareudp: Fix use of incorrect min_headroom size
        bareudp: set NETIF_F_LLTX flag
        net: hdlc_ppp: Fix issues when mod_timer is called while timer is running
        atlantic: remove architecture depends
        erspan: fix version 1 check in gre_parse_header()
        net: hns: fix return value check in __lb_other_process()
        net: sched: prevent invalid Scell_log shift count
        net: neighbor: fix a crash caused by mod zero
        ipv4: Ignore ECN bits for fib lookups in fib_compute_spec_dst()
        ...
      aa35e45c
    • Linus Torvalds's avatar
      Merge tag 'afs-fixes-04012021' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs · 6207214a
      Linus Torvalds authored
      Pull AFS fixes from David Howells:
       "Two fixes.
      
        The first is the fix for the strnlen() array limit check and the
        second fixes the calculation of the number of dirent records used to
        represent any particular filename length"
      
      * tag 'afs-fixes-04012021' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
        afs: Fix directory entry size calculation
        afs: Work around strnlen() oops with CONFIG_FORTIFIED_SOURCE=y
      6207214a
    • Linus Torvalds's avatar
      mm: make wait_on_page_writeback() wait for multiple pending writebacks · c2407cf7
      Linus Torvalds authored
      Ever since commit 2a9127fc ("mm: rewrite wait_on_page_bit_common()
      logic") we've had some very occasional reports of BUG_ON(PageWriteback)
      in write_cache_pages(), which we thought we already fixed in commit
      073861ed ("mm: fix VM_BUG_ON(PageTail) and BUG_ON(PageWriteback)").
      
      But syzbot just reported another one, even with that commit in place.
      
      And it turns out that there's a simpler way to trigger the BUG_ON() than
      the one Hugh found with page re-use.  It all boils down to the fact that
      the page writeback is ostensibly serialized by the page lock, but that
      isn't actually really true.
      
      Yes, the people _setting_ writeback all do so under the page lock, but
      the actual clearing of the bit - and waking up any waiters - happens
      without any page lock.
      
      This gives us this fairly simple race condition:
      
        CPU1 = end previous writeback
        CPU2 = start new writeback under page lock
        CPU3 = write_cache_pages()
      
        CPU1          CPU2            CPU3
        ----          ----            ----
      
        end_page_writeback()
          test_clear_page_writeback(page)
          ... delayed...
      
                      lock_page();
                      set_page_writeback()
                      unlock_page()
      
                                      lock_page()
                                      wait_on_page_writeback();
      
          wake_up_page(page, PG_writeback);
          .. wakes up CPU3 ..
      
                                      BUG_ON(PageWriteback(page));
      
      where the BUG_ON() happens because we woke up the PG_writeback bit
      becasue of the _previous_ writeback, but a new one had already been
      started because the clearing of the bit wasn't actually atomic wrt the
      actual wakeup or serialized by the page lock.
      
      The reason this didn't use to happen was that the old logic in waiting
      on a page bit would just loop if it ever saw the bit set again.
      
      The nice proper fix would probably be to get rid of the whole "wait for
      writeback to clear, and then set it" logic in the writeback path, and
      replace it with an atomic "wait-to-set" (ie the same as we have for page
      locking: we set the page lock bit with a single "lock_page()", not with
      "wait for lock bit to clear and then set it").
      
      However, out current model for writeback is that the waiting for the
      writeback bit is done by the generic VFS code (ie write_cache_pages()),
      but the actual setting of the writeback bit is done much later by the
      filesystem ".writepages()" function.
      
      IOW, to make the writeback bit have that same kind of "wait-to-set"
      behavior as we have for page locking, we'd have to change our roughly
      ~50 different writeback functions.  Painful.
      
      Instead, just make "wait_on_page_writeback()" loop on the very unlikely
      situation that the PG_writeback bit is still set, basically re-instating
      the old behavior.  This is very non-optimal in case of contention, but
      since we only ever set the bit under the page lock, that situation is
      controlled.
      
      Reported-by: syzbot+2fc0712f8f8b8b8fa0ef@syzkaller.appspotmail.com
      Fixes: 2a9127fc ("mm: rewrite wait_on_page_bit_common() logic")
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c2407cf7
    • Dan Carpenter's avatar
      regmap: debugfs: Fix a reversed if statement in regmap_debugfs_init() · f6bcb4c7
      Dan Carpenter authored
      This code will leak "map->debugfs_name" because the if statement is
      reversed so it only frees NULL pointers instead of non-NULL.  In
      fact the if statement is not required and should just be removed
      because kfree() accepts NULL pointers.
      
      Fixes: cffa4b21 ("regmap: debugfs: Fix a memory leak when calling regmap_attach_dev")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Link: https://lore.kernel.org/r/X/RQpfAwRdLg0GqQ@mwandaSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      f6bcb4c7
  14. 04 Jan, 2021 12 commits