Skip to content
  1. Apr 14, 2021
    • Leon Romanovsky's avatar
      RDMA/addr: Be strict with gid size · 5700c3d4
      Leon Romanovsky authored
      [ Upstream commit d1c803a9 ]
      
      The nla_len() is less than or equal to 16.  If it's less than 16 then end
      of the "gid" buffer is uninitialized.
      
      Fixes: ae43f828
      
       ("IB/core: Add IP to GID netlink offload")
      Link: https://lore.kernel.org/r/20210405074434.264221-1-leon@kernel.org
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarMark Bloch <mbloch@nvidia.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5700c3d4
    • Grzegorz Siwik's avatar
      i40e: Fix parameters in aq_get_phy_register() · e53ff6e5
      Grzegorz Siwik authored
      [ Upstream commit b2d0efc4 ]
      
      Change parameters order in aq_get_phy_register() due to wrong
      statistics in PHY reported by ethtool. Previously all PHY statistics were
      exactly the same for all interfaces
      Now statistics are reported correctly - different for different interfaces
      
      Fixes: 0514db37
      
       ("i40e: Extend PHY access with page change flag")
      Signed-off-by: default avatarGrzegorz Siwik <grzegorz.siwik@intel.com>
      Tested-by: default avatarDave Switzer <david.switzer@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e53ff6e5
    • Dom Cobley's avatar
      drm/vc4: crtc: Reduce PV fifo threshold on hvs4 · 99985220
      Dom Cobley authored
      [ Upstream commit eb9dfdd1 ]
      
      Experimentally have found PV on hvs4 reports fifo full
      error with expected settings and does not with one less
      
      This appears as:
      [drm:drm_atomic_helper_wait_for_flip_done] *ERROR* [CRTC:82:crtc-3] flip_done timed out
      
      with bit 10 of PV_STAT set "HVS driving pixels when the PV FIFO is full"
      
      Fixes: c8b75bca
      
       ("drm/vc4: Add KMS support for Raspberry Pi.")
      Signed-off-by: default avatarDom Cobley <popcornmix@gmail.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210318161328.1471556-3-maxime@cerno.tech
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      99985220
    • Kamal Heib's avatar
      RDMA/qedr: Fix kernel panic when trying to access recv_cq · d8a0861e
      Kamal Heib authored
      [ Upstream commit e1ad897b ]
      
      As INI QP does not require a recv_cq, avoid the following null pointer
      dereference by checking if the qp_type is not INI before trying to extract
      the recv_cq.
      
      BUG: kernel NULL pointer dereference, address: 00000000000000e0
       #PF: supervisor read access in kernel mode
       #PF: error_code(0x0000) - not-present page
       PGD 0 P4D 0
       Oops: 0000 [#1] SMP PTI
       CPU: 0 PID: 54250 Comm: mpitests-IMB-MP Not tainted 5.12.0-rc5 #1
       Hardware name: Dell Inc. PowerEdge R320/0KM5PX, BIOS 2.7.0 08/19/2019
       RIP: 0010:qedr_create_qp+0x378/0x820 [qedr]
       Code: 02 00 00 50 e8 29 d4 a9 d1 48 83 c4 18 e9 65 fe ff ff 48 8b 53 10 48 8b 43 18 44 8b 82 e0 00 00 00 45 85 c0 0f 84 10 74 00 00 <8b> b8 e0 00 00 00 85 ff 0f 85 50 fd ff ff e9 fd 73 00 00 48 8d bd
       RSP: 0018:ffff9c8f056f7a70 EFLAGS: 00010202
       RAX: 0000000000000000 RBX: ffff9c8f056f7b58 RCX: 0000000000000009
       RDX: ffff8c41a9744c00 RSI: ffff9c8f056f7b58 RDI: ffff8c41c0dfa280
       RBP: ffff8c41c0dfa280 R08: 0000000000000002 R09: 0000000000000001
       R10: 0000000000000000 R11: ffff8c41e06fc608 R12: ffff8c4194052000
       R13: 0000000000000000 R14: ffff8c4191546070 R15: ffff8c41c0dfa280
       FS:  00007f78b2787b80(0000) GS:ffff8c43a3200000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 00000000000000e0 CR3: 00000001011d6002 CR4: 00000000001706f0
       Call Trace:
        ib_uverbs_handler_UVERBS_METHOD_QP_CREATE+0x4e4/0xb90 [ib_uverbs]
        ? ib_uverbs_cq_event_handler+0x30/0x30 [ib_uverbs]
        ib_uverbs_run_method+0x6f6/0x7a0 [ib_uverbs]
        ? ib_uverbs_handler_UVERBS_METHOD_QP_DESTROY+0x70/0x70 [ib_uverbs]
        ? __cond_resched+0x15/0x30
        ? __kmalloc+0x5a/0x440
        ib_uverbs_cmd_verbs+0x195/0x360 [ib_uverbs]
        ? xa_load+0x6e/0x90
        ? cred_has_capability+0x7c/0x130
        ? avc_has_extended_perms+0x17f/0x440
        ? vma_link+0xae/0xb0
        ? vma_set_page_prot+0x2a/0x60
        ? mmap_region+0x298/0x6c0
        ? do_mmap+0x373/0x520
        ? selinux_file_ioctl+0x17f/0x220
        ib_uverbs_ioctl+0xa7/0x110 [ib_uverbs]
        __x64_sys_ioctl+0x84/0xc0
        do_syscall_64+0x33/0x40
        entry_SYSCALL_64_after_hwframe+0x44/0xae
       RIP: 0033:0x7f78b120262b
      
      Fixes: 06e8d1df
      
       ("RDMA/qedr: Add support for user mode XRC-SRQ's")
      Link: https://lore.kernel.org/r/20210404125501.154789-1-kamalheib1@gmail.com
      Signed-off-by: default avatarKamal Heib <kamalheib1@gmail.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d8a0861e
    • Jin Yao's avatar
      perf report: Fix wrong LBR block sorting · 3fa7ae3f
      Jin Yao authored
      [ Upstream commit f2013278 ]
      
      When '--total-cycles' is specified, it supports sorting for all blocks
      by 'Sampled Cycles%'. This is useful to concentrate on the globally
      hottest blocks.
      
      'Sampled Cycles%' - block sampled cycles aggregation / total sampled cycles
      
      But in current code, it doesn't use the cycles aggregation. Part of
      'cycles' counting is possibly dropped for some overlap jumps. But for
      identifying the hot block, we always need the full cycles.
      
        # perf record -b ./triad_loop
        # perf report --total-cycles --stdio
      
      Before:
      
        #
        # Sampled Cycles%  Sampled Cycles  Avg Cycles%  Avg Cycles                                          [Program Block Range]      Shared Object
        # ...............  ..............  ...........  ..........  .............................................................  .................
        #
                    0.81%             793        4.32%         793                           [setup-vdso.h:34 -> setup-vdso.h:40]         ld-2.27.so
                    0.49%             480        0.87%         160                    [native_write_msr+0 -> native_write_msr+16]  [kernel.kallsyms]
                    0.48%             476        0.52%          95                      [native_read_msr+0 -> native_read_msr+29]  [kernel.kallsyms]
                    0.31%             303        1.65%         303                              [nmi_restore+0 -> nmi_restore+37]  [kernel.kallsyms]
                    0.26%             255        1.39%         255      [nohz_balance_exit_idle+75 -> nohz_balance_exit_idle+162]  [kernel.kallsyms]
                    0.24%             234        1.28%         234                       [end_repeat_nmi+67 -> end_repeat_nmi+83]  [kernel.kallsyms]
                    0.23%             227        1.24%         227            [__irqentry_text_end+96 -> __irqentry_text_end+126]  [kernel.kallsyms]
                    0.20%             194        1.06%         194             [native_set_debugreg+52 -> native_set_debugreg+56]  [kernel.kallsyms]
                    0.11%             106        0.14%          26                [native_sched_clock+0 -> native_sched_clock+98]  [kernel.kallsyms]
                    0.10%              97        0.53%          97            [trigger_load_balance+0 -> trigger_load_balance+67]  [kernel.kallsyms]
                    0.09%              85        0.46%          85             [get-dynamic-info.h:102 -> get-dynamic-info.h:111]         ld-2.27.so
        ...
                    0.00%           92.7K        0.02%           4                           [triad_loop.c:64 -> triad_loop.c:65]         triad_loop
      
      The hottest block '[triad_loop.c:64 -> triad_loop.c:65]' is not at
      the top of output.
      
      After:
      
        # Sampled Cycles%  Sampled Cycles  Avg Cycles%  Avg Cycles                                           [Program Block Range]      Shared Object
        # ...............  ..............  ...........  ..........  ..............................................................  .................
        #
                   94.35%           92.7K        0.02%           4                            [triad_loop.c:64 -> triad_loop.c:65]         triad_loop
                    0.81%             793        4.32%         793                            [setup-vdso.h:34 -> setup-vdso.h:40]         ld-2.27.so
                    0.49%             480        0.87%         160                     [native_write_msr+0 -> native_write_msr+16]  [kernel.kallsyms]
                    0.48%             476        0.52%          95                       [native_read_msr+0 -> native_read_msr+29]  [kernel.kallsyms]
                    0.31%             303        1.65%         303                               [nmi_restore+0 -> nmi_restore+37]  [kernel.kallsyms]
                    0.26%             255        1.39%         255       [nohz_balance_exit_idle+75 -> nohz_balance_exit_idle+162]  [kernel.kallsyms]
                    0.24%             234        1.28%         234                        [end_repeat_nmi+67 -> end_repeat_nmi+83]  [kernel.kallsyms]
                    0.23%             227        1.24%         227             [__irqentry_text_end+96 -> __irqentry_text_end+126]  [kernel.kallsyms]
                    0.20%             194        1.06%         194              [native_set_debugreg+52 -> native_set_debugreg+56]  [kernel.kallsyms]
                    0.11%             106        0.14%          26                 [native_sched_clock+0 -> native_sched_clock+98]  [kernel.kallsyms]
                    0.10%              97        0.53%          97             [trigger_load_balance+0 -> trigger_load_balance+67]  [kernel.kallsyms]
                    0.09%              85        0.46%          85              [get-dynamic-info.h:102 -> get-dynamic-info.h:111]         ld-2.27.so
                    0.08%              82        0.06%          11  [intel_pmu_drain_pebs_nhm+580 -> intel_pmu_drain_pebs_nhm+627]  [kernel.kallsyms]
                    0.08%              77        0.42%          77                  [lru_add_drain_cpu+0 -> lru_add_drain_cpu+133]  [kernel.kallsyms]
                    0.08%              74        0.10%          18                [handle_pmi_common+271 -> handle_pmi_common+310]  [kernel.kallsyms]
                    0.08%              74        0.40%          74              [get-dynamic-info.h:131 -> get-dynamic-info.h:157]         ld-2.27.so
                    0.07%              69        0.09%          17  [intel_pmu_drain_pebs_nhm+432 -> intel_pmu_drain_pebs_nhm+468]  [kernel.kallsyms]
      
      Now the hottest block is reported at the top of output.
      
      Fixes: b65a7d37
      
       ("perf hist: Support block formats with compare/sort/display")
      Signed-off-by: default avatarJin Yao <yao.jin@linux.intel.com>
      Reviewed-by: default avatarAndi Kleen <ak@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jin Yao <yao.jin@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20210407024452.29988-1-yao.jin@linux.intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3fa7ae3f
    • Potnuri Bharat Teja's avatar
      RDMA/cxgb4: check for ipv6 address properly while destroying listener · 7f40e933
      Potnuri Bharat Teja authored
      [ Upstream commit 603c4690 ]
      
      ipv6 bit is wrongly set by the below which causes fatal adapter lookup
      engine errors for ipv4 connections while destroying a listener.  Fix it to
      properly check the local address for ipv6.
      
      Fixes: 3408be14
      
       ("RDMA/cxgb4: Fix adapter LE hash errors while destroying ipv6 listening server")
      Link: https://lore.kernel.org/r/20210331135715.30072-1-bharat@chelsio.com
      Signed-off-by: default avatarPotnuri Bharat Teja <bharat@chelsio.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7f40e933
    • Aya Levin's avatar
      net/mlx5: Fix PBMC register mapping · 03ad6a25
      Aya Levin authored
      [ Upstream commit 534b1204 ]
      
      Add reserved mapping to cover all the register in order to avoid setting
      arbitrary values to newer FW which implements the reserved fields.
      
      Fixes: 50b4a3c2
      
       ("net/mlx5: PPTB and PBMC register firmware command support")
      Signed-off-by: default avatarAya Levin <ayal@nvidia.com>
      Reviewed-by: default avatarMoshe Shemesh <moshe@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      03ad6a25
    • Aya Levin's avatar
      net/mlx5: Fix PPLM register mapping · 1312f11e
      Aya Levin authored
      [ Upstream commit ce28f0fd ]
      
      Add reserved mapping to cover all the register in order to avoid
      setting arbitrary values to newer FW which implements the reserved
      fields.
      
      Fixes: a58837f5
      
       ("net/mlx5e: Expose FEC feilds and related capability bit")
      Signed-off-by: default avatarAya Levin <ayal@nvidia.com>
      Reviewed-by: default avatarMoshe Shemesh <moshe@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1312f11e
    • Raed Salem's avatar
      net/mlx5: Fix placement of log_max_flow_counter · f92faf0b
      Raed Salem authored
      [ Upstream commit a14587df ]
      
      The cited commit wrongly placed log_max_flow_counter field of
      mlx5_ifc_flow_table_prop_layout_bits, align it to the HW spec intended
      placement.
      
      Fixes: 16f1c5bb
      
       ("net/mlx5: Check device capability for maximum flow counters")
      Signed-off-by: default avatarRaed Salem <raeds@nvidia.com>
      Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f92faf0b
    • Guangbin Huang's avatar
      net: hns3: clear VF down state bit before request link status · f780a080
      Guangbin Huang authored
      [ Upstream commit ed7bedd2 ]
      
      Currently, the VF down state bit is cleared after VF sending
      link status request command. There is problem that when VF gets
      link status replied from PF, the down state bit may still set
      as 1. In this case, the link status replied from PF will be
      ignored and always set VF link status to down.
      
      To fix this problem, clear VF down state bit before VF requests
      link status.
      
      Fixes: e2cb1dec
      
       ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support")
      Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f780a080
    • Xin Long's avatar
      tipc: increment the tmp aead refcnt before attaching it · f473789d
      Xin Long authored
      [ Upstream commit 2a2403ca ]
      
      Li Shuang found a NULL pointer dereference crash in her testing:
      
        [] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
        [] RIP: 0010:tipc_crypto_rcv_complete+0xc8/0x7e0 [tipc]
        [] Call Trace:
        []  <IRQ>
        []  tipc_crypto_rcv+0x2d9/0x8f0 [tipc]
        []  tipc_rcv+0x2fc/0x1120 [tipc]
        []  tipc_udp_recv+0xc6/0x1e0 [tipc]
        []  udpv6_queue_rcv_one_skb+0x16a/0x460
        []  udp6_unicast_rcv_skb.isra.35+0x41/0xa0
        []  ip6_protocol_deliver_rcu+0x23b/0x4c0
        []  ip6_input+0x3d/0xb0
        []  ipv6_rcv+0x395/0x510
        []  __netif_receive_skb_core+0x5fc/0xc40
      
      This is caused by NULL returned by tipc_aead_get(), and then crashed when
      dereferencing it later in tipc_crypto_rcv_complete(). This might happen
      when tipc_crypto_rcv_complete() is called by two threads at the same time:
      the tmp attached by tipc_crypto_key_attach() in one thread may be released
      by the one attached by that in the other thread.
      
      This patch is to fix it by incrementing the tmp's refcnt before attaching
      it instead of calling tipc_aead_get() after attaching it.
      
      Fixes: fc1b6d6d
      
       ("tipc: introduce TIPC encryption & authentication")
      Reported-by: default avatarLi Shuang <shuali@redhat.com>
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f473789d
    • Marc Kleine-Budde's avatar
      can: mcp251x: fix support for half duplex SPI host controllers · 3292c4fc
      Marc Kleine-Budde authored
      [ Upstream commit 617085fc ]
      
      Some SPI host controllers do not support full-duplex SPI transfers.
      
      The function mcp251x_spi_trans() does a full duplex transfer. It is
      used in several places in the driver, where a TX half duplex transfer
      is sufficient.
      
      To fix support for half duplex SPI host controllers, this patch
      introduces a new function mcp251x_spi_write() and changes all callers
      that do a TX half duplex transfer to use mcp251x_spi_write().
      
      Fixes: e0e25001
      
       ("can: mcp251x: add support for half duplex controllers")
      Link: https://lore.kernel.org/r/20210330100246.1074375-1-mkl@pengutronix.de
      Cc: Tim Harvey <tharvey@gateworks.com>
      Tested-By: default avatarTim Harvey <tharvey@gateworks.com>
      Reported-by: default avatarGerhard Bertelsmann <info@gerhard-bertelsmann.de>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3292c4fc
    • Luca Coelho's avatar
      iwlwifi: fix 11ax disabled bit in the regulatory capability flags · a96f1ed7
      Luca Coelho authored
      [ Upstream commit 07cc40fe
      
       ]
      
      When version 2 of the regulatory capability flags API was implemented,
      the flag to disable 11ax was defined as bit 13, but this was later
      changed and the bit remained as bit 10, like in version 1.  This was
      never changed in the driver, so we were checking for the wrong bit in
      newer devices.  Fix it.
      
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Fixes: e27c506a
      
       ("iwlwifi: regulatory: regulatory capabilities api change")
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210326125611.6d28516b59cd.Id0248d5e4662695254f49ce37b0268834ed52918@changeid
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a96f1ed7
    • Andy Shevchenko's avatar
      i2c: designware: Adjust bus_freq_hz when refuse high speed mode set · 363d610a
      Andy Shevchenko authored
      [ Upstream commit 5e729bc5 ]
      
      When hardware doesn't support High Speed Mode, we forget bus_freq_hz
      timing adjustment. This makes the timings and real registers being
      unsynchronized. Adjust bus_freq_hz when refuse high speed mode set.
      
      Fixes: b6e67145
      
       ("i2c: designware: Enable high speed mode")
      Reported-by: default avatar"Song Bao Hua (Barry Song)" <song.bao.hua@hisilicon.com>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: default avatarBarry Song <song.bao.hua@hisilicon.com>
      Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      363d610a
    • Ilya Maximets's avatar
      openvswitch: fix send of uninitialized stack memory in ct limit reply · cc541897
      Ilya Maximets authored
      [ Upstream commit 4d51419d ]
      
      'struct ovs_zone_limit' has more members than initialized in
      ovs_ct_limit_get_default_limit().  The rest of the memory is a random
      kernel stack content that ends up being sent to userspace.
      
      Fix that by using designated initializer that will clear all
      non-specified fields.
      
      Fixes: 11efd5cb
      
       ("openvswitch: Support conntrack zone limit")
      Signed-off-by: default avatarIlya Maximets <i.maximets@ovn.org>
      Acked-by: default avatarTonghao Zhang <xiangxia.m.yue@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cc541897
    • Zheng Yongjun's avatar
      3e288c3a
    • Adrian Hunter's avatar
      perf inject: Fix repipe usage · 3b70c6f2
      Adrian Hunter authored
      [ Upstream commit 026334a3 ]
      
      Since commit 14d3d540 ("perf session: Try to read pipe data from
      file") 'perf inject' has started printing "PERFILE2h" when not processing
      pipes.
      
      The commit exposed perf to the possiblity that the input is not a pipe
      but the 'repipe' parameter gets used. That causes the printing because
      perf inject sets 'repipe' to true always.
      
      The 'repipe' parameter of perf_session__new() is used by 2 functions:
      
      	- perf_file_header__read_pipe()
      	- trace_report()
      
      In both cases, the functions copy data to STDOUT_FILENO when 'repipe' is
      true.
      
      Fix by setting 'repipe' to true only if the output is a pipe.
      
      Fixes: e558a5bd
      
       ("perf inject: Work with files")
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Andrew Vagin <avagin@openvz.org>
      Link: http://lore.kernel.org/lkml/20210401103605.9000-1-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3b70c6f2
    • Alexander Gordeev's avatar
      s390/cpcmd: fix inline assembly register clobbering · d9dc1b40
      Alexander Gordeev authored
      [ Upstream commit 7a2f9144 ]
      
      Register variables initialized using arithmetic. That leads to
      kasan instrumentaton code corrupting the registers contents.
      Follow GCC guidlines and use temporary variables for assigning
      init values to register variables.
      
      Fixes: 94c12cc7
      
       ("[S390] Inline assembly cleanup.")
      Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      Acked-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Link: https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Local-Register-Variables.html
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d9dc1b40
    • Zqiang's avatar
      workqueue: Move the position of debug_work_activate() in __queue_work() · 7943f749
      Zqiang authored
      [ Upstream commit 0687c66b ]
      
      The debug_work_activate() is called on the premise that
      the work can be inserted, because if wq be in WQ_DRAINING
      status, insert work may be failed.
      
      Fixes: e41e704b
      
       ("workqueue: improve destroy_workqueue() debuggability")
      Signed-off-by: default avatarZqiang <qiang.zhang@windriver.com>
      Reviewed-by: default avatarLai Jiangshan <jiangshanlai@gmail.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7943f749
    • Lukasz Bartosik's avatar
      clk: fix invalid usage of list cursor in unregister · b3f29ed5
      Lukasz Bartosik authored
      [ Upstream commit 70454655 ]
      
      Fix invalid usage of a list_for_each_entry cursor in
      clk_notifier_unregister(). When list is empty or if the list
      is completely traversed (without breaking from the loop on one
      of the entries) then the list cursor does not point to a valid
      entry and therefore should not be used. The patch fixes a logical
      bug that hasn't been seen in pratice however it is analogus
      to the bug fixed in clk_notifier_register().
      
      The issue was dicovered when running 5.12-rc1 kernel on x86_64
      with KASAN enabled:
      BUG: KASAN: global-out-of-bounds in clk_notifier_register+0xab/0x230
      Read of size 8 at addr ffffffffa0d10588 by task swapper/0/1
      
      CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.12.0-rc1 #1
      Hardware name: Google Caroline/Caroline,
      BIOS Google_Caroline.7820.430.0 07/20/2018
      Call Trace:
       dump_stack+0xee/0x15c
       print_address_description+0x1e/0x2dc
       kasan_report+0x188/0x1ce
       ? clk_notifier_register+0xab/0x230
       ? clk_prepare_lock+0x15/0x7b
       ? clk_notifier_register+0xab/0x230
       clk_notifier_register+0xab/0x230
       dw8250_probe+0xc01/0x10d4
       ...
       Memory state around the buggy address:
        ffffffffa0d10480: 00 00 00 00 00 03 f9 f9 f9 f9 f9 f9 00 00 00 00
        ffffffffa0d10500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 f9
       >ffffffffa0d10580: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00
                                ^
        ffffffffa0d10600: 00 00 00 00 00 00 f9 f9 f9 f9 f9 f9 00 00 00 00
        ffffffffa0d10680: 00 00 00 00 00 00 00 00 f9 f9 f9 f9 00 00 00 00
        ==================================================================
      
      Fixes: b2476490
      
       ("clk: introduce the common clock framework")
      Reported-by: default avatarLukasz Majczak <lma@semihalf.com>
      Signed-off-by: default avatarLukasz Bartosik <lb@semihalf.com>
      Link: https://lore.kernel.org/r/20210401225149.18826-2-lb@semihalf.com
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b3f29ed5
    • Lukasz Bartosik's avatar
      clk: fix invalid usage of list cursor in register · 2307baac
      Lukasz Bartosik authored
      [ Upstream commit 8d3c0c01 ]
      
      Fix invalid usage of a list_for_each_entry cursor in
      clk_notifier_register(). When list is empty or if the list
      is completely traversed (without breaking from the loop on one
      of the entries) then the list cursor does not point to a valid
      entry and therefore should not be used.
      
      The issue was dicovered when running 5.12-rc1 kernel on x86_64
      with KASAN enabled:
      BUG: KASAN: global-out-of-bounds in clk_notifier_register+0xab/0x230
      Read of size 8 at addr ffffffffa0d10588 by task swapper/0/1
      
      CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.12.0-rc1 #1
      Hardware name: Google Caroline/Caroline,
      BIOS Google_Caroline.7820.430.0 07/20/2018
      Call Trace:
       dump_stack+0xee/0x15c
       print_address_description+0x1e/0x2dc
       kasan_report+0x188/0x1ce
       ? clk_notifier_register+0xab/0x230
       ? clk_prepare_lock+0x15/0x7b
       ? clk_notifier_register+0xab/0x230
       clk_notifier_register+0xab/0x230
       dw8250_probe+0xc01/0x10d4
      ...
      Memory state around the buggy address:
       ffffffffa0d10480: 00 00 00 00 00 03 f9 f9 f9 f9 f9 f9 00 00 00 00
       ffffffffa0d10500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 f9
      >ffffffffa0d10580: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00
                            ^
       ffffffffa0d10600: 00 00 00 00 00 00 f9 f9 f9 f9 f9 f9 00 00 00 00
       ffffffffa0d10680: 00 00 00 00 00 00 00 00 f9 f9 f9 f9 00 00 00 00
       ==================================================================
      
      Fixes: b2476490
      
       ("clk: introduce the common clock framework")
      Reported-by: default avatarLukasz Majczak <lma@semihalf.com>
      Signed-off-by: default avatarLukasz Bartosik <lb@semihalf.com>
      Link: https://lore.kernel.org/r/20210401225149.18826-1-lb@semihalf.com
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2307baac
    • Claudiu Beznea's avatar
      net: macb: restore cmp registers on resume path · d9c55b2d
      Claudiu Beznea authored
      [ Upstream commit a14d273b ]
      
      Restore CMP screener registers on resume path.
      
      Fixes: c1e85c6c
      
       ("net: macb: save/restore the remaining registers and features")
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
      Acked-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d9c55b2d
    • Yunjian Wang's avatar
      net: cls_api: Fix uninitialised struct field bo->unlocked_driver_cb · af36da5b
      Yunjian Wang authored
      [ Upstream commit 990b03b0 ]
      
      The 'unlocked_driver_cb' struct field in 'bo' is not being initialized
      in tcf_block_offload_init(). The uninitialized 'unlocked_driver_cb'
      will be used when calling unlocked_driver_cb(). So initialize 'bo' to
      zero to avoid the issue.
      
      Addresses-Coverity: ("Uninitialized scalar variable")
      Fixes: 0fdcf78d
      
       ("net: use flow_indr_dev_setup_offload()")
      Signed-off-by: default avatarYunjian Wang <wangyunjian@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      af36da5b
    • Can Guo's avatar
      scsi: ufs: core: Fix wrong Task Tag used in task management request UPIUs · ffd5f1e8
      Can Guo authored
      [ Upstream commit 4b42d557 ]
      
      In __ufshcd_issue_tm_cmd(), it is not correct to use hba->nutrs + req->tag
      as the Task Tag in a TMR UPIU. Directly use req->tag as the Task Tag.
      
      Fixes: e2933132
      
       ("scsi: ufs: Fix broken task management command implementation")
      Link: https://lore.kernel.org/r/1617262750-4864-3-git-send-email-cang@codeaurora.org
      Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
      Signed-off-by: default avatarCan Guo <cang@codeaurora.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ffd5f1e8
    • Can Guo's avatar
      scsi: ufs: core: Fix task management request completion timeout · ff9231dd
      Can Guo authored
      [ Upstream commit 1235fc56 ]
      
      ufshcd_tmc_handler() calls blk_mq_tagset_busy_iter(fn = ufshcd_compl_tm()),
      but since blk_mq_tagset_busy_iter() only iterates over all reserved tags
      and requests which are not in IDLE state, ufshcd_compl_tm() never gets a
      chance to run. Thus, TMR always ends up with completion timeout. Fix it by
      calling blk_mq_start_request() in __ufshcd_issue_tm_cmd().
      
      Link: https://lore.kernel.org/r/1617262750-4864-2-git-send-email-cang@codeaurora.org
      Fixes: 69a6c269
      
       ("scsi: ufs: Use blk_{get,put}_request() to allocate and free TMFs")
      Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
      Signed-off-by: default avatarCan Guo <cang@codeaurora.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ff9231dd
    • Paolo Abeni's avatar
      mptcp: forbit mcast-related sockopt on MPTCP sockets · 71ee255d
      Paolo Abeni authored
      [ Upstream commit 86581852 ]
      
      Unrolling mcast state at msk dismantel time is bug prone, as
      syzkaller reported:
      
      ======================================================
      WARNING: possible circular locking dependency detected
      5.11.0-syzkaller #0 Not tainted
      ------------------------------------------------------
      syz-executor905/8822 is trying to acquire lock:
      ffffffff8d678fe8 (rtnl_mutex){+.+.}-{3:3}, at: ipv6_sock_mc_close+0xd7/0x110 net/ipv6/mcast.c:323
      
      but task is already holding lock:
      ffff888024390120 (sk_lock-AF_INET6){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1600 [inline]
      ffff888024390120 (sk_lock-AF_INET6){+.+.}-{0:0}, at: mptcp6_release+0x57/0x130 net/mptcp/protocol.c:3507
      
      which lock already depends on the new lock.
      
      Instead we can simply forbit any mcast-related setsockopt
      
      Fixes: 717e79c8
      
       ("mptcp: Add setsockopt()/getsockopt() socket operations")
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      71ee255d
    • Norman Maurer's avatar
      net: udp: Add support for getsockopt(..., ..., UDP_GRO, ..., ...); · 24bbfe89
      Norman Maurer authored
      [ Upstream commit 98184612 ]
      
      Support for UDP_GRO was added in the past but the implementation for
      getsockopt was missed which did lead to an error when we tried to
      retrieve the setting for UDP_GRO. This patch adds the missing switch
      case for UDP_GRO
      
      Fixes: e20cf8d3
      
       ("udp: implement GRO for plain UDP sockets.")
      Signed-off-by: default avatarNorman Maurer <norman_maurer@apple.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      24bbfe89
    • Stephen Boyd's avatar
      drm/msm: Set drvdata to NULL when msm_drm_init() fails · a08d5d3b
      Stephen Boyd authored
      [ Upstream commit 5620b135 ]
      
      We should set the platform device's driver data to NULL here so that
      code doesn't assume the struct drm_device pointer is valid when it could
      have been destroyed. The lifetime of this pointer is managed by a kref
      but when msm_drm_init() fails we call drm_dev_put() on the pointer which
      will free the pointer's memory. This driver uses the component model, so
      there's sort of two "probes" in this file, one for the platform device
      i.e. msm_pdev_probe() and one for the component i.e. msm_drm_bind(). The
      msm_drm_bind() code is using the platform device's driver data to store
      struct drm_device so the two functions are intertwined.
      
      This relationship becomes a problem for msm_pdev_shutdown() when it
      tests the NULL-ness of the pointer to see if it should call
      drm_atomic_helper_shutdown(). The NULL test is a proxy check for if the
      pointer has been freed by kref_put(). If the drm_device has been
      destroyed, then we shouldn't call the shutdown helper, and we know that
      is the case if msm_drm_init() failed, therefore set the driver data to
      NULL so that this pointer liveness is tracked properly.
      
      Fixes: 9d5cbf5f
      
       ("drm/msm: add shutdown support for display platform_driver")
      Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: Krishna Manikandan <mkrishn@codeaurora.org>
      Signed-off-by: default avatarStephen Boyd <swboyd@chromium.org>
      Message-Id: <20210325212822.3663144-1-swboyd@chromium.org>
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a08d5d3b
    • Md Haris Iqbal's avatar
      RDMA/rtrs-clt: Close rtrs client conn before destroying rtrs clt session files · 7290bf41
      Md Haris Iqbal authored
      [ Upstream commit 7582207b ]
      
      KASAN detected the following BUG:
      
        BUG: KASAN: use-after-free in rtrs_clt_update_wc_stats+0x41/0x100 [rtrs_client]
        Read of size 8 at addr ffff88bf2fb4adc0 by task swapper/0/0
      
        CPU: 0 PID: 0 Comm: swapper/0 Tainted: G           O      5.4.84-pserver #5.4.84-1+feature+linux+5.4.y+dbg+20201216.1319+b6b887b~deb10
        Hardware name: Supermicro H8QG6/H8QG6, BIOS 3.00       09/04/2012
        Call Trace:
         <IRQ>
         dump_stack+0x96/0xe0
         print_address_description.constprop.4+0x1f/0x300
         ? irq_work_claim+0x2e/0x50
         __kasan_report.cold.8+0x78/0x92
         ? rtrs_clt_update_wc_stats+0x41/0x100 [rtrs_client]
         kasan_report+0x10/0x20
         rtrs_clt_update_wc_stats+0x41/0x100 [rtrs_client]
         rtrs_clt_rdma_done+0xb1/0x760 [rtrs_client]
         ? lockdep_hardirqs_on+0x1a8/0x290
         ? process_io_rsp+0xb0/0xb0 [rtrs_client]
         ? mlx4_ib_destroy_cq+0x100/0x100 [mlx4_ib]
         ? add_interrupt_randomness+0x1a2/0x340
         __ib_process_cq+0x97/0x100 [ib_core]
         ib_poll_handler+0x41/0xb0 [ib_core]
         irq_poll_softirq+0xe0/0x260
         __do_softirq+0x127/0x672
         irq_exit+0xd1/0xe0
         do_IRQ+0xa3/0x1d0
         common_interrupt+0xf/0xf
         </IRQ>
        RIP: 0010:cpuidle_enter_state+0xea/0x780
        Code: 31 ff e8 99 48 47 ff 80 7c 24 08 00 74 12 9c 58 f6 c4 02 0f 85 53 05 00 00 31 ff e8 b0 6f 53 ff e8 ab 4f 5e ff fb 8b 44 24 04 <85> c0 0f 89 f3 01 00 00 48 8d 7b 14 e8 65 1e 77 ff c7 43 14 00 00
        RSP: 0018:ffffffffab007d58 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffca
        RAX: 0000000000000002 RBX: ffff88b803d69800 RCX: ffffffffa91a8298
        RDX: 0000000000000007 RSI: dffffc0000000000 RDI: ffffffffab021414
        RBP: ffffffffab6329e0 R08: 0000000000000002 R09: 0000000000000000
        R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000002
        R13: 000000bf39d82466 R14: ffffffffab632aa0 R15: ffffffffab632ae0
         ? lockdep_hardirqs_on+0x1a8/0x290
         ? cpuidle_enter_state+0xe5/0x780
         cpuidle_enter+0x3c/0x60
         do_idle+0x2fb/0x390
         ? arch_cpu_idle_exit+0x40/0x40
         ? schedule+0x94/0x120
         cpu_startup_entry+0x19/0x1b
         start_kernel+0x5da/0x61b
         ? thread_stack_cache_init+0x6/0x6
         ? load_ucode_amd_bsp+0x6f/0xc4
         ? init_amd_microcode+0xa6/0xa6
         ? x86_family+0x5/0x20
         ? load_ucode_bsp+0x182/0x1fd
         secondary_startup_64+0xa4/0xb0
      
        Allocated by task 5730:
         save_stack+0x19/0x80
         __kasan_kmalloc.constprop.9+0xc1/0xd0
         kmem_cache_alloc_trace+0x15b/0x350
         alloc_sess+0xf4/0x570 [rtrs_client]
         rtrs_clt_open+0x3b4/0x780 [rtrs_client]
         find_and_get_or_create_sess+0x649/0x9d0 [rnbd_client]
         rnbd_clt_map_device+0xd7/0xf50 [rnbd_client]
         rnbd_clt_map_device_store+0x4ee/0x970 [rnbd_client]
         kernfs_fop_write+0x141/0x240
         vfs_write+0xf3/0x280
         ksys_write+0xba/0x150
         do_syscall_64+0x68/0x270
         entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
        Freed by task 5822:
         save_stack+0x19/0x80
         __kasan_slab_free+0x125/0x170
         kfree+0xe7/0x3f0
         kobject_put+0xd3/0x240
         rtrs_clt_destroy_sess_files+0x3f/0x60 [rtrs_client]
         rtrs_clt_close+0x3c/0x80 [rtrs_client]
         close_rtrs+0x45/0x80 [rnbd_client]
         rnbd_client_exit+0x10f/0x2bd [rnbd_client]
         __x64_sys_delete_module+0x27b/0x340
         do_syscall_64+0x68/0x270
         entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      When rtrs_clt_close is triggered, it iterates over all the present
      rtrs_clt_sess and triggers close on them. However, the call to
      rtrs_clt_destroy_sess_files is done before the rtrs_clt_close_conns. This
      is incorrect since during the initialization phase we allocate
      rtrs_clt_sess first, and then we go ahead and create rtrs_clt_con for it.
      
      If we free the rtrs_clt_sess structure before closing the rtrs_clt_con, it
      may so happen that an inflight IO completion would trigger the function
      rtrs_clt_rdma_done, which would lead to the above UAF case.
      
      Hence close the rtrs_clt_con connections first, and then trigger the
      destruction of session files.
      
      Fixes: 6a98d71d
      
       ("RDMA/rtrs: client: main functionality")
      Link: https://lore.kernel.org/r/20210325153308.1214057-12-gi-oh.kim@ionos.com
      Signed-off-by: default avatarMd Haris Iqbal <haris.iqbal@ionos.com>
      Signed-off-by: default avatarJack Wang <jinpu.wang@ionos.com>
      Signed-off-by: default avatarGioh Kim <gi-oh.kim@ionos.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7290bf41
    • Eryk Rybak's avatar
      i40e: Fix display statistics for veb_tc · 49cfa2b2
      Eryk Rybak authored
      [ Upstream commit c3214de9 ]
      
      If veb-stats was enabled, the ethtool stats triggered a warning
      due to invalid size: 'unexpected stat size for veb.tc_%u_tx_packets'.
      This was due to an incorrect structure definition for the statistics.
      Structures and functions have been improved in line with requirements
      for the presentation of statistics, in particular for the functions:
      'i40e_add_ethtool_stats' and 'i40e_add_stat_strings'.
      
      Fixes: 1510ae0b
      
       ("i40e: convert VEB TC stats to use an i40e_stats array")
      Signed-off-by: default avatarEryk Rybak <eryk.roch.rybak@intel.com>
      Signed-off-by: default avatarGrzegorz Szczurek <grzegorzx.szczurek@intel.com>
      Reviewed-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
      Tested-by: default avatarDave Switzer <david.switzer@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      49cfa2b2
    • Arnd Bergmann's avatar
      soc/fsl: qbman: fix conflicting alignment attributes · e8c96b57
      Arnd Bergmann authored
      [ Upstream commit 040f3119 ]
      
      When building with W=1, gcc points out that the __packed attribute
      on struct qm_eqcr_entry conflicts with the 8-byte alignment
      attribute on struct qm_fd inside it:
      
      drivers/soc/fsl/qbman/qman.c:189:1: error: alignment 1 of 'struct qm_eqcr_entry' is less than 8 [-Werror=packed-not-aligned]
      
      I assume that the alignment attribute is the correct one, and
      that qm_eqcr_entry cannot actually be unaligned in memory,
      so add the same alignment on the outer struct.
      
      Fixes: c535e923
      
       ("soc/fsl: Introduce DPAA 1.x QMan device driver")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/r/20210323131530.2619900-1-arnd@kernel.org'
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e8c96b57
    • Ong Boon Leong's avatar
      xdp: fix xdp_return_frame() kernel BUG throw for page_pool memory model · 55329000
      Ong Boon Leong authored
      [ Upstream commit 622d1369 ]
      
      xdp_return_frame() may be called outside of NAPI context to return
      xdpf back to page_pool. xdp_return_frame() calls __xdp_return() with
      napi_direct = false. For page_pool memory model, __xdp_return() calls
      xdp_return_frame_no_direct() unconditionally and below false negative
      kernel BUG throw happened under preempt-rt build:
      
      [  430.450355] BUG: using smp_processor_id() in preemptible [00000000] code: modprobe/3884
      [  430.451678] caller is __xdp_return+0x1ff/0x2e0
      [  430.452111] CPU: 0 PID: 3884 Comm: modprobe Tainted: G     U      E     5.12.0-rc2+ #45
      
      Changes in v2:
       - This patch fixes the issue by making xdp_return_frame_no_direct() is
         only called if napi_direct = true, as recommended for better by
         Jesper Dangaard Brouer. Thanks!
      
      Fixes: 2539650f
      
       ("xdp: Helpers for disabling napi_direct of xdp_return_frame")
      Signed-off-by: default avatarOng Boon Leong <boon.leong.ong@intel.com>
      Acked-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      55329000
    • Lv Yunlong's avatar
      net/rds: Fix a use after free in rds_message_map_pages · 4cfae7b2
      Lv Yunlong authored
      [ Upstream commit bdc2ab5c ]
      
      In rds_message_map_pages, the rm is freed by rds_message_put(rm).
      But rm is still used by rm->data.op_sg in return value.
      
      My patch assigns ERR_CAST(rm->data.op_sg) to err before the rm is
      freed to avoid the uaf.
      
      Fixes: 7dba9203
      
       ("net/rds: Use ERR_PTR for rds_message_alloc_sgs()")
      Signed-off-by: default avatarLv Yunlong <lyl2019@mail.ustc.edu.cn>
      Reviewed-by: default avatarHåkon Bugge <haakon.bugge@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4cfae7b2
    • Daniel Jurgens's avatar
      net/mlx5: Don't request more than supported EQs · 05bbe9d8
      Daniel Jurgens authored
      [ Upstream commit a7b76002 ]
      
      Calculating the number of compeltion EQs based on the number of
      available IRQ vectors doesn't work now that all async EQs share one IRQ.
      Thus the max number of EQs can be exceeded on systems with more than
      approximately 256 CPUs. Take this into account when calculating the
      number of available completion EQs.
      
      Fixes: 81bfa206
      
       ("net/mlx5: Use a single IRQ for all async EQs")
      Signed-off-by: default avatarDaniel Jurgens <danielj@mellanox.com>
      Reviewed-by: default avatarParav Pandit <parav@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      05bbe9d8
    • Aya Levin's avatar
      net/mlx5e: Fix ethtool indication of connector type · 86530eff
      Aya Levin authored
      [ Upstream commit 3211434d ]
      
      Use connector_type read from PTYS register when it's valid, based on
      corresponding capability bit.
      
      Fixes: 5b4793f8
      
       ("net/mlx5e: Add support for reading connector type from PTYS")
      Signed-off-by: default avatarAya Levin <ayal@nvidia.com>
      Reviewed-by: default avatarEran Ben Elisha <eranbe@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      86530eff
    • Ariel Levkovich's avatar
      net/mlx5e: Fix mapping of ct_label zero · bde64eac
      Ariel Levkovich authored
      [ Upstream commit d24f847e ]
      
      ct_label 0 is a default label each flow has and therefore
      there can be rules that match on ct_label=0 without a prior
      rule that set the ct_label to this value.
      
      The ct_label value is not used directly in the HW rules and
      instead it is mapped to some id within a defined range and this
      id is used to set and match the metadata register which carries
      the ct_label.
      
      If we have a rule that matches on ct_label=0, the hw rule will
      perform matching on a value that is != 0 because of the mapping
      from label to id. Since the metadata register default value is
      0 and it was never set before to anything else by an action that
      sets the ct_label, there will always be a mismatch between that
      register and the value in the rule.
      
      To support such rule, a forced mapping of ct_label 0 to id=0
      is done so that it will match the metadata register default
      value of 0.
      
      Fixes: 54b154ec
      
       ("net/mlx5e: CT: Map 128 bits labels to 32 bit map ID")
      Signed-off-by: default avatarAriel Levkovich <lariel@nvidia.com>
      Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bde64eac
    • Bastian Germann's avatar
      ASoC: sunxi: sun4i-codec: fill ASoC card owner · d65b66ca
      Bastian Germann authored
      [ Upstream commit 7c0d6e48 ]
      
      card->owner is a required property and since commit 81033c6b ("ALSA:
      core: Warn on empty module") a warning is issued if it is empty. Add it.
      This fixes following warning observed on Lamobo R1:
      
      WARNING: CPU: 1 PID: 190 at sound/core/init.c:207 snd_card_new+0x430/0x480 [snd]
      Modules linked in: sun4i_codec(E+) sun4i_backend(E+) snd_soc_core(E) ...
      CPU: 1 PID: 190 Comm: systemd-udevd Tainted: G         C  E     5.10.0-1-armmp #1 Debian 5.10.4-1
      Hardware name: Allwinner sun7i (A20) Family
      Call trace:
       (snd_card_new [snd])
       (snd_soc_bind_card [snd_soc_core])
       (snd_soc_register_card [snd_soc_core])
       (sun4i_codec_probe [sun4i_codec])
      
      Fixes: 45fb6b6f ("ASoC: sunxi: add support for the on-chip codec on early Allwinner SoCs")
      Related: commit 3c27ea23 ("ASoC: qcom: Set card->owner to avoid warnings")
      Related: commit ec653df2
      
       ("drm/vc4/vc4_hdmi: fill ASoC card owner")
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: alsa-devel@alsa-project.org
      Signed-off-by: default avatarBastian Germann <bage@linutronix.de>
      Link: https://lore.kernel.org/r/20210331151843.30583-1-bage@linutronix.de
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d65b66ca
    • 周琰杰 (Zhou Yanjie)'s avatar
      I2C: JZ4780: Fix bug for Ingenic X1000. · dcdf0876
      周琰杰 (Zhou Yanjie) authored
      [ Upstream commit 942bfbec ]
      
      Only send "X1000_I2C_DC_STOP" when last byte, or it will cause
      error when I2C write operation which should look like this:
      
      device_addr + w, reg_addr, data;
      
      But without this patch, it looks like this:
      
      device_addr + w, reg_addr, device_addr + w, data;
      
      Fixes: 21575a7a
      
       ("I2C: JZ4780: Add support for the X1000.")
      Reported-by: default avatar杨文龙 (Yang Wenlong) <ywltyut@sina.cn>
      Tested-by: default avatar杨文龙 (Yang Wenlong) <ywltyut@sina.cn>
      Signed-off-by: default avatar周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
      Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      dcdf0876
    • Florian Fainelli's avatar
      net: phy: broadcom: Only advertise EEE for supported modes · f295dfc8
      Florian Fainelli authored
      [ Upstream commit c056d480 ]
      
      We should not be advertising EEE for modes that we do not support,
      correct that oversight by looking at the PHY device supported linkmodes.
      
      Fixes: 99cec8a4
      
       ("net: phy: broadcom: Allow enabling or disabling of EEE")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f295dfc8
    • Yinjun Zhang's avatar
      nfp: flower: ignore duplicate merge hints from FW · 7a896e18
      Yinjun Zhang authored
      [ Upstream commit 2ea538db ]
      
      A merge hint message needs some time to process before the merged
      flow actually reaches the firmware, during which we may get duplicate
      merge hints if there're more than one packet that hit the pre-merged
      flow. And processing duplicate merge hints will cost extra host_ctx's
      which are a limited resource.
      
      Avoid the duplicate merge by using hash table to store the sub_flows
      to be merged.
      
      Fixes: 8af56f40
      
       ("nfp: flower: offload merge flows")
      Signed-off-by: default avatarYinjun Zhang <yinjun.zhang@corigine.com>
      Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
      Signed-off-by: default avatarSimon Horman <simon.horman@netronome.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7a896e18