01 Oct, 2020

40 commits

  • [ Upstream commit 6a0137101f47301fff2da6ba4b9048383d569909 ]

    The MPMAN Converter9 2-in-1 almost fully works with out default settings.
    The only problem is that it has only 1 speaker so any sounds only playing
    on the right channel get lost.

    Add a quirk for this model using the default settings + MONO_SPEAKER.

    Signed-off-by: Hans de Goede
    Acked-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20200901080623.4987-1-hdegoede@redhat.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Hans de Goede
     
  • [ Upstream commit f5a2cda4f1db89776b64c4f0f2c2ac609527ac70 ]

    When the wm8958_mic_detect, wm8994_mic_detect functions get called from
    the machine driver, e.g. from the card's late_probe() callback, the CODEC
    device may be PM runtime suspended and any regmap writes have no effect.
    Add PM runtime calls to these functions to ensure the device registers
    are updated as expected.
    This suppresses an error during boot
    "wm8994-codec: ASoC: error at snd_soc_component_update_bits on wm8994-codec"
    caused by the regmap access error due to the cache_only flag being set.

    Signed-off-by: Sylwester Nawrocki
    Acked-by: Krzysztof Kozlowski
    Acked-by: Charles Keepax
    Link: https://lore.kernel.org/r/20200827173357.31891-2-s.nawrocki@samsung.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Sylwester Nawrocki
     
  • [ Upstream commit 811c5494436789e7149487c06e0602b507ce274b ]

    The WM8994_MICBIAS register is not available in the WM1811 CODEC so skip
    initialization of that register for that device.
    This suppresses an error during boot:
    "wm8994-codec: ASoC: error at snd_soc_component_update_bits on wm8994-codec"

    Signed-off-by: Sylwester Nawrocki
    Acked-by: Krzysztof Kozlowski
    Acked-by: Charles Keepax
    Link: https://lore.kernel.org/r/20200827173357.31891-1-s.nawrocki@samsung.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Sylwester Nawrocki
     
  • [ Upstream commit 7ad26d6671db758c959d7e1d100b138a38483612 ]

    Some sound card try to set 0 Hz as reset, but it is impossible.
    This patch ignores it to avoid error return.

    Signed-off-by: Kuninori Morimoto
    Link: https://lore.kernel.org/r/87a6yjy5sy.wl-kuninori.morimoto.gx@renesas.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Kuninori Morimoto
     
  • [ Upstream commit bc62d68e2a0a69fcdcf28aca8edb01abf306b698 ]

    exceptions may be traversed using list_for_each_entry_rcu()
    outside of an RCU read side critical section BUT under the
    protection of decgroup_mutex. Hence add the corresponding
    lockdep expression to fix the following false-positive
    warning:

    [ 2.304417] =============================
    [ 2.304418] WARNING: suspicious RCU usage
    [ 2.304420] 5.5.4-stable #17 Tainted: G E
    [ 2.304422] -----------------------------
    [ 2.304424] security/device_cgroup.c:355 RCU-list traversed in non-reader section!!

    Signed-off-by: Amol Grover
    Signed-off-by: James Morris
    Signed-off-by: Sasha Levin

    Amol Grover
     
  • [ Upstream commit 05b29021fba5e725dd385151ef00b6340229b500 ]

    Commit 3b4b19721ec652 ("nvme: fix possible deadlock when I/O is
    blocked") reverted multipath head disk revalidation due to deadlocks
    caused by holding the bd_mutex during revalidate.

    Updating the multipath disk blockdev size is still required though for
    userspace to be able to observe any resizing while the device is
    mounted. Directly update the bdev inode size to avoid unnecessarily
    holding the bdev->bd_mutex.

    Fixes: 3b4b19721ec652 ("nvme: fix possible deadlock when I/O is
    blocked")

    Signed-off-by: Anthony Iliopoulos
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Sasha Levin

    Anthony Iliopoulos
     
  • [ Upstream commit 659d4587fe7233bfdff303744b20d6f41ad04362 ]

    Compile the kernel for arm 32 platform, the build warning found.
    To fix that, should use div_u64() for divisions.
    | net/openvswitch/meter.c:396: undefined reference to `__udivdi3'

    [add more commit msg, change reported tag, and use div_u64 instead
    of do_div by Tonghao]

    Fixes: e57358873bb5d6ca ("net: openvswitch: use u64 for meter bucket")
    Reported-by: kbuild test robot
    Signed-off-by: Tonghao Zhang
    Tested-by: Tonghao Zhang
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Tonghao Zhang
     
  • [ Upstream commit a6630529aecb5a3e84370c376ed658e892e6261e ]

    We've received a regression report on Intel HD-audio controller that
    wakes up immediately after S3 suspend. The bisection leads to the
    commit c4c8dd6ef807 ("ALSA: hda: Skip controller resume if not
    needed"). This commit replaces the system-suspend to use
    pm_runtime_force_suspend() instead of the direct call of
    __azx_runtime_suspend(). However, by some really mysterious reason,
    pm_runtime_force_suspend() causes a spurious wakeup (although it calls
    the same __azx_runtime_suspend() internally).

    As an ugly workaround for now, revert the behavior to call
    __azx_runtime_suspend() and __azx_runtime_resume() for those old Intel
    platforms that may exhibit such a problem, while keeping the new
    standard pm_runtime_force_suspend() and pm_runtime_force_resume()
    pair for the remaining chips.

    Fixes: c4c8dd6ef807 ("ALSA: hda: Skip controller resume if not needed")
    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=208649
    Cc:
    Link: https://lore.kernel.org/r/20200727164443.4233-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Takashi Iwai
     
  • [ Upstream commit 8d6762af302d69f76fa788a277a56a9d9cd275d5 ]

    HD-audio codec driver applies a tricky procedure to forcibly perform
    the runtime resume by mimicking the usage count even if the device has
    been runtime-suspended beforehand. This was needed to assure to
    trigger the jack detection update after the system resume.

    And recently we also applied the similar logic to the HD-audio
    controller side. However this seems leading to some inconsistency,
    and eventually PCI controller gets screwed up.

    This patch is an attempt to fix and clean up those behavior: instead
    of the tricky runtime resume procedure, the existing jackpoll work is
    scheduled when such a forced codec resume is required. The jackpoll
    work will power up the codec, and this alone should suffice for the
    jack status update in usual cases. If the extra polling is requested
    (by checking codec->jackpoll_interval), the manual update is invoked
    after that, and the codec is powered down again.

    Also, we filter the spurious wake up of the codec from the controller
    runtime resume by checking codec->relaxed_resume flag. If this flag
    is set, basically we don't need to wake up explicitly, but it's
    supposed to be done via the audio component notifier.

    Fixes: c4c8dd6ef807 ("ALSA: hda: Skip controller resume if not needed")
    Link: https://lore.kernel.org/r/20200422203744.26299-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Takashi Iwai
     
  • [ Upstream commit 8510895bafdbf7c4dd24c22946d925691135c2b2 ]

    A big uncore event group is split into multiple small groups which only
    include the uncore events from the same PMU. This has been supported in
    the commit 3cdc5c2cb924a ("perf parse-events: Handle uncore event
    aliases in small groups properly").

    If the event's PMU name starts to repeat, it must be a new event.
    That can be used to distinguish the leader from other members.
    But now it only compares the pointer of pmu_name
    (leader->pmu_name == evsel->pmu_name).

    If we use "perf stat -M LLC_MISSES.PCIE_WRITE -a" on cascadelakex,
    the event list is:

    evsel->name evsel->pmu_name
    ---------------------------------------------------------------
    unc_iio_data_req_of_cpu.mem_write.part0 uncore_iio_4 (as leader)
    unc_iio_data_req_of_cpu.mem_write.part0 uncore_iio_2
    unc_iio_data_req_of_cpu.mem_write.part0 uncore_iio_0
    unc_iio_data_req_of_cpu.mem_write.part0 uncore_iio_5
    unc_iio_data_req_of_cpu.mem_write.part0 uncore_iio_3
    unc_iio_data_req_of_cpu.mem_write.part0 uncore_iio_1
    unc_iio_data_req_of_cpu.mem_write.part1 uncore_iio_4
    ......

    For the event "unc_iio_data_req_of_cpu.mem_write.part1" with
    "uncore_iio_4", it should be the event from PMU "uncore_iio_4".
    It's not a new leader for this PMU.

    But if we use "(leader->pmu_name == evsel->pmu_name)", the check
    would be failed and the event is stored to leaders[] as a new
    PMU leader.

    So this patch uses strcmp to compare the PMU name between events.

    Fixes: d4953f7ef1a2 ("perf parse-events: Fix 3 use after frees found with clang ASAN")
    Signed-off-by: Jin Yao
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Jin Yao
    Cc: Kan Liang
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/20200430003618.17002-1-yao.jin@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Jin Yao
     
  • [ Upstream commit 6544abc520f0fff701e9da382110dc29676c683a ]

    Currently, when using _of_add_opp_table_v2 parsed_static_opps is
    increased and this value is used in _opp_remove_all_static() to
    check if there are static opp entries that need to be freed.
    Unfortunately this does not happen when using _of_add_opp_table_v1(),
    which leads to warnings.

    This patch increases parsed_static_opps in _of_add_opp_table_v1() in a
    similar way as in _of_add_opp_table_v2().

    Fixes: 03758d60265c ("opp: Replace list_kref with a local counter")
    Cc: v5.6+ # v5.6+
    Signed-off-by: Walter Lozano
    [ Viresh: Do the operation with lock held and set the value to 1 instead
    of incrementing it ]
    Signed-off-by: Viresh Kumar
    Signed-off-by: Sasha Levin

    Walter Lozano
     
  • [ Upstream commit d68f4e43a46ff1f772ff73085f96d44eb4163e9d ]

    The mt76_led_cleanup() function is called unconditionally, which
    leads to a link error when CONFIG_LEDS is a loadable module or
    disabled but mt76 is built-in:

    drivers/net/wireless/mediatek/mt76/mac80211.o: In function `mt76_unregister_device':
    mac80211.c:(.text+0x2ac): undefined reference to `led_classdev_unregister'

    Use the same trick that is guarding the registration, using an
    IS_ENABLED() check for the CONFIG_MT76_LEDS symbol that indicates
    whether LEDs can be used or not.

    Fixes: 36f7e2b2bb1d ("mt76: do not use devm API for led classdev")
    Signed-off-by: Arnd Bergmann
    Acked-by: Felix Fietkau
    Signed-off-by: Kalle Valo
    Signed-off-by: Sasha Levin

    Arnd Bergmann
     
  • [ Upstream commit c16f39d14a7e0ec59881fbdb22ae494907534384 ]

    When CONFIG_MTD_UBI_FASTMAP is enabled, fm_anchor will be assigned
    a free PEB during ubi_wl_init() or ubi_update_fastmap(). However
    if fastmap is not used or disabled on the MTD device, ubi_wl_entry
    related with the PEB will not be freed during detach.

    So Fix it by freeing the unused fastmap anchor during detach.

    Fixes: f9c34bb52997 ("ubi: Fix producing anchor PEBs")
    Reported-by: syzbot+f317896aae32eb281a58@syzkaller.appspotmail.com
    Reviewed-by: Sascha Hauer
    Signed-off-by: Hou Tao
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Hou Tao
     
  • [ Upstream commit 983f127603fac650fa34ee69db363e4615eaf9e7 ]

    Current code will send PRLI with FC-NVMe bit set for the targets which
    support only FCP. This may result into issue with targets which do not
    understand NVMe and will go into a strange state. This patch would restart
    the login process by going back to PLOGI state. The PLOGI state will force
    the target to respond to correct PRLI request.

    Fixes: c76ae845ea836 ("scsi: qla2xxx: Add error handling for PLOGI ELS passthrough")
    Cc: stable@vger.kernel.org # 5.4
    Link: https://lore.kernel.org/r/20191105150657.8092-2-hmadhani@marvell.com
    Reviewed-by: Ewan D. Milne
    Signed-off-by: Quinn Tran
    Signed-off-by: Himanshu Madhani
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    Quinn Tran
     
  • [ Upstream commit 463538a383a27337cb83ae195e432a839a52d639 ]

    Commit 5aa98879efe7 ("s390/cpum_sf: prohibit callchain data collection")
    prohibits call graph sampling for hardware events on s390. The
    information recorded is out of context and does not match.

    On s390 this commit now breaks test case 68 Zstd perf.data
    compression/decompression.

    Therefore omit call graph sampling on s390 in this test.

    Output before:
    [root@t35lp46 perf]# ./perf test -Fv 68
    68: Zstd perf.data compression/decompression :
    --- start ---
    Collecting compressed record file:
    Error:
    cycles: PMU Hardware doesn't support sampling/overflow-interrupts.
    Try 'perf stat'
    ---- end ----
    Zstd perf.data compression/decompression: FAILED!
    [root@t35lp46 perf]#

    Output after:
    [root@t35lp46 perf]# ./perf test -Fv 68
    68: Zstd perf.data compression/decompression :
    --- start ---
    Collecting compressed record file:
    500+0 records in
    500+0 records out
    256000 bytes (256 kB, 250 KiB) copied, 0.00615638 s, 41.6 MB/s
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.004 MB /tmp/perf.data.X3M,
    compressed (original 0.002 MB, ratio is 3.609) ]
    Checking compressed events stats:
    # compressed : Zstd, level = 1, ratio = 4
    COMPRESSED events: 1
    2ELIFREPh---- end ----
    Zstd perf.data compression/decompression: Ok
    [root@t35lp46 perf]#

    Signed-off-by: Thomas Richter
    Reviewed-by: Sumanth Korikkar
    Cc: Heiko Carstens
    Cc: Sven Schnelle
    Cc: Vasily Gorbik
    Link: http://lore.kernel.org/lkml/20200729135314.91281-1-tmricht@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Thomas Richter
     
  • [ Upstream commit fa91e4aa1716004ea8096d5185ec0451e206aea0 ]

    [BUG]
    When running tests like generic/013 on test device with btrfs quota
    enabled, it can normally lead to data leak, detected at unmount time:

    BTRFS warning (device dm-3): qgroup 0/5 has unreleased space, type 0 rsv 4096
    ------------[ cut here ]------------
    WARNING: CPU: 11 PID: 16386 at fs/btrfs/disk-io.c:4142 close_ctree+0x1dc/0x323 [btrfs]
    RIP: 0010:close_ctree+0x1dc/0x323 [btrfs]
    Call Trace:
    btrfs_put_super+0x15/0x17 [btrfs]
    generic_shutdown_super+0x72/0x110
    kill_anon_super+0x18/0x30
    btrfs_kill_super+0x17/0x30 [btrfs]
    deactivate_locked_super+0x3b/0xa0
    deactivate_super+0x40/0x50
    cleanup_mnt+0x135/0x190
    __cleanup_mnt+0x12/0x20
    task_work_run+0x64/0xb0
    __prepare_exit_to_usermode+0x1bc/0x1c0
    __syscall_return_slowpath+0x47/0x230
    do_syscall_64+0x64/0xb0
    entry_SYSCALL_64_after_hwframe+0x44/0xa9
    ---[ end trace caf08beafeca2392 ]---
    BTRFS error (device dm-3): qgroup reserved space leaked

    [CAUSE]
    In the offending case, the offending operations are:
    2/6: writev f2X[269 1 0 0 0 0] [1006997,67,288] 0
    2/7: truncate f2X[269 1 0 0 48 1026293] 18388 0

    The following sequence of events could happen after the writev():
    CPU1 (writeback) | CPU2 (truncate)
    -----------------------------------------------------------------
    btrfs_writepages() |
    |- extent_write_cache_pages() |
    |- Got page for 1003520 |
    | 1003520 is Dirty, no writeback |
    | So (!clear_page_dirty_for_io()) |
    | gets called for it |
    |- Now page 1003520 is Clean. |
    | | btrfs_setattr()
    | | |- btrfs_setsize()
    | | |- truncate_setsize()
    | | New i_size is 18388
    |- __extent_writepage() |
    | |- page_offset() > i_size |
    |- btrfs_invalidatepage() |
    |- Page is clean, so no qgroup |
    callback executed

    This means, the qgroup reserved data space is not properly released in
    btrfs_invalidatepage() as the page is Clean.

    [FIX]
    Instead of checking the dirty bit of a page, call
    btrfs_qgroup_free_data() unconditionally in btrfs_invalidatepage().

    As qgroup rsv are completely bound to the QGROUP_RESERVED bit of
    io_tree, not bound to page status, thus we won't cause double freeing
    anyway.

    Fixes: 0b34c261e235 ("btrfs: qgroup: Prevent qgroup->reserved from going subzero")
    CC: stable@vger.kernel.org # 4.14+
    Reviewed-by: Josef Bacik
    Signed-off-by: Qu Wenruo
    Signed-off-by: David Sterba
    Signed-off-by: Sasha Levin

    Qu Wenruo
     
  • [ Upstream commit b872d0640840018669032b20b6375a478ed1f923 ]

    The vfio_pci_release call will free and clear the error and request
    eventfd ctx while these ctx could be in use at the same time in the
    function like vfio_pci_request, and it's expected to protect them under
    the vdev->igate mutex, which is missing in vfio_pci_release.

    This issue is introduced since commit 1518ac272e78 ("vfio/pci: fix memory
    leaks of eventfd ctx"),and since commit 5c5866c593bb ("vfio/pci: Clear
    error and request eventfd ctx after releasing"), it's very easily to
    trigger the kernel panic like this:

    [ 9513.904346] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008
    [ 9513.913091] Mem abort info:
    [ 9513.915871] ESR = 0x96000006
    [ 9513.918912] EC = 0x25: DABT (current EL), IL = 32 bits
    [ 9513.924198] SET = 0, FnV = 0
    [ 9513.927238] EA = 0, S1PTW = 0
    [ 9513.930364] Data abort info:
    [ 9513.933231] ISV = 0, ISS = 0x00000006
    [ 9513.937048] CM = 0, WnR = 0
    [ 9513.940003] user pgtable: 4k pages, 48-bit VAs, pgdp=0000007ec7d12000
    [ 9513.946414] [0000000000000008] pgd=0000007ec7d13003, p4d=0000007ec7d13003, pud=0000007ec728c003, pmd=0000000000000000
    [ 9513.956975] Internal error: Oops: 96000006 [#1] PREEMPT SMP
    [ 9513.962521] Modules linked in: vfio_pci vfio_virqfd vfio_iommu_type1 vfio hclge hns3 hnae3 [last unloaded: vfio_pci]
    [ 9513.972998] CPU: 4 PID: 1327 Comm: bash Tainted: G W 5.8.0-rc4+ #3
    [ 9513.980443] Hardware name: Huawei TaiShan 2280 V2/BC82AMDC, BIOS 2280-V2 CS V3.B270.01 05/08/2020
    [ 9513.989274] pstate: 80400089 (Nzcv daIf +PAN -UAO BTYPE=--)
    [ 9513.994827] pc : _raw_spin_lock_irqsave+0x48/0x88
    [ 9513.999515] lr : eventfd_signal+0x6c/0x1b0
    [ 9514.003591] sp : ffff800038a0b960
    [ 9514.006889] x29: ffff800038a0b960 x28: ffff007ef7f4da10
    [ 9514.012175] x27: ffff207eefbbfc80 x26: ffffbb7903457000
    [ 9514.017462] x25: ffffbb7912191000 x24: ffff007ef7f4d400
    [ 9514.022747] x23: ffff20be6e0e4c00 x22: 0000000000000008
    [ 9514.028033] x21: 0000000000000000 x20: 0000000000000000
    [ 9514.033321] x19: 0000000000000008 x18: 0000000000000000
    [ 9514.038606] x17: 0000000000000000 x16: ffffbb7910029328
    [ 9514.043893] x15: 0000000000000000 x14: 0000000000000001
    [ 9514.049179] x13: 0000000000000000 x12: 0000000000000002
    [ 9514.054466] x11: 0000000000000000 x10: 0000000000000a00
    [ 9514.059752] x9 : ffff800038a0b840 x8 : ffff007ef7f4de60
    [ 9514.065038] x7 : ffff007fffc96690 x6 : fffffe01faffb748
    [ 9514.070324] x5 : 0000000000000000 x4 : 0000000000000000
    [ 9514.075609] x3 : 0000000000000000 x2 : 0000000000000001
    [ 9514.080895] x1 : ffff007ef7f4d400 x0 : 0000000000000000
    [ 9514.086181] Call trace:
    [ 9514.088618] _raw_spin_lock_irqsave+0x48/0x88
    [ 9514.092954] eventfd_signal+0x6c/0x1b0
    [ 9514.096691] vfio_pci_request+0x84/0xd0 [vfio_pci]
    [ 9514.101464] vfio_del_group_dev+0x150/0x290 [vfio]
    [ 9514.106234] vfio_pci_remove+0x30/0x128 [vfio_pci]
    [ 9514.111007] pci_device_remove+0x48/0x108
    [ 9514.115001] device_release_driver_internal+0x100/0x1b8
    [ 9514.120200] device_release_driver+0x28/0x38
    [ 9514.124452] pci_stop_bus_device+0x68/0xa8
    [ 9514.128528] pci_stop_and_remove_bus_device+0x20/0x38
    [ 9514.133557] pci_iov_remove_virtfn+0xb4/0x128
    [ 9514.137893] sriov_disable+0x3c/0x108
    [ 9514.141538] pci_disable_sriov+0x28/0x38
    [ 9514.145445] hns3_pci_sriov_configure+0x48/0xb8 [hns3]
    [ 9514.150558] sriov_numvfs_store+0x110/0x198
    [ 9514.154724] dev_attr_store+0x44/0x60
    [ 9514.158373] sysfs_kf_write+0x5c/0x78
    [ 9514.162018] kernfs_fop_write+0x104/0x210
    [ 9514.166010] __vfs_write+0x48/0x90
    [ 9514.169395] vfs_write+0xbc/0x1c0
    [ 9514.172694] ksys_write+0x74/0x100
    [ 9514.176079] __arm64_sys_write+0x24/0x30
    [ 9514.179987] el0_svc_common.constprop.4+0x110/0x200
    [ 9514.184842] do_el0_svc+0x34/0x98
    [ 9514.188144] el0_svc+0x14/0x40
    [ 9514.191185] el0_sync_handler+0xb0/0x2d0
    [ 9514.195088] el0_sync+0x140/0x180
    [ 9514.198389] Code: b9001020 d2800000 52800022 f9800271 (885ffe61)
    [ 9514.204455] ---[ end trace 648de00c8406465f ]---
    [ 9514.212308] note: bash[1327] exited with preempt_count 1

    Cc: Qian Cai
    Cc: Alex Williamson
    Fixes: 1518ac272e78 ("vfio/pci: fix memory leaks of eventfd ctx")
    Signed-off-by: Zeng Tao
    Signed-off-by: Alex Williamson
    Signed-off-by: Sasha Levin

    Zeng Tao
     
  • [ Upstream commit a61fa2799ef9bf6c4f54cf7295036577cececc72 ]

    Clear the weird flags before logging to improve strace output --
    logging results while, say, TF is set does no one any favors.

    Signed-off-by: Andy Lutomirski
    Signed-off-by: Thomas Gleixner
    Link: https://lkml.kernel.org/r/907bfa5a42d4475b8245e18b67a04b13ca51ffdb.1593191971.git.luto@kernel.org
    Signed-off-by: Sasha Levin

    Andy Lutomirski
     
  • [ Upstream commit 823a65409c8990f64c5693af98ce0e7819975cba ]

    When an rport event (RPORT_EV_READY) is updated without work being queued,
    avoid taking an additional reference.

    This issue was leading to memory leak. Trace from KMEMLEAK tool:

    unreferenced object 0xffff8888259e8780 (size 512):
    comm "kworker/2:1", jiffies 4433237386 (age 113021.971s)
    hex dump (first 32 bytes):
    58 0a ec cf 83 88 ff ff 00 00 00 00 00 00 00 00
    01 00 00 00 08 00 00 00 13 7d f0 1e 0e 00 00 10
    backtrace:
    [] fc_rport_recv_req+0x3c6/0x18f0 [libfc]
    [] fc_lport_recv_els_req+0x120/0x8a0 [libfc]
    [] fc_lport_recv+0xb9/0x130 [libfc]
    [] fc_lport_recv+0xb9/0x130 [libfc]
    [] qedf_ll2_process_skb+0x73d/0xad0 [qedf]
    [] process_one_work+0x382/0x6c0
    [] worker_thread+0x57/0x5c0
    [] kthread+0x1a0/0x1c0
    [] ret_from_fork+0x35/0x40
    [] 0xffffffffffffffff

    Below is the log sequence which leads to memory leak. Here we get the
    RPORT_EV_READY and RPORT_EV_STOP back to back, which lead to overwrite the
    event RPORT_EV_READY by event RPORT_EV_STOP. Because of this, kref_count
    gets incremented by 1.

    kernel: host0: rport fffce5: Received PLOGI request
    kernel: host0: rport fffce5: Received PLOGI in INIT state
    kernel: host0: rport fffce5: Port is Ready
    kernel: host0: rport fffce5: Received PRLI request while in state Ready
    kernel: host0: rport fffce5: PRLI rspp type 8 active 1 passive 0
    kernel: host0: rport fffce5: Received LOGO request while in state Ready
    kernel: host0: rport fffce5: Delete port
    kernel: host0: rport fffce5: Received PLOGI request
    kernel: host0: rport fffce5: Received PLOGI in state Delete - send busy
    kernel: host0: rport fffce5: work event 3
    kernel: host0: rport fffce5: lld callback ev 3
    kernel: host0: rport fffce5: work delete

    Link: https://lore.kernel.org/r/20200626094959.32151-1-jhasan@marvell.com
    Reviewed-by: Girish Basrur
    Reviewed-by: Saurav Kashyap
    Reviewed-by: Shyam Sundar
    Signed-off-by: Javed Hasan
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    Javed Hasan
     
  • [ Upstream commit 71f2bf85e90d938d4a9ef9dd9bfa8d9b0b6a03f7 ]

    Handling of extra kref which is done by lookup table in case rdata is
    already present in list.

    This issue was leading to memory leak. Trace from KMEMLEAK tool:

    unreferenced object 0xffff8888259e8780 (size 512):
    comm "kworker/2:1", pid 182614, jiffies 4433237386 (age 113021.971s)
    hex dump (first 32 bytes):
    58 0a ec cf 83 88 ff ff 00 00 00 00 00 00 00 00
    01 00 00 00 08 00 00 00 13 7d f0 1e 0e 00 00 10
    backtrace:
    [] fc_rport_recv_req+0x3c6/0x18f0 [libfc]
    [] fc_lport_recv_els_req+0x120/0x8a0 [libfc]
    [] fc_lport_recv+0xb9/0x130 [libfc]
    [] qedf_ll2_process_skb+0x73d/0xad0 [qedf]
    [] process_one_work+0x382/0x6c0
    [] worker_thread+0x57/0x5c0
    [] kthread+0x1a0/0x1c0
    [] ret_from_fork+0x35/0x40
    [] 0xffffffffffffffff

    Below is the log sequence which leads to memory leak. Here we get the
    nested "Received PLOGI request" for same port and this request leads to
    call the fc_rport_create() twice for the same rport.

    kernel: host1: rport fffce5: Received PLOGI request
    kernel: host1: rport fffce5: Received PLOGI in INIT state
    kernel: host1: rport fffce5: Port is Ready
    kernel: host1: rport fffce5: Received PRLI request while in state Ready
    kernel: host1: rport fffce5: PRLI rspp type 8 active 1 passive 0
    kernel: host1: rport fffce5: Received LOGO request while in state Ready
    kernel: host1: rport fffce5: Delete port
    kernel: host1: rport fffce5: Received PLOGI request
    kernel: host1: rport fffce5: Received PLOGI in state Delete - send busy

    Link: https://lore.kernel.org/r/20200622101212.3922-2-jhasan@marvell.com
    Reviewed-by: Girish Basrur
    Reviewed-by: Saurav Kashyap
    Reviewed-by: Shyam Sundar
    Signed-off-by: Javed Hasan
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    Javed Hasan
     
  • [ Upstream commit 5af7fef39d7952c0f5551afa7b821ee7b6c9dd3d ]

    When using 802.1X over mesh networks, at first an ordinary
    mesh peering is established, then the 802.1X EAPOL dialog
    happens, afterwards an authenticated mesh peering exchange
    (AMPE) happens, finally the peering is complete and we can
    set the STA authorized flag.

    As 802.1X is an intermediate step here and key material is
    not yet exchanged for stations we have to skip mesh path lookup
    for these EAPOL frames. Otherwise the already configure mesh
    group encryption key would be used to send a mesh path request
    which no one can decipher, because we didn't already establish
    key material on both peers, like with SAE and directly using AMPE.

    Signed-off-by: Markus Theil
    Link: https://lore.kernel.org/r/20200617082637.22670-2-markus.theil@tu-ilmenau.de
    [remove pointless braces, remove unnecessary local variable,
    the list can only process one such frame (or its fragments)]
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin

    Markus Theil
     
  • [ Upstream commit 3b4b19721ec652ad2c4fe51dfbe5124212b5f581 ]

    Revert fab7772bfbcf ("nvme-multipath: revalidate nvme_ns_head gendisk
    in nvme_validate_ns")

    When adding a new namespace to the head disk (via nvme_mpath_set_live)
    we will see partition scan which triggers I/O on the mpath device node.
    This process will usually be triggered from the scan_work which holds
    the scan_lock. If I/O blocks (if we got ana change currently have only
    available paths but none are accessible) this can deadlock on the head
    disk bd_mutex as both partition scan I/O takes it, and head disk revalidation
    takes it to check for resize (also triggered from scan_work on a different
    path). See trace [1].

    The mpath disk revalidation was originally added to detect online disk
    size change, but this is no longer needed since commit cb224c3af4df
    ("nvme: Convert to use set_capacity_revalidate_and_notify") which already
    updates resize info without unnecessarily revalidating the disk (the
    mpath disk doesn't even implement .revalidate_disk fop).

    [1]:
    --
    kernel: INFO: task kworker/u65:9:494 blocked for more than 241 seconds.
    kernel: Tainted: G OE 5.3.5-050305-generic #201910071830
    kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    kernel: kworker/u65:9 D 0 494 2 0x80004000
    kernel: Workqueue: nvme-wq nvme_scan_work [nvme_core]
    kernel: Call Trace:
    kernel: __schedule+0x2b9/0x6c0
    kernel: schedule+0x42/0xb0
    kernel: schedule_preempt_disabled+0xe/0x10
    kernel: __mutex_lock.isra.0+0x182/0x4f0
    kernel: __mutex_lock_slowpath+0x13/0x20
    kernel: mutex_lock+0x2e/0x40
    kernel: revalidate_disk+0x63/0xa0
    kernel: __nvme_revalidate_disk+0xfe/0x110 [nvme_core]
    kernel: nvme_revalidate_disk+0xa4/0x160 [nvme_core]
    kernel: ? evict+0x14c/0x1b0
    kernel: revalidate_disk+0x2b/0xa0
    kernel: nvme_validate_ns+0x49/0x940 [nvme_core]
    kernel: ? blk_mq_free_request+0xd2/0x100
    kernel: ? __nvme_submit_sync_cmd+0xbe/0x1e0 [nvme_core]
    kernel: nvme_scan_work+0x24f/0x380 [nvme_core]
    kernel: process_one_work+0x1db/0x380
    kernel: worker_thread+0x249/0x400
    kernel: kthread+0x104/0x140
    kernel: ? process_one_work+0x380/0x380
    kernel: ? kthread_park+0x80/0x80
    kernel: ret_from_fork+0x1f/0x40
    ...
    kernel: INFO: task kworker/u65:1:2630 blocked for more than 241 seconds.
    kernel: Tainted: G OE 5.3.5-050305-generic #201910071830
    kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    kernel: kworker/u65:1 D 0 2630 2 0x80004000
    kernel: Workqueue: nvme-wq nvme_scan_work [nvme_core]
    kernel: Call Trace:
    kernel: __schedule+0x2b9/0x6c0
    kernel: schedule+0x42/0xb0
    kernel: io_schedule+0x16/0x40
    kernel: do_read_cache_page+0x438/0x830
    kernel: ? __switch_to_asm+0x34/0x70
    kernel: ? file_fdatawait_range+0x30/0x30
    kernel: read_cache_page+0x12/0x20
    kernel: read_dev_sector+0x27/0xc0
    kernel: read_lba+0xc1/0x220
    kernel: ? kmem_cache_alloc_trace+0x19c/0x230
    kernel: efi_partition+0x1e6/0x708
    kernel: ? vsnprintf+0x39e/0x4e0
    kernel: ? snprintf+0x49/0x60
    kernel: check_partition+0x154/0x244
    kernel: rescan_partitions+0xae/0x280
    kernel: __blkdev_get+0x40f/0x560
    kernel: blkdev_get+0x3d/0x140
    kernel: __device_add_disk+0x388/0x480
    kernel: device_add_disk+0x13/0x20
    kernel: nvme_mpath_set_live+0x119/0x140 [nvme_core]
    kernel: nvme_update_ns_ana_state+0x5c/0x60 [nvme_core]
    kernel: nvme_set_ns_ana_state+0x1e/0x30 [nvme_core]
    kernel: nvme_parse_ana_log+0xa1/0x180 [nvme_core]
    kernel: ? nvme_update_ns_ana_state+0x60/0x60 [nvme_core]
    kernel: nvme_mpath_add_disk+0x47/0x90 [nvme_core]
    kernel: nvme_validate_ns+0x396/0x940 [nvme_core]
    kernel: ? blk_mq_free_request+0xd2/0x100
    kernel: nvme_scan_work+0x24f/0x380 [nvme_core]
    kernel: process_one_work+0x1db/0x380
    kernel: worker_thread+0x249/0x400
    kernel: kthread+0x104/0x140
    kernel: ? process_one_work+0x380/0x380
    kernel: ? kthread_park+0x80/0x80
    kernel: ret_from_fork+0x1f/0x40
    --

    Fixes: fab7772bfbcf ("nvme-multipath: revalidate nvme_ns_head gendisk
    in nvme_validate_ns")
    Signed-off-by: Anton Eidelman
    Signed-off-by: Sagi Grimberg
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Sasha Levin

    Sagi Grimberg
     
  • [ Upstream commit 95a3d8f3af9b0d63b43f221b630beaab9739d13a ]

    When xfstests generic/451, there is an BUG at mm/memcontrol.c:
    page:ffffea000560f2c0 refcount:2 mapcount:0 mapping:000000008544e0ea
    index:0xf
    mapping->aops:cifs_addr_ops dentry name:"tst-aio-dio-cycle-write.451"
    flags: 0x2fffff80000001(locked)
    raw: 002fffff80000001 ffffc90002023c50 ffffea0005280088 ffff88815cda0210
    raw: 000000000000000f 0000000000000000 00000002ffffffff ffff88817287d000
    page dumped because: VM_BUG_ON_PAGE(page->mem_cgroup)
    page->mem_cgroup:ffff88817287d000
    ------------[ cut here ]------------
    kernel BUG at mm/memcontrol.c:2659!
    invalid opcode: 0000 [#1] SMP
    CPU: 2 PID: 2038 Comm: xfs_io Not tainted 5.8.0-rc1 #44
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_
    073836-buildvm-ppc64le-16.ppc.4
    RIP: 0010:commit_charge+0x35/0x50
    Code: 0d 48 83 05 54 b2 02 05 01 48 89 77 38 c3 48 c7
    c6 78 4a ea ba 48 83 05 38 b2 02 05 01 e8 63 0d9
    RSP: 0018:ffffc90002023a50 EFLAGS: 00010202
    RAX: 0000000000000000 RBX: ffff88817287d000 RCX: 0000000000000000
    RDX: 0000000000000000 RSI: ffff88817ac97ea0 RDI: ffff88817ac97ea0
    RBP: ffffea000560f2c0 R08: 0000000000000203 R09: 0000000000000005
    R10: 0000000000000030 R11: ffffc900020237a8 R12: 0000000000000000
    R13: 0000000000000001 R14: 0000000000000001 R15: ffff88815a1272c0
    FS: 00007f5071ab0800(0000) GS:ffff88817ac80000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 000055efcd5ca000 CR3: 000000015d312000 CR4: 00000000000006e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
    mem_cgroup_charge+0x166/0x4f0
    __add_to_page_cache_locked+0x4a9/0x710
    add_to_page_cache_locked+0x15/0x20
    cifs_readpages+0x217/0x1270
    read_pages+0x29a/0x670
    page_cache_readahead_unbounded+0x24f/0x390
    __do_page_cache_readahead+0x3f/0x60
    ondemand_readahead+0x1f1/0x470
    page_cache_async_readahead+0x14c/0x170
    generic_file_buffered_read+0x5df/0x1100
    generic_file_read_iter+0x10c/0x1d0
    cifs_strict_readv+0x139/0x170
    new_sync_read+0x164/0x250
    __vfs_read+0x39/0x60
    vfs_read+0xb5/0x1e0
    ksys_pread64+0x85/0xf0
    __x64_sys_pread64+0x22/0x30
    do_syscall_64+0x69/0x150
    entry_SYSCALL_64_after_hwframe+0x44/0xa9
    RIP: 0033:0x7f5071fcb1af
    Code: Bad RIP value.
    RSP: 002b:00007ffde2cdb8e0 EFLAGS: 00000293 ORIG_RAX: 0000000000000011
    RAX: ffffffffffffffda RBX: 00007ffde2cdb990 RCX: 00007f5071fcb1af
    RDX: 0000000000001000 RSI: 000055efcd5ca000 RDI: 0000000000000003
    RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000001000 R11: 0000000000000293 R12: 0000000000000001
    R13: 000000000009f000 R14: 0000000000000000 R15: 0000000000001000
    Modules linked in:
    ---[ end trace 725fa14a3e1af65c ]---

    Since commit 3fea5a499d57 ("mm: memcontrol: convert page cache to a new
    mem_cgroup_charge() API") not cancel the page charge, the pages maybe
    double add to pagecache:
    thread1 | thread2
    cifs_readpages
    readpages_get_pages
    add_to_page_cache_locked(head,index=n)=0
    | readpages_get_pages
    | add_to_page_cache_locked(head,index=n+1)=0
    add_to_page_cache_locked(head, index=n+1)=-EEXIST
    then, will next loop with list head page's
    index=n+1 and the page->mapping not NULL
    readpages_get_pages
    add_to_page_cache_locked(head, index=n+1)
    commit_charge
    VM_BUG_ON_PAGE

    So, we should not do the next loop when any page add to page cache
    failed.

    Reported-by: Hulk Robot
    Signed-off-by: Zhang Xiaoxu
    Signed-off-by: Steve French
    Acked-by: Ronnie Sahlberg
    Signed-off-by: Sasha Levin

    Zhang Xiaoxu
     
  • [ Upstream commit 5c5866c593bbd444d0339ede6a8fb5f14ff66d72 ]

    The next use of the device will generate an underflow from the
    stale reference.

    Cc: Qian Cai
    Fixes: 1518ac272e78 ("vfio/pci: fix memory leaks of eventfd ctx")
    Reported-by: Daniel Wagner
    Reviewed-by: Cornelia Huck
    Tested-by: Daniel Wagner
    Signed-off-by: Alex Williamson
    Signed-off-by: Sasha Levin

    Alex Williamson
     
  • [ Upstream commit 5be5945864ea143fda628e8179c8474457af1f43 ]

    When sunrpc trace points are not enabled, the recorded task ID
    information alone is not helpful.

    Signed-off-by: Chuck Lever
    Signed-off-by: Anna Schumaker
    Signed-off-by: Sasha Levin

    Chuck Lever
     
  • [ Upstream commit a7ef9ba986b5fae9d80f8a7b31db0423687efe4e ]

    Prevent the compiler from uninlining and creating traceable/probable
    functions as this is invoked _after_ context tracking switched to
    CONTEXT_USER and rcu idle.

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Alexandre Chartre
    Acked-by: Peter Zijlstra
    Link: https://lkml.kernel.org/r/20200505134340.902709267@linutronix.de
    Signed-off-by: Sasha Levin

    Thomas Gleixner
     
  • [ Upstream commit eb13fa0227417e84aecc3bd9c029d376e33474d3 ]

    Looks like some drivers define MTD names with a colon in it, thus
    making mtdpart= parsing impossible. Let's fix the parser to gracefully
    handle that case: the last ':' in a partition definition sequence is
    considered instead of the first one.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Ron Minnich
    Tested-by: Ron Minnich
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Boris Brezillon
     
  • [ Upstream commit e1c3cdb26ab881b77486dc50370356a349077c74 ]

    Fields of md(mport_dev) are set after cdev_device_add(). However, the
    file operation callbacks can be called after cdev_device_add() and
    therefore accesses to fields of md in the callbacks can race with the rest
    of the mport_cdev_add() function.

    One such example is INIT_LIST_HEAD(&md->portwrites) in mport_cdev_add(),
    the list is initialised after cdev_device_add(). This can race with
    list_add_tail(&pw_filter->md_node,&md->portwrites) in
    rio_mport_add_pw_filter() which is called by unlocked_ioctl.

    To avoid such data races use cdev_device_add() after initializing md.

    Found by Linux Driver Verification project (linuxtesting.org).

    Signed-off-by: Madhuparna Bhowmik
    Signed-off-by: Andrew Morton
    Acked-by: Alexandre Bounine
    Cc: Matt Porter
    Cc: Dan Carpenter
    Cc: Mike Marshall
    Cc: Thomas Gleixner
    Cc: Ira Weiny
    Cc: Allison Randal
    Cc: Pavel Andrianov
    Link: http://lkml.kernel.org/r/20200426112950.1803-1-madhuparnabhowmik10@gmail.com
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Madhuparna Bhowmik
     
  • [ Upstream commit abb242f57196dbaa108271575353a0453f6834ef ]

    The move_lock is a per-memcg lock, but the VM accounting code that needs
    to acquire it comes from the page and follows page->mem_cgroup under RCU
    protection. That means that the page becomes unlocked not when we drop
    the move_lock, but when we update page->mem_cgroup. And that assignment
    doesn't imply any memory ordering. If that pointer write gets reordered
    against the reads of the page state - page_mapped, PageDirty etc. the
    state may change while we rely on it being stable and we can end up
    corrupting the counters.

    Place an SMP memory barrier to make sure we're done with all page state by
    the time the new page->mem_cgroup becomes visible.

    Also replace the open-coded move_lock with a lock_page_memcg() to make it
    more obvious what we're serializing against.

    Signed-off-by: Johannes Weiner
    Signed-off-by: Andrew Morton
    Reviewed-by: Joonsoo Kim
    Reviewed-by: Shakeel Butt
    Cc: Alex Shi
    Cc: Hugh Dickins
    Cc: "Kirill A. Shutemov"
    Cc: Michal Hocko
    Cc: Roman Gushchin
    Cc: Balbir Singh
    Link: http://lkml.kernel.org/r/20200508183105.225460-3-hannes@cmpxchg.org
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Johannes Weiner
     
  • [ Upstream commit d6c1f098f2a7ba62627c9bc17cda28f534ef9e4a ]

    "prev_offset" is a static variable in swapin_nr_pages() that can be
    accessed concurrently with only mmap_sem held in read mode as noticed by
    KCSAN,

    BUG: KCSAN: data-race in swap_cluster_readahead / swap_cluster_readahead

    write to 0xffffffff92763830 of 8 bytes by task 14795 on cpu 17:
    swap_cluster_readahead+0x2a6/0x5e0
    swapin_readahead+0x92/0x8dc
    do_swap_page+0x49b/0xf20
    __handle_mm_fault+0xcfb/0xd70
    handle_mm_fault+0xfc/0x2f0
    do_page_fault+0x263/0x715
    page_fault+0x34/0x40

    1 lock held by (dnf)/14795:
    #0: ffff897bd2e98858 (&mm->mmap_sem#2){++++}-{3:3}, at: do_page_fault+0x143/0x715
    do_user_addr_fault at arch/x86/mm/fault.c:1405
    (inlined by) do_page_fault at arch/x86/mm/fault.c:1535
    irq event stamp: 83493
    count_memcg_event_mm+0x1a6/0x270
    count_memcg_event_mm+0x119/0x270
    __do_softirq+0x365/0x589
    irq_exit+0xa2/0xc0

    read to 0xffffffff92763830 of 8 bytes by task 1 on cpu 22:
    swap_cluster_readahead+0xfd/0x5e0
    swapin_readahead+0x92/0x8dc
    do_swap_page+0x49b/0xf20
    __handle_mm_fault+0xcfb/0xd70
    handle_mm_fault+0xfc/0x2f0
    do_page_fault+0x263/0x715
    page_fault+0x34/0x40

    1 lock held by systemd/1:
    #0: ffff897c38f14858 (&mm->mmap_sem#2){++++}-{3:3}, at: do_page_fault+0x143/0x715
    irq event stamp: 43530289
    count_memcg_event_mm+0x1a6/0x270
    count_memcg_event_mm+0x119/0x270
    __do_softirq+0x365/0x589
    irq_exit+0xa2/0xc0

    Signed-off-by: Qian Cai
    Signed-off-by: Andrew Morton
    Cc: Marco Elver
    Cc: Hugh Dickins
    Link: http://lkml.kernel.org/r/20200402213748.2237-1-cai@lca.pw
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Qian Cai
     
  • [ Upstream commit dc3da0461cc4b76f2d0c5b12247fcb3b520edbbf ]

    Nothing ensures that session will still be valid by the time we
    dereference the pointer. Take and put a reference.

    In principle, we should always be able to get a reference here, but
    throw a warning if that's ever not the case.

    Signed-off-by: Jeff Layton
    Signed-off-by: Ilya Dryomov
    Signed-off-by: Sasha Levin

    Jeff Layton
     
  • [ Upstream commit fcee90cdf6f3a3a371add04d41528d5ba9c3b411 ]

    pm_runtime_get_sync() increments the runtime PM usage counter even
    when it returns an error code. Thus a pairing decrement is needed on
    the error handling path to keep the counter balanced.

    Also, call pm_runtime_disable() when pm_runtime_get_sync() returns
    an error code.

    Link: https://lore.kernel.org/r/20200521024709.2368-1-dinghao.liu@zju.edu.cn
    Signed-off-by: Dinghao Liu
    Signed-off-by: Lorenzo Pieralisi
    Acked-by: Thierry Reding
    Signed-off-by: Sasha Levin

    Dinghao Liu
     
  • [ Upstream commit 37f7212148cf1d796135cdf8d0c7fee13067674b ]

    pm_runtime_get_sync() increments the runtime PM usage counter even
    when it returns an error code. Thus a pairing decrement is needed on
    the error handling path to keep the counter balanced.

    Signed-off-by: Dinghao Liu
    Signed-off-by: Miquel Raynal
    Link: https://lore.kernel.org/linux-mtd/20200522104008.28340-1-dinghao.liu@zju.edu.cn
    Signed-off-by: Sasha Levin

    Dinghao Liu
     
  • [ Upstream commit 550e68ea36a6671a96576c0531685ce6e6c0d19d ]

    pm_runtime_get_sync() increments the runtime PM usage counter even
    when it returns an error code. Thus a pairing decrement is needed on
    the error handling path to keep the counter balanced.

    Signed-off-by: Dinghao Liu
    Signed-off-by: Miquel Raynal
    Link: https://lore.kernel.org/linux-mtd/20200522095139.19653-1-dinghao.liu@zju.edu.cn
    Signed-off-by: Sasha Levin

    Dinghao Liu
     
  • [ Upstream commit 282a04bf1d8029eb98585cb5db3fd70fe8bc91f7 ]

    pm_runtime_get_sync() increments the runtime PM usage counter even
    the call returns an error code. Thus a pairing decrement is needed
    on the error handling path to keep the counter balanced.

    Signed-off-by: Dinghao Liu
    Acked-by: Tony Lindgren
    Signed-off-by: Kalle Valo
    Link: https://lore.kernel.org/r/20200520124649.10848-1-dinghao.liu@zju.edu.cn
    Signed-off-by: Sasha Levin

    Dinghao Liu
     
  • [ Upstream commit 9604617e998b49f7695fea1479ed82421ef8c9f0 ]

    There are two error handling paths in this functon. When
    wlcore_tx_work_locked() returns an error code, we should
    decrease the runtime PM usage counter the same way as the
    error handling path beginning from pm_runtime_get_sync().

    Signed-off-by: Dinghao Liu
    Acked-by: Tony Lindgren
    Signed-off-by: Kalle Valo
    Link: https://lore.kernel.org/r/20200520124241.9931-1-dinghao.liu@zju.edu.cn
    Signed-off-by: Sasha Levin

    Dinghao Liu
     
  • [ Upstream commit 65bd91dd6957390c42a0491b9622cf31a2cdb140 ]

    pm_runtime_get_sync() increments the runtime PM usage counter even
    the call returns an error code. Thus a pairing decrement is needed
    on the error handling path to keep the counter balanced.

    Signed-off-by: Dinghao Liu
    Link: https://lore.kernel.org/r/20200529012230.5863-1-dinghao.liu@zju.edu.cn
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Dinghao Liu
     
  • [ Upstream commit 1c1dbb2c02623db18a50c61b175f19aead800b4e ]

    pm_runtime_get_sync() increments the runtime PM usage counter even
    when it returns an error code. Thus a pairing decrement is needed on
    the error handling path to keep the counter balanced.

    Link: https://lore.kernel.org/r/20200521031355.7022-1-dinghao.liu@zju.edu.cn
    Signed-off-by: Dinghao Liu
    Signed-off-by: Lorenzo Pieralisi
    Acked-by: Thierry Reding
    Acked-by: Vidya Sagar
    Signed-off-by: Sasha Levin

    Dinghao Liu
     
  • [ Upstream commit 61f82e3fb697a8e85f22fdec786528af73dc36d1 ]

    In the absence of any modules, no "modules" map is created, but there
    are other executable pages to map, due to eBPF JIT, kprobe or ftrace.
    Map them by recognizing that the first "module" symbol is not
    necessarily from a module, and adjust the map accordingly.

    Signed-off-by: Adrian Hunter
    Cc: Alexander Shishkin
    Cc: Borislav Petkov
    Cc: H. Peter Anvin
    Cc: Jiri Olsa
    Cc: Leo Yan
    Cc: Mark Rutland
    Cc: Masami Hiramatsu
    Cc: Mathieu Poirier
    Cc: Peter Zijlstra
    Cc: Steven Rostedt (VMware)
    Cc: x86@kernel.org
    Link: http://lore.kernel.org/lkml/20200512121922.8997-10-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Adrian Hunter
     
  • [ Upstream commit a159e2fe89b4d1f9fb54b0ae418b961e239bf617 ]

    Avoid a simple memory leak.

    Signed-off-by: Ian Rogers
    Cc: Alexander Shishkin
    Cc: Alexei Starovoitov
    Cc: Andi Kleen
    Cc: Andrii Nakryiko
    Cc: Cong Wang
    Cc: Daniel Borkmann
    Cc: Jin Yao
    Cc: Jiri Olsa
    Cc: John Fastabend
    Cc: John Garry
    Cc: Kajol Jain
    Cc: Kan Liang
    Cc: Kim Phillips
    Cc: Mark Rutland
    Cc: Martin KaFai Lau
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Song Liu
    Cc: Stephane Eranian
    Cc: Vince Weaver
    Cc: Yonghong Song
    Cc: bpf@vger.kernel.org
    Cc: kp singh
    Cc: netdev@vger.kernel.org
    Link: http://lore.kernel.org/lkml/20200508053629.210324-10-irogers@google.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Ian Rogers