Skip to content
Permalink
Venky-Shankar/…
Switch branches/tags

Commits on Aug 18, 2021

  1. ceph: add debugfs entries for v2 (new) mount syntax support

    Signed-off-by: Venky Shankar <vshankar@redhat.com>
    vshankar authored and intel-lab-lkp committed Aug 18, 2021
  2. ceph: add helpers to create/cleanup debugfs sub-directories under "ce…

    …ph" directory
    
    Callers can use this helper to create a subdirectory under
    "ceph" directory in debugfs to place custom files for exporting
    information to userspace.
    
    Signed-off-by: Venky Shankar <vshankar@redhat.com>
    vshankar authored and intel-lab-lkp committed Aug 18, 2021

Commits on Aug 4, 2021

  1. ceph: take snap_empty_lock atomically with snaprealm refcount change

    There is a race in ceph_put_snap_realm. The change to the nref and the
    spinlock acquisition are not done atomically, so you could decrement
    nref, and before you take the spinlock, the nref is incremented again.
    At that point, you end up putting it on the empty list when it
    shouldn't be there. Eventually __cleanup_empty_realms runs and frees
    it when it's still in-use.
    
    Fix this by protecting the 1->0 transition with atomic_dec_and_lock,
    and just drop the spinlock if we can get the rwsem.
    
    Because these objects can also undergo a 0->1 refcount transition, we
    must protect that change as well with the spinlock. Increment locklessly
    unless the value is at 0, in which case we take the spinlock, increment
    and then take it off the empty list if it did the 0->1 transition.
    
    With these changes, I'm removing the dout() messages from these
    functions, as well as in __put_snap_realm. They've always been racy, and
    it's better to not print values that may be misleading.
    
    Cc: stable@vger.kernel.org
    URL: https://tracker.ceph.com/issues/46419
    Reported-by: Mark Nelson <mnelson@redhat.com>
    Signed-off-by: Jeff Layton <jlayton@kernel.org>
    Reviewed-by: Luis Henriques <lhenriques@suse.de>
    Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
    jtlayton authored and idryomov committed Aug 4, 2021
  2. ceph: reduce contention in ceph_check_delayed_caps()

    Function ceph_check_delayed_caps() is called from the mdsc->delayed_work
    workqueue and it can be kept looping for quite some time if caps keep
    being added back to the mdsc->cap_delay_list.  This may result in the
    watchdog tainting the kernel with the softlockup flag.
    
    This patch breaks this loop if the caps have been recently (i.e. during
    the loop execution).  Any new caps added to the list will be handled in
    the next run.
    
    Also, allow schedule_delayed() callers to explicitly set the delay value
    instead of defaulting to 5s, so we can ensure that it runs soon
    afterward if it looks like there is more work.
    
    Cc: stable@vger.kernel.org
    URL: https://tracker.ceph.com/issues/46284
    Signed-off-by: Luis Henriques <lhenriques@suse.de>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
    luis-henrix authored and idryomov committed Aug 4, 2021

Commits on Aug 2, 2021

  1. Linux 5.14-rc4

    torvalds committed Aug 2, 2021

Commits on Aug 1, 2021

  1. Merge tag 'perf-tools-fixes-for-v5.14-2021-08-01' of git://git.kernel…

    ….org/pub/scm/linux/kernel/git/acme/linux
    
    Pull perf tools fixes from Arnaldo Carvalho de Melo:
    
     - Revert "perf map: Fix dso->nsinfo refcounting", this makes 'perf top'
       abort, uncovering a design flaw on how namespace information is kept.
       The fix for that is more than we can do right now, leave it for the
       next merge window.
    
     - Split --dump-raw-trace by AUX records for ARM's CoreSight, fixing up
       the decoding of some records.
    
     - Fix PMU alias matching.
    
    Thanks to James Clark and John Garry for these fixes.
    
    * tag 'perf-tools-fixes-for-v5.14-2021-08-01' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
      Revert "perf map: Fix dso->nsinfo refcounting"
      perf pmu: Fix alias matching
      perf cs-etm: Split --dump-raw-trace by AUX records
    torvalds committed Aug 1, 2021
  2. Merge tag 'powerpc-5.14-4' of git://git.kernel.org/pub/scm/linux/kern…

    …el/git/powerpc/linux
    
    Pull powerpc fixes from Michael Ellerman:
    
     - Don't use r30 in VDSO code, to avoid breaking existing Go lang
       programs.
    
     - Change an export symbol to allow non-GPL modules to use spinlocks
       again.
    
    Thanks to Paul Menzel, and Srikar Dronamraju.
    
    * tag 'powerpc-5.14-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
      powerpc/vdso: Don't use r30 to avoid breaking Go lang
      powerpc/pseries: Fix regression while building external modules
    torvalds committed Aug 1, 2021
  3. Merge tag 'xfs-5.14-fixes-2' of git://git.kernel.org/pub/scm/fs/xfs/x…

    …fs-linux
    
    Pull xfs fixes from Darrick Wong:
     "This contains a bunch of bug fixes in XFS.
    
      Dave and I have been busy the last couple of weeks to find and fix as
      many log recovery bugs as we can find; here are the results so far. Go
      fstests -g recoveryloop! ;)
    
       - Fix a number of coordination bugs relating to cache flushes for
         metadata writeback, cache flushes for multi-buffer log writes, and
         FUA writes for single-buffer log writes
    
       - Fix a bug with incorrect replay of attr3 blocks
    
       - Fix unnecessary stalls when flushing logs to disk
    
       - Fix spoofing problems when recovering realtime bitmap blocks"
    
    * tag 'xfs-5.14-fixes-2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
      xfs: prevent spoofing of rtbitmap blocks when recovering buffers
      xfs: limit iclog tail updates
      xfs: need to see iclog flags in tracing
      xfs: Enforce attr3 buffer recovery order
      xfs: logging the on disk inode LSN can make it go backwards
      xfs: avoid unnecessary waits in xfs_log_force_lsn()
      xfs: log forces imply data device cache flushes
      xfs: factor out forced iclog flushes
      xfs: fix ordering violation between cache flushes and tail updates
      xfs: fold __xlog_state_release_iclog into xlog_state_release_iclog
      xfs: external logs need to flush data device
      xfs: flush data dev on external log write
    torvalds committed Aug 1, 2021

Commits on Jul 31, 2021

  1. Merge tag '5.14-rc3-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6

    Pull cifs fixes from Steve French:
     "Three cifs/smb3 fixes, including two for stable, and a fix for an
      fallocate problem noticed by Clang"
    
    * tag '5.14-rc3-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
      cifs: add missing parsing of backupuid
      smb3: rc uninitialized in one fallocate path
      SMB3: fix readpage for large swap cache
    torvalds committed Jul 31, 2021

Commits on Jul 30, 2021

  1. Merge tag 'net-5.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel…

    …/git/netdev/net
    
    Pull networking fixes from Jakub Kicinski:
     "Networking fixes for 5.14-rc4, including fixes from bpf, can, WiFi
      (mac80211) and netfilter trees.
    
      Current release - regressions:
    
       - mac80211: fix starting aggregation sessions on mesh interfaces
    
      Current release - new code bugs:
    
       - sctp: send pmtu probe only if packet loss in Search Complete state
    
       - bnxt_en: add missing periodic PHC overflow check
    
       - devlink: fix phys_port_name of virtual port and merge error
    
       - hns3: change the method of obtaining default ptp cycle
    
       - can: mcba_usb_start(): add missing urb->transfer_dma initialization
    
      Previous releases - regressions:
    
       - set true network header for ECN decapsulation
    
       - mlx5e: RX, avoid possible data corruption w/ relaxed ordering and
         LRO
    
       - phy: re-add check for PHY_BRCM_DIS_TXCRXC_NOENRGY on the BCM54811
         PHY
    
       - sctp: fix return value check in __sctp_rcv_asconf_lookup
    
      Previous releases - always broken:
    
       - bpf:
           - more spectre corner case fixes, introduce a BPF nospec
             instruction for mitigating Spectre v4
           - fix OOB read when printing XDP link fdinfo
           - sockmap: fix cleanup related races
    
       - mac80211: fix enabling 4-address mode on a sta vif after assoc
    
       - can:
           - raw: raw_setsockopt(): fix raw_rcv panic for sock UAF
           - j1939: j1939_session_deactivate(): clarify lifetime of session
             object, avoid UAF
           - fix number of identical memory leaks in USB drivers
    
       - tipc:
           - do not blindly write skb_shinfo frags when doing decryption
           - fix sleeping in tipc accept routine"
    
    * tag 'net-5.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (91 commits)
      gve: Update MAINTAINERS list
      can: esd_usb2: fix memory leak
      can: ems_usb: fix memory leak
      can: usb_8dev: fix memory leak
      can: mcba_usb_start(): add missing urb->transfer_dma initialization
      can: hi311x: fix a signedness bug in hi3110_cmd()
      MAINTAINERS: add Yasushi SHOJI as reviewer for the Microchip CAN BUS Analyzer Tool driver
      bpf: Fix leakage due to insufficient speculative store bypass mitigation
      bpf: Introduce BPF nospec instruction for mitigating Spectre v4
      sis900: Fix missing pci_disable_device() in probe and remove
      net: let flow have same hash in two directions
      nfc: nfcsim: fix use after free during module unload
      tulip: windbond-840: Fix missing pci_disable_device() in probe and remove
      sctp: fix return value check in __sctp_rcv_asconf_lookup
      nfc: s3fwrn5: fix undefined parameter values in dev_err()
      net/mlx5: Fix mlx5_vport_tbl_attr chain from u16 to u32
      net/mlx5e: Fix nullptr in mlx5e_hairpin_get_mdev()
      net/mlx5: Unload device upon firmware fatal error
      net/mlx5e: Fix page allocation failure for ptp-RQ over SF
      net/mlx5e: Fix page allocation failure for trap-RQ over SF
      ...
    torvalds committed Jul 30, 2021
  2. Merge tag 'acpi-5.14-rc4' of git://git.kernel.org/pub/scm/linux/kerne…

    …l/git/rafael/linux-pm
    
    Pull ACPI fixes from Rafael Wysocki:
     "These revert a recent IRQ resources handling modification that turned
      out to be problematic, fix suspend-to-idle handling on AMD platforms
      to take upcoming systems into account properly and fix the retrieval
      of the DPTF attributes of the PCH FIVR.
    
      Specifics:
    
       - Revert recent change of the ACPI IRQ resources handling that
         attempted to improve the ACPI IRQ override selection logic, but
         introduced serious regressions on some systems (Hui Wang).
    
       - Fix up quirks for AMD platforms in the suspend-to-idle support code
         so as to take upcoming systems using uPEP HID AMDI007 into account
         as appropriate (Mario Limonciello).
    
       - Fix the code retrieving DPTF attributes of the PCH FIVR so that it
         agrees on the return data type with the ACPI control method
         evaluated for this purpose (Srinivas Pandruvada)"
    
    * tag 'acpi-5.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
      ACPI: DPTF: Fix reading of attributes
      Revert "ACPI: resources: Add checks for ACPI IRQ override"
      ACPI: PM: Add support for upcoming AMD uPEP HID AMDI007
    torvalds committed Jul 30, 2021
  3. pipe: make pipe writes always wake up readers

    Since commit 1b6b26a ("pipe: fix and clarify pipe write wakeup
    logic") we have sanitized the pipe write logic, and would only try to
    wake up readers if they needed it.
    
    In particular, if the pipe already had data in it before the write,
    there was no point in trying to wake up a reader, since any existing
    readers must have been aware of the pre-existing data already.  Doing
    extraneous wakeups will only cause potential thundering herd problems.
    
    However, it turns out that some Android libraries have misused the EPOLL
    interface, and expected "edge triggered" be to "any new write will
    trigger it".  Even if there was no edge in sight.
    
    Quoting Sandeep Patil:
     "The commit 1b6b26a ('pipe: fix and clarify pipe write wakeup
      logic') changed pipe write logic to wakeup readers only if the pipe
      was empty at the time of write. However, there are libraries that
      relied upon the older behavior for notification scheme similar to
      what's described in [1]
    
      One such library 'realm-core'[2] is used by numerous Android
      applications. The library uses a similar notification mechanism as GNU
      Make but it never drains the pipe until it is full. When Android moved
      to v5.10 kernel, all applications using this library stopped working.
    
      The library has since been fixed[3] but it will be a while before all
      applications incorporate the updated library"
    
    Our regression rule for the kernel is that if applications break from
    new behavior, it's a regression, even if it was because the application
    did something patently wrong.  Also note the original report [4] by
    Michal Kerrisk about a test for this epoll behavior - but at that point
    we didn't know of any actual broken use case.
    
    So add the extraneous wakeup, to approximate the old behavior.
    
    [ I say "approximate", because the exact old behavior was to do a wakeup
      not for each write(), but for each pipe buffer chunk that was filled
      in. The behavior introduced by this change is not that - this is just
      "every write will cause a wakeup, whether necessary or not", which
      seems to be sufficient for the broken library use. ]
    
    It's worth noting that this adds the extraneous wakeup only for the
    write side, while the read side still considers the "edge" to be purely
    about reading enough from the pipe to allow further writes.
    
    See commit f467a6a ("pipe: fix and clarify pipe read wakeup logic")
    for the pipe read case, which remains that "only wake up if the pipe was
    full, and we read something from it".
    
    Link: https://lore.kernel.org/lkml/CAHk-=wjeG0q1vgzu4iJhW5juPkTsjTYmiqiMUYAebWW+0bam6w@mail.gmail.com/ [1]
    Link: https://github.com/realm/realm-core [2]
    Link: realm/realm-core#4666 [3]
    Link: https://lore.kernel.org/lkml/CAKgNAkjMBGeAwF=2MKK758BhxvW58wYTgYKB2V-gY1PwXxrH+Q@mail.gmail.com/ [4]
    Link: https://lore.kernel.org/lkml/20210729222635.2937453-1-sspatil@android.com/
    Reported-by: Sandeep Patil <sspatil@android.com>
    Cc: Michael Kerrisk <mtk.manpages@gmail.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    torvalds committed Jul 30, 2021
  4. Revert "perf map: Fix dso->nsinfo refcounting"

    This makes 'perf top' abort in some cases, and the right fix will
    involve surgery that is too much to do at this stage, so revert for now
    and fix it in the next merge window.
    
    This reverts commit 2d6b74b.
    
    Cc: Riccardo Mancini <rickyman7@gmail.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Krister Johansen <kjlx@templeofstupid.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Arnaldo Carvalho de Melo committed Jul 30, 2021
  5. Merge branches 'acpi-resources' and 'acpi-dptf'

    * acpi-resources:
      Revert "ACPI: resources: Add checks for ACPI IRQ override"
    
    * acpi-dptf:
      ACPI: DPTF: Fix reading of attributes
    rafaeljw committed Jul 30, 2021
  6. Merge tag 'block-5.14-2021-07-30' of git://git.kernel.dk/linux-block

    Pull block fixes from Jens Axboe:
    
     - gendisk freeing fix (Christoph)
    
     - blk-iocost wake ordering fix (Tejun)
    
     - tag allocation error handling fix (John)
    
     - loop locking fix. While this isn't the prettiest fix in the world,
       nobody has any good alternatives for 5.14. Something to likely
       revisit for 5.15. (Tetsuo)
    
    * tag 'block-5.14-2021-07-30' of git://git.kernel.dk/linux-block:
      block: delay freeing the gendisk
      blk-iocost: fix operation ordering in iocg_wake_fn()
      blk-mq-sched: Fix blk_mq_sched_alloc_tags() error handling
      loop: reintroduce global lock for safe loop_validate_file() traversal
    torvalds committed Jul 30, 2021
  7. Merge tag 'io_uring-5.14-2021-07-30' of git://git.kernel.dk/linux-block

    Pull io_uring fixes from Jens Axboe:
    
     - A fix for block backed reissue (me)
    
     - Reissue context hardening (me)
    
     - Async link locking fix (Pavel)
    
    * tag 'io_uring-5.14-2021-07-30' of git://git.kernel.dk/linux-block:
      io_uring: fix poll requests leaking second poll entries
      io_uring: don't block level reissue off completion path
      io_uring: always reissue from task_work context
      io_uring: fix race in unified task_work running
      io_uring: fix io_prep_async_link locking
    torvalds committed Jul 30, 2021
  8. Merge tag 'libata-5.14-2021-07-30' of git://git.kernel.dk/linux-block

    Pull libata fixlets from Jens Axboe:
    
     - A fix for PIO highmem (Christoph)
    
     - Kill HAVE_IDE as it's now unused (Lukas)
    
    * tag 'libata-5.14-2021-07-30' of git://git.kernel.dk/linux-block:
      arch: Kconfig: clean up obsolete use of HAVE_IDE
      libata: fix ata_pio_sector for CONFIG_HIGHMEM
    torvalds committed Jul 30, 2021
  9. Merge tag 'for-5.14-rc3-tag' of git://git.kernel.org/pub/scm/linux/ke…

    …rnel/git/kdave/linux
    
    Pull btrfs fixes from David Sterba:
    
     - fix -Warray-bounds warning, to help external patchset to make it
       default treewide
    
     - fix writeable device accounting (syzbot report)
    
     - fix fsync and log replay after a rename and inode eviction
    
     - fix potentially lost error code when submitting multiple bios for
       compressed range
    
    * tag 'for-5.14-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
      btrfs: calculate number of eb pages properly in csum_tree_block
      btrfs: fix rw device counting in __btrfs_free_extra_devids
      btrfs: fix lost inode on log replay after mix of fsync, rename and inode eviction
      btrfs: mark compressed range uptodate only if all bio succeed
    torvalds committed Jul 30, 2021
  10. Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…

    …/git/hid/hid
    
    Pull HID fixes from Jiri Kosina:
    
     - resume timing fix for intel-ish driver (Ye Xiang)
    
     - fix for using incorrect MMIO register in amd_sfh driver (Dylan
       MacKenzie)
    
     - Cintiq 24HDT / 27QHDT regression fix and touch processing fix for
       Wacom driver (Jason Gerecke)
    
     - device removal bugfix for ft260 driver (Michael Zaidman)
    
     - other small assorted fixes
    
    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
      HID: ft260: fix device removal due to USB disconnect
      HID: wacom: Skip processing of touches with negative slot values
      HID: wacom: Re-enable touch by default for Cintiq 24HDT / 27QHDT
      HID: Kconfig: Fix spelling mistake "Uninterruptable" -> "Uninterruptible"
      HID: apple: Add support for Keychron K1 wireless keyboard
      HID: fix typo in Kconfig
      HID: ft260: fix format type warning in ft260_word_show()
      HID: amd_sfh: Use correct MMIO register for DMA address
      HID: asus: Remove check for same LED brightness on set
      HID: intel-ish-hid: use async resume function
    torvalds committed Jul 30, 2021
  11. Merge branch 'akpm' (patches from Andrew)

    Merge misc fixes from Andrew Morton:
     "7 patches.
    
      Subsystems affected by this patch series: lib, ocfs2, and mm (slub,
      migration, and memcg)"
    
    * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
      mm/memcg: fix NULL pointer dereference in memcg_slab_free_hook()
      slub: fix unreclaimable slab stat for bulk free
      mm/migrate: fix NR_ISOLATED corruption on 64-bit
      mm: memcontrol: fix blocking rstat function called from atomic cgroup1 thresholding code
      ocfs2: issue zeroout to EOF blocks
      ocfs2: fix zero out valid data
      lib/test_string.c: move string selftest in the Runtime Testing menu
    torvalds committed Jul 30, 2021
  12. Merge tag 'linux-can-fixes-for-5.14-20210730' of git://git.kernel.org…

    …/pub/scm/linux/kernel/git/mkl/linux-can
    
    Marc Kleine-Budde says:
    
    ====================
    pull-request: can 2021-07-30
    
    The first patch is by me and adds Yasushi SHOJI as a reviewer for the
    Microchip CAN BUS Analyzer Tool driver.
    
    Dan Carpenter's patch fixes a signedness bug in the hi311x driver.
    
    Pavel Skripkin provides 4 patches, the first targets the mcba_usb
    driver by adding the missing urb->transfer_dma initialization, which
    was broken in a previous commit. The last 3 patches fix a memory leak
    in the usb_8dev, ems_usb and esd_usb2 driver.
    
    * tag 'linux-can-fixes-for-5.14-20210730' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can:
      can: esd_usb2: fix memory leak
      can: ems_usb: fix memory leak
      can: usb_8dev: fix memory leak
      can: mcba_usb_start(): add missing urb->transfer_dma initialization
      can: hi311x: fix a signedness bug in hi3110_cmd()
      MAINTAINERS: add Yasushi SHOJI as reviewer for the Microchip CAN BUS Analyzer Tool driver
    ====================
    
    Link: https://lore.kernel.org/r/20210730070526.1699867-1-mkl@pengutronix.de
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Jakub Kicinski committed Jul 30, 2021
  13. mm/memcg: fix NULL pointer dereference in memcg_slab_free_hook()

    When I use kfree_rcu() to free a large memory allocated by kmalloc_node(),
    the following dump occurs.
    
      BUG: kernel NULL pointer dereference, address: 0000000000000020
      [...]
      Oops: 0000 [#1] SMP
      [...]
      Workqueue: events kfree_rcu_work
      RIP: 0010:__obj_to_index include/linux/slub_def.h:182 [inline]
      RIP: 0010:obj_to_index include/linux/slub_def.h:191 [inline]
      RIP: 0010:memcg_slab_free_hook+0x120/0x260 mm/slab.h:363
      [...]
      Call Trace:
        kmem_cache_free_bulk+0x58/0x630 mm/slub.c:3293
        kfree_bulk include/linux/slab.h:413 [inline]
        kfree_rcu_work+0x1ab/0x200 kernel/rcu/tree.c:3300
        process_one_work+0x207/0x530 kernel/workqueue.c:2276
        worker_thread+0x320/0x610 kernel/workqueue.c:2422
        kthread+0x13d/0x160 kernel/kthread.c:313
        ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294
    
    When kmalloc_node() a large memory, page is allocated, not slab, so when
    freeing memory via kfree_rcu(), this large memory should not be used by
    memcg_slab_free_hook(), because memcg_slab_free_hook() is is used for
    slab.
    
    Using page_objcgs_check() instead of page_objcgs() in
    memcg_slab_free_hook() to fix this bug.
    
    Link: https://lkml.kernel.org/r/20210728145655.274476-1-wanghai38@huawei.com
    Fixes: 270c6a7 ("mm: memcontrol/slab: Use helpers to access slab page's memcg_data")
    Signed-off-by: Wang Hai <wanghai38@huawei.com>
    Reviewed-by: Shakeel Butt <shakeelb@google.com>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Acked-by: Roman Gushchin <guro@fb.com>
    Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
    Reviewed-by: Muchun Song <songmuchun@bytedance.com>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: Pekka Enberg <penberg@kernel.org>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Alexei Starovoitov <ast@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Wang Hai authored and torvalds committed Jul 30, 2021
  14. slub: fix unreclaimable slab stat for bulk free

    SLUB uses page allocator for higher order allocations and update
    unreclaimable slab stat for such allocations.  At the moment, the bulk
    free for SLUB does not share code with normal free code path for these
    type of allocations and have missed the stat update.  So, fix the stat
    update by common code.  The user visible impact of the bug is the
    potential of inconsistent unreclaimable slab stat visible through
    meminfo and vmstat.
    
    Link: https://lkml.kernel.org/r/20210728155354.3440560-1-shakeelb@google.com
    Fixes: 6a486c0 ("mm, sl[ou]b: improve memory accounting")
    Signed-off-by: Shakeel Butt <shakeelb@google.com>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Acked-by: Roman Gushchin <guro@fb.com>
    Reviewed-by: Muchun Song <songmuchun@bytedance.com>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: Pekka Enberg <penberg@kernel.org>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    shakeelb authored and torvalds committed Jul 30, 2021
  15. mm/migrate: fix NR_ISOLATED corruption on 64-bit

    Similar to commit 2da9f63 ("mm/vmscan: fix NR_ISOLATED_FILE
    corruption on 64-bit") avoid using unsigned int for nr_pages.  With
    unsigned int type the large unsigned int converts to a large positive
    signed long.
    
    Symptoms include CMA allocations hanging forever due to
    alloc_contig_range->...->isolate_migratepages_block waiting forever in
    "while (unlikely(too_many_isolated(pgdat)))".
    
    Link: https://lkml.kernel.org/r/20210728042531.359409-1-aneesh.kumar@linux.ibm.com
    Fixes: c5fc5c3 ("mm: migrate: account THP NUMA migration counters correctly")
    Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
    Reported-by: Michael Ellerman <mpe@ellerman.id.au>
    Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
    Reviewed-by: Yang Shi <shy828301@gmail.com>
    Cc: Mel Gorman <mgorman@suse.de>
    Cc: Nicholas Piggin <npiggin@gmail.com>
    Cc: David Hildenbrand <david@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    kvaneesh authored and torvalds committed Jul 30, 2021
  16. mm: memcontrol: fix blocking rstat function called from atomic cgroup…

    …1 thresholding code
    
    Dan Carpenter reports:
    
        The patch 2d146aa: "mm: memcontrol: switch to rstat" from Apr
        29, 2021, leads to the following static checker warning:
    
    	    kernel/cgroup/rstat.c:200 cgroup_rstat_flush()
    	    warn: sleeping in atomic context
    
        mm/memcontrol.c
          3572  static unsigned long mem_cgroup_usage(struct mem_cgroup *memcg, bool swap)
          3573  {
          3574          unsigned long val;
          3575
          3576          if (mem_cgroup_is_root(memcg)) {
          3577                  cgroup_rstat_flush(memcg->css.cgroup);
    			    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
        This is from static analysis and potentially a false positive.  The
        problem is that mem_cgroup_usage() is called from __mem_cgroup_threshold()
        which holds an rcu_read_lock().  And the cgroup_rstat_flush() function
        can sleep.
    
          3578                  val = memcg_page_state(memcg, NR_FILE_PAGES) +
          3579                          memcg_page_state(memcg, NR_ANON_MAPPED);
          3580                  if (swap)
          3581                          val += memcg_page_state(memcg, MEMCG_SWAP);
          3582          } else {
          3583                  if (!swap)
          3584                          val = page_counter_read(&memcg->memory);
          3585                  else
          3586                          val = page_counter_read(&memcg->memsw);
          3587          }
          3588          return val;
          3589  }
    
    __mem_cgroup_threshold() indeed holds the rcu lock.  In addition, the
    thresholding code is invoked during stat changes, and those contexts
    have irqs disabled as well.  If the lock breaking occurs inside the
    flush function, it will result in a sleep from an atomic context.
    
    Use the irqsafe flushing variant in mem_cgroup_usage() to fix this.
    
    Link: https://lkml.kernel.org/r/20210726150019.251820-1-hannes@cmpxchg.org
    Fixes: 2d146aa ("mm: memcontrol: switch to rstat")
    Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
    Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
    Acked-by: Chris Down <chris@chrisdown.name>
    Reviewed-by: Rik van Riel <riel@surriel.com>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Reviewed-by: Shakeel Butt <shakeelb@google.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    hnaz authored and torvalds committed Jul 30, 2021
  17. ocfs2: issue zeroout to EOF blocks

    For punch holes in EOF blocks, fallocate used buffer write to zero the
    EOF blocks in last cluster.  But since ->writepage will ignore EOF
    pages, those zeros will not be flushed.
    
    This "looks" ok as commit 6bba447 ("ocfs2: fix data corruption by
    fallocate") will zero the EOF blocks when extend the file size, but it
    isn't.  The problem happened on those EOF pages, before writeback, those
    pages had DIRTY flag set and all buffer_head in them also had DIRTY flag
    set, when writeback run by write_cache_pages(), DIRTY flag on the page
    was cleared, but DIRTY flag on the buffer_head not.
    
    When next write happened to those EOF pages, since buffer_head already
    had DIRTY flag set, it would not mark page DIRTY again.  That made
    writeback ignore them forever.  That will cause data corruption.  Even
    directio write can't work because it will fail when trying to drop pages
    caches before direct io, as it found the buffer_head for those pages
    still had DIRTY flag set, then it will fall back to buffer io mode.
    
    To make a summary of the issue, as writeback ingores EOF pages, once any
    EOF page is generated, any write to it will only go to the page cache,
    it will never be flushed to disk even file size extends and that page is
    not EOF page any more.  The fix is to avoid zero EOF blocks with buffer
    write.
    
    The following code snippet from qemu-img could trigger the corruption.
    
      656   open("6b3711ae-3306-4bdd-823c-cf1c0060a095.conv.2", O_RDWR|O_DIRECT|O_CLOEXEC) = 11
      ...
      660   fallocate(11, FALLOC_FL_KEEP_SIZE|FALLOC_FL_PUNCH_HOLE, 2275868672, 327680 <unfinished ...>
      660   fallocate(11, 0, 2275868672, 327680) = 0
      658   pwrite64(11, "
    
    Link: https://lkml.kernel.org/r/20210722054923.24389-2-junxiao.bi@oracle.com
    Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
    Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Changwei Ge <gechangwei@live.cn>
    Cc: Gang He <ghe@suse.com>
    Cc: Jun Piao <piaojun@huawei.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    biger410 authored and torvalds committed Jul 30, 2021
  18. ocfs2: fix zero out valid data

    If append-dio feature is enabled, direct-io write and fallocate could
    run in parallel to extend file size, fallocate used "orig_isize" to
    record i_size before taking "ip_alloc_sem", when
    ocfs2_zeroout_partial_cluster() zeroout EOF blocks, i_size maybe already
    extended by ocfs2_dio_end_io_write(), that will cause valid data zeroed
    out.
    
    Link: https://lkml.kernel.org/r/20210722054923.24389-1-junxiao.bi@oracle.com
    Fixes: 6bba447 ("ocfs2: fix data corruption by fallocate")
    Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
    Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Changwei Ge <gechangwei@live.cn>
    Cc: Gang He <ghe@suse.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Jun Piao <piaojun@huawei.com>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    biger410 authored and torvalds committed Jul 30, 2021
  19. lib/test_string.c: move string selftest in the Runtime Testing menu

    STRING_SELFTEST is presented in the "Library routines" menu.  Move it in
    Kernel hacking > Kernel Testing and Coverage > Runtime Testing together
    with other similar tests found in lib/
    
    	--- Runtime Testing
    	<*>   Test functions located in the hexdump module at runtime
    	<*>   Test string functions (NEW)
    	<*>   Test functions located in the string_helpers module at runtime
    	<*>   Test strscpy*() family of functions at runtime
    	<*>   Test kstrto*() family of functions at runtime
    	<*>   Test printf() family of functions at runtime
    	<*>   Test scanf() family of functions at runtime
    
    Link: https://lkml.kernel.org/r/20210719185158.190371-1-mcroce@linux.microsoft.com
    Signed-off-by: Matteo Croce <mcroce@microsoft.com>
    Cc: Peter Rosin <peda@axentia.se>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Randy Dunlap <rdunlap@infradead.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    teknoraver authored and torvalds committed Jul 30, 2021
  20. gve: Update MAINTAINERS list

    The team maintaining the gve driver has undergone some changes,
    this updates the MAINTAINERS file accordingly.
    
    Signed-off-by: Catherine Sullivan <csully@google.com>
    Signed-off-by: Jon Olson <jonolson@google.com>
    Signed-off-by: David Awogbemila <awogbemila@google.com>
    Signed-off-by: Jeroen de Borst <jeroendb@google.com>
    Link: https://lore.kernel.org/r/20210729155258.442650-1-csully@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    catSully012 authored and Jakub Kicinski committed Jul 30, 2021
  21. arch: Kconfig: clean up obsolete use of HAVE_IDE

    The arch-specific Kconfig files use HAVE_IDE to indicate if IDE is
    supported.
    
    As IDE support and the HAVE_IDE config vanishes with commit b7fb14d
    ("ide: remove the legacy ide driver"), there is no need to mention
    HAVE_IDE in all those arch-specific Kconfig files.
    
    The issue was identified with ./scripts/checkkconfigsymbols.py.
    
    Fixes: b7fb14d ("ide: remove the legacy ide driver")
    Suggested-by: Randy Dunlap <rdunlap@infradead.org>
    Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
    Acked-by: Randy Dunlap <rdunlap@infradead.org>
    Link: https://lore.kernel.org/r/20210728182115.4401-1-lukas.bulwahn@gmail.com
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    bulwahn authored and axboe committed Jul 30, 2021
  22. can: esd_usb2: fix memory leak

    In esd_usb2_setup_rx_urbs() MAX_RX_URBS coherent buffers are allocated
    and there is nothing, that frees them:
    
    1) In callback function the urb is resubmitted and that's all
    2) In disconnect function urbs are simply killed, but URB_FREE_BUFFER
       is not set (see esd_usb2_setup_rx_urbs) and this flag cannot be used
       with coherent buffers.
    
    So, all allocated buffers should be freed with usb_free_coherent()
    explicitly.
    
    Side note: This code looks like a copy-paste of other can drivers. The
    same patch was applied to mcba_usb driver and it works nice with real
    hardware. There is no change in functionality, only clean-up code for
    coherent buffers.
    
    Fixes: 96d8e90 ("can: Add driver for esd CAN-USB/2 device")
    Link: https://lore.kernel.org/r/b31b096926dcb35998ad0271aac4b51770ca7cc8.1627404470.git.paskripkin@gmail.com
    Cc: linux-stable <stable@vger.kernel.org>
    Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    pskrgag authored and marckleinebudde committed Jul 30, 2021
  23. can: ems_usb: fix memory leak

    In ems_usb_start() MAX_RX_URBS coherent buffers are allocated and
    there is nothing, that frees them:
    
    1) In callback function the urb is resubmitted and that's all
    2) In disconnect function urbs are simply killed, but URB_FREE_BUFFER
       is not set (see ems_usb_start) and this flag cannot be used with
       coherent buffers.
    
    So, all allocated buffers should be freed with usb_free_coherent()
    explicitly.
    
    Side note: This code looks like a copy-paste of other can drivers. The
    same patch was applied to mcba_usb driver and it works nice with real
    hardware. There is no change in functionality, only clean-up code for
    coherent buffers.
    
    Fixes: 702171a ("ems_usb: Added support for EMS CPC-USB/ARM7 CAN/USB interface")
    Link: https://lore.kernel.org/r/59aa9fbc9a8cbf9af2bbd2f61a659c480b415800.1627404470.git.paskripkin@gmail.com
    Cc: linux-stable <stable@vger.kernel.org>
    Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    pskrgag authored and marckleinebudde committed Jul 30, 2021
  24. can: usb_8dev: fix memory leak

    In usb_8dev_start() MAX_RX_URBS coherent buffers are allocated and
    there is nothing, that frees them:
    
    1) In callback function the urb is resubmitted and that's all
    2) In disconnect function urbs are simply killed, but URB_FREE_BUFFER
       is not set (see usb_8dev_start) and this flag cannot be used with
       coherent buffers.
    
    So, all allocated buffers should be freed with usb_free_coherent()
    explicitly.
    
    Side note: This code looks like a copy-paste of other can drivers. The
    same patch was applied to mcba_usb driver and it works nice with real
    hardware. There is no change in functionality, only clean-up code for
    coherent buffers.
    
    Fixes: 0024d8a ("can: usb_8dev: Add support for USB2CAN interface from 8 devices")
    Link: https://lore.kernel.org/r/d39b458cd425a1cf7f512f340224e6e9563b07bd.1627404470.git.paskripkin@gmail.com
    Cc: linux-stable <stable@vger.kernel.org>
    Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    pskrgag authored and marckleinebudde committed Jul 30, 2021
  25. can: mcba_usb_start(): add missing urb->transfer_dma initialization

    Yasushi reported, that his Microchip CAN Analyzer stopped working
    since commit 91c0255 ("can: mcba_usb: fix memory leak in
    mcba_usb"). The problem was in missing urb->transfer_dma
    initialization.
    
    In my previous patch to this driver I refactored mcba_usb_start() code
    to avoid leaking usb coherent buffers. To archive it, I passed local
    stack variable to usb_alloc_coherent() and then saved it to private
    array to correctly free all coherent buffers on ->close() call. But I
    forgot to initialize urb->transfer_dma with variable passed to
    usb_alloc_coherent().
    
    All of this was causing device to not work, since dma addr 0 is not
    valid and following log can be found on bug report page, which points
    exactly to problem described above.
    
    | DMAR: [DMA Write] Request device [00:14.0] PASID ffffffff fault addr 0 [fault reason 05] PTE Write access is not set
    
    Fixes: 91c0255 ("can: mcba_usb: fix memory leak in mcba_usb")
    Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=990850
    Link: https://lore.kernel.org/r/20210725103630.23864-1-paskripkin@gmail.com
    Cc: linux-stable <stable@vger.kernel.org>
    Reported-by: Yasushi SHOJI <yasushi.shoji@gmail.com>
    Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
    Tested-by: Yasushi SHOJI <yashi@spacecubics.com>
    [mkl: fixed typos in commit message - thanks Yasushi SHOJI]
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    pskrgag authored and marckleinebudde committed Jul 30, 2021
  26. can: hi311x: fix a signedness bug in hi3110_cmd()

    The hi3110_cmd() is supposed to return zero on success and negative
    error codes on failure, but it was accidentally declared as a u8 when
    it needs to be an int type.
    
    Fixes: 57e83fb ("can: hi311x: Add Holt HI-311x CAN driver")
    Link: https://lore.kernel.org/r/20210729141246.GA1267@kili
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    error27 authored and marckleinebudde committed Jul 30, 2021
Older