Skip to content
  1. Apr 14, 2022
    • Miaohe Lin's avatar
      mm/mempolicy: fix mpol_new leak in shared_policy_replace · f7e183b0
      Miaohe Lin authored
      commit 4ad09955 upstream.
      
      If mpol_new is allocated but not used in restart loop, mpol_new will be
      freed via mpol_put before returning to the caller.  But refcnt is not
      initialized yet, so mpol_put could not do the right things and might
      leak the unused mpol_new.  This would happen if mempolicy was updated on
      the shared shmem file while the sp->lock has been dropped during the
      memory allocation.
      
      This issue could be triggered easily with the below code snippet if
      there are many processes doing the below work at the same time:
      
        shmid = shmget((key_t)5566, 1024 * PAGE_SIZE, 0666|IPC_CREAT);
        shm = shmat(shmid, 0, 0);
        loop many times {
          mbind(shm, 1024 * PAGE_SIZE, MPOL_LOCAL, mask, maxnode, 0);
          mbind(shm + 128 * PAGE_SIZE, 128 * PAGE_SIZE, MPOL_DEFAULT, mask,
                maxnode, 0);
        }
      
      Link: https://lkml.kernel.org/r/20220329111416.27954-1-linmiaohe@huawei.com
      Fixes: 42288fe3 ("mm: mempolicy: Convert sh...
      f7e183b0
    • Paolo Bonzini's avatar
      mmmremap.c: avoid pointless invalidate_range_start/end on mremap(old_size=0) · 7d659cb1
      Paolo Bonzini authored
      commit 01e67e04
      
       upstream.
      
      If an mremap() syscall with old_size=0 ends up in move_page_tables(), it
      will call invalidate_range_start()/invalidate_range_end() unnecessarily,
      i.e.  with an empty range.
      
      This causes a WARN in KVM's mmu_notifier.  In the past, empty ranges
      have been diagnosed to be off-by-one bugs, hence the WARNing.  Given the
      low (so far) number of unique reports, the benefits of detecting more
      buggy callers seem to outweigh the cost of having to fix cases such as
      this one, where userspace is doing something silly.  In this particular
      case, an early return from move_page_tables() is enough to fix the
      issue.
      
      Link: https://lkml.kernel.org/r/20220329173155.172439-1-pbonzini@redhat.com
      Reported-by: default avatar <syzbot+6bde52d89cfdf9f61425@syzkaller.appspotmail.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by...
      7d659cb1
    • Guo Xuenan's avatar
      lz4: fix LZ4_decompress_safe_partial read out of bound · 6adc01a7
      Guo Xuenan authored
      commit eafc0a02 upstream.
      
      When partialDecoding, it is EOF if we've either filled the output buffer
      or can't proceed with reading an offset for following match.
      
      In some extreme corner cases when compressed data is suitably corrupted,
      UAF will occur.  As reported by KASAN [1], LZ4_decompress_safe_partial
      may lead to read out of bound problem during decoding.  lz4 upstream has
      fixed it [2] and this issue has been disscussed here [3] before.
      
      current decompression routine was ported from lz4 v1.8.3, bumping
      lib/lz4 to v1.9.+ is certainly a huge work to be done later, so, we'd
      better fix it first.
      
      [1] https://lore.kernel.org/all/000000000000830d1205cf7f0477@google.com/
      [2] https://github.com/lz4/lz4/commit/c5d6f8a8be3927c0bec91bcc58667a6cfad244ad#
      [3] https://lore.kernel.org/all/CC666AE8-4CA4-4951-B6FB-A2EFDE3AC03B@fb.com/
      
      Link: https://lkml.kernel.org/r/20211111105048.2006070-1-guoxuenan@huawei.com
      Reported-by: syzbot+6...
      6adc01a7
    • Wolfram Sang's avatar
      mmc: renesas_sdhi: don't overwrite TAP settings when HS400 tuning is complete · 8b6f04b4
      Wolfram Sang authored
      commit 03e59b1e upstream.
      
      When HS400 tuning is complete and HS400 is going to be activated, we
      have to keep the current number of TAPs and should not overwrite them
      with a hardcoded value. This was probably a copy&paste mistake when
      upporting HS400 support from the BSP.
      
      Fixes: 26eb2607
      
       ("mmc: renesas_sdhi: add eMMC HS400 mode support")
      Reported-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
      Reviewed-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20220404114902.12175-1-wsa+renesas@sang-engineering.com
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8b6f04b4
    • Yann Gautier's avatar
      mmc: mmci: stm32: correctly check all elements of sg list · 029b4170
      Yann Gautier authored
      commit 0d319dd5 upstream.
      
      Use sg and not data->sg when checking sg list elements. Else only the
      first element alignment is checked.
      The last element should be checked the same way, for_each_sg already set
      sg to sg_next(sg).
      
      Fixes: 46b723dd
      
       ("mmc: mmci: add stm32 sdmmc variant")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarYann Gautier <yann.gautier@foss.st.com>
      Link: https://lore.kernel.org/r/20220317111944.116148-2-yann.gautier@foss.st.com
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      029b4170
    • Pali Rohár's avatar
      Revert "mmc: sdhci-xenon: fix annoying 1.8V regulator warning" · 41a519c0
      Pali Rohár authored
      commit 7e2646ed upstream.
      
      This reverts commit bb32e198.
      
      Commit 1a3ed0dc ("mmc: sdhci-xenon: fix 1.8v regulator stabilization")
      contains proper fix for the issue described in commit bb32e198 ("mmc:
      sdhci-xenon: fix annoying 1.8V regulator warning").
      
      Fixes: 8d876bf4 ("mmc: sdhci-xenon: wait 5ms after set 1.8V signal enable")
      Cc: stable@vger.kernel.org # 1a3ed0dc
      
       ("mmc: sdhci-xenon: fix 1.8v regulator stabilization")
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Reviewed-by: default avatarMarek Behún <kabel@kernel.org>
      Reviewed-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Link: https://lore.kernel.org/r/20220318141441.32329-1-pali@kernel.org
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      41a519c0
    • Chanho Park's avatar
      arm64: Add part number for Arm Cortex-A78AE · 9de98470
      Chanho Park authored
      commit 83bea32a
      
       upstream.
      
      Add the MIDR part number info for the Arm Cortex-A78AE[1] and add it to
      spectre-BHB affected list[2].
      
      [1]: https://developer.arm.com/Processors/Cortex-A78AE
      [2]: https://developer.arm.com/Arm%20Security%20Center/Spectre-BHB
      
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: James Morse <james.morse@arm.com>
      Signed-off-by: default avatarChanho Park <chanho61.park@samsung.com>
      Link: https://lore.kernel.org/r/20220407091128.8700-1-chanho61.park@samsung.com
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9de98470
    • Denis Nikitin's avatar
      perf session: Remap buf if there is no space for event · 4604b573
      Denis Nikitin authored
      [ Upstream commit bc21e74d ]
      
      If a perf event doesn't fit into remaining buffer space return NULL to
      remap buf and fetch the event again.
      
      Keep the logic to error out on inadequate input from fuzzing.
      
      This fixes perf failing on ChromeOS (with 32b userspace):
      
        $ perf report -v -i perf.data
        ...
        prefetch_event: head=0x1fffff8 event->header_size=0x30, mmap_size=0x2000000: fuzzed or compressed perf.data?
        Error:
        failed to process sample
      
      Fixes: 57fc032a
      
       ("perf session: Avoid infinite loop when seeing invalid header.size")
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarDenis Nikitin <denik@chromium.org>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20220330031130.2152327-1-denik@chromium.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4604b573
    • Adrian Hunter's avatar
      perf tools: Fix perf's libperf_print callback · 362ced37
      Adrian Hunter authored
      [ Upstream commit aeee9dc5
      
       ]
      
      eprintf() does not expect va_list as the type of the 4th parameter.
      
      Use veprintf() because it does.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Fixes: 428dab81
      
       ("libperf: Merge libperf_set_print() into libperf_init()")
      Cc: Jiri Olsa <jolsa@kernel.org>
      Link: https://lore.kernel.org/r/20220408132625.2451452-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>
      362ced37
    • James Clark's avatar
      perf: arm-spe: Fix perf report --mem-mode · 65210fac
      James Clark authored
      [ Upstream commit ffab4870 ]
      
      Since commit bb30acae ("perf report: Bail out --mem-mode if mem
      info is not available") "perf mem report" and "perf report --mem-mode"
      don't allow opening the file unless one of the events has
      PERF_SAMPLE_DATA_SRC set.
      
      SPE doesn't have this set even though synthetic memory data is generated
      after it is decoded. Fix this issue by setting DATA_SRC on SPE events.
      This has no effect on the data collected because the SPE driver doesn't
      do anything with that flag and doesn't generate samples.
      
      Fixes: bb30acae
      
       ("perf report: Bail out --mem-mode if mem info is not available")
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Tested-by: default avatarLeo Yan <leo.yan@linaro.org>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Link: https://lore.kernel.org/r/20220408144056.1955535-1-james.clark@arm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      65210fac
    • Tony Lindgren's avatar
      iommu/omap: Fix regression in probe for NULL pointer dereference · bd905fed
      Tony Lindgren authored
      [ Upstream commit 71ff461c ]
      
      Commit 3f6634d9 ("iommu: Use right way to retrieve iommu_ops") started
      triggering a NULL pointer dereference for some omap variants:
      
      __iommu_probe_device from probe_iommu_group+0x2c/0x38
      probe_iommu_group from bus_for_each_dev+0x74/0xbc
      bus_for_each_dev from bus_iommu_probe+0x34/0x2e8
      bus_iommu_probe from bus_set_iommu+0x80/0xc8
      bus_set_iommu from omap_iommu_init+0x88/0xcc
      omap_iommu_init from do_one_initcall+0x44/0x24
      
      This is caused by omap iommu probe returning 0 instead of ERR_PTR(-ENODEV)
      as noted by Jason Gunthorpe <jgg@ziepe.ca>.
      
      Looks like the regression already happened with an earlier commit
      6785eb91
      
       ("iommu/omap: Convert to probe/release_device() call-backs")
      that changed the function return type and missed converting one place.
      
      Cc: Drew Fustini <dfustini@baylibre.com>
      Cc: Lu Baolu <baolu.lu@linux.intel.com>
      Cc: Suman Anna <s-anna@ti.com>
      Suggested-by: default avatarJason Gunthorpe <jgg@ziepe.ca>
      Fixes: 6785eb91 ("iommu/omap: Convert to probe/release_device() call-backs")
      Fixes: 3f6634d9
      
       ("iommu: Use right way to retrieve iommu_ops")
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Tested-by: default avatarDrew Fustini <dfustini@baylibre.com>
      Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Link: https://lore.kernel.org/r/20220331062301.24269-1-tony@atomide.com
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bd905fed
    • Trond Myklebust's avatar
      SUNRPC: svc_tcp_sendmsg() should handle errors from xdr_alloc_bvec() · b3c00be2
      Trond Myklebust authored
      [ Upstream commit b056fa07 ]
      
      The allocation is done with GFP_KERNEL, but it could still fail in a low
      memory situation.
      
      Fixes: 4a85a6a3
      
       ("SUNRPC: Handle TCP socket sends with kernel_sendpage() again")
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b3c00be2
    • Trond Myklebust's avatar
      SUNRPC: Handle low memory situations in call_status() · 9a45e086
      Trond Myklebust authored
      [ Upstream commit 9d82819d ]
      
      We need to handle ENFILE, ENOBUFS, and ENOMEM, because
      xprt_wake_pending_tasks() can be called with any one of these due to
      socket creation failures.
      
      Fixes: b61d59ff
      
       ("SUNRPC: xs_tcp_connect_worker{4,6}: merge common code")
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9a45e086
    • Trond Myklebust's avatar
      SUNRPC: Handle ENOMEM in call_transmit_status() · 132cbe2f
      Trond Myklebust authored
      [ Upstream commit d3c15033 ]
      
      Both call_transmit() and call_bc_transmit() can now return ENOMEM, so
      let's make sure that we handle the errors gracefully.
      
      Fixes: 0472e476
      
       ("SUNRPC: Convert socket page send code to use iov_iter()")
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      132cbe2f
    • Pavel Begunkov's avatar
      io_uring: don't touch scm_fp_list after queueing skb · aed30a20
      Pavel Begunkov authored
      [ Upstream commit a07211e3 ]
      
      It's safer to not touch scm_fp_list after we queued an skb to which it
      was assigned, there might be races lurking if we screw subtle sync
      guarantees on the io_uring side.
      
      Fixes: 6b06314c
      
       ("io_uring: add file set registration")
      Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      aed30a20
    • Lv Yunlong's avatar
      drbd: Fix five use after free bugs in get_initial_state · 594205b4
      Lv Yunlong authored
      [ Upstream commit aadb22ba ]
      
      In get_initial_state, it calls notify_initial_state_done(skb,..) if
      cb->args[5]==1. If genlmsg_put() failed in notify_initial_state_done(),
      the skb will be freed by nlmsg_free(skb).
      Then get_initial_state will goto out and the freed skb will be used by
      return value skb->len, which is a uaf bug.
      
      What's worse, the same problem goes even further: skb can also be
      freed in the notify_*_state_change -> notify_*_state calls below.
      Thus 4 additional uaf bugs happened.
      
      My patch lets the problem callee functions: notify_initial_state_done
      and notify_*_state_change return an error code if errors happen.
      So that the error codes could be propagated and the uaf bugs can be avoid.
      
      v2 reports a compilation warning. This v3 fixed this warning and built
      successfully in my local environment with no additional warnings.
      v2: https://lore.kernel.org/patchwork/patch/1435218/
      
      Fixes: a2972846
      
       ("drbd: Backport the "events2" command")
      Signed-off-by: default avatarLv Yunlong <lyl2019@mail.ustc.edu.cn>
      Reviewed-by: default avatarChristoph Böhmwalder <christoph.boehmwalder@linbit.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      594205b4
    • Maxim Mikityanskiy's avatar
      bpf: Support dual-stack sockets in bpf_tcp_check_syncookie · 970a6bb7
      Maxim Mikityanskiy authored
      [ Upstream commit 2e8702cc ]
      
      bpf_tcp_gen_syncookie looks at the IP version in the IP header and
      validates the address family of the socket. It supports IPv4 packets in
      AF_INET6 dual-stack sockets.
      
      On the other hand, bpf_tcp_check_syncookie looks only at the address
      family of the socket, ignoring the real IP version in headers, and
      validates only the packet size. This implementation has some drawbacks:
      
      1. Packets are not validated properly, allowing a BPF program to trick
         bpf_tcp_check_syncookie into handling an IPv6 packet on an IPv4
         socket.
      
      2. Dual-stack sockets fail the checks on IPv4 packets. IPv4 clients end
         up receiving a SYNACK with the cookie, but the following ACK gets
         dropped.
      
      This patch fixes these issues by changing the checks in
      bpf_tcp_check_syncookie to match the ones in bpf_tcp_gen_syncookie. IP
      version from the header is taken into account, and it is validated
      properly with address family.
      
      Fixes: 39904084
      
       ("bpf: add helper to check for a valid SYN cookie")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Acked-by: default avatarArthur Fabre <afabre@cloudflare.com>
      Link: https://lore.kernel.org/bpf/20220406124113.2795730-1-maximmi@nvidia.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      970a6bb7
    • Kamal Dasu's avatar
      spi: bcm-qspi: fix MSPI only access with bcm_qspi_exec_mem_op() · 6c17f4ef
      Kamal Dasu authored
      [ Upstream commit 2c7d1b28 ]
      
      This fixes case where MSPI controller is used to access spi-nor
      flash and BSPI block is not present.
      
      Fixes: 5f195ee7
      
       ("spi: bcm-qspi: Implement the spi_mem interface")
      Signed-off-by: default avatarKamal Dasu <kdasu.kdev@gmail.com>
      Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20220328142442.7553-1-kdasu.kdev@gmail.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6c17f4ef
    • Jamie Bainbridge's avatar
      qede: confirm skb is allocated before using · 8928239e
      Jamie Bainbridge authored
      [ Upstream commit 4e910dbe ]
      
      qede_build_skb() assumes build_skb() always works and goes straight
      to skb_reserve(). However, build_skb() can fail under memory pressure.
      This results in a kernel panic because the skb to reserve is NULL.
      
      Add a check in case build_skb() failed to allocate and return NULL.
      
      The NULL return is handled correctly in callers to qede_build_skb().
      
      Fixes: 8a863397
      
       ("qede: Add build_skb() support.")
      Signed-off-by: default avatarJamie Bainbridge <jamie.bainbridge@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8928239e
    • Michael Walle's avatar
      net: phy: mscc-miim: reject clause 45 register accesses · b7893388
      Michael Walle authored
      [ Upstream commit 8d90991e ]
      
      The driver doesn't support clause 45 register access yet, but doesn't
      check if the access is a c45 one either. This leads to spurious register
      reads and writes. Add the check.
      
      Fixes: 542671fe
      
       ("net: phy: mscc-miim: Add MDIO driver")
      Signed-off-by: default avatarMichael Walle <michael@walle.cc>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-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>
      b7893388
    • Eric Dumazet's avatar
      rxrpc: fix a race in rxrpc_exit_net() · 08ff0e74
      Eric Dumazet authored
      [ Upstream commit 1946014c ]
      
      Current code can lead to the following race:
      
      CPU0                                                 CPU1
      
      rxrpc_exit_net()
                                                           rxrpc_peer_keepalive_worker()
                                                             if (rxnet->live)
      
        rxnet->live = false;
        del_timer_sync(&rxnet->peer_keepalive_timer);
      
                                                                   timer_reduce(&rxnet->peer_keepalive_timer, jiffies + delay);
      
        cancel_work_sync(&rxnet->peer_keepalive_work);
      
      rxrpc_exit_net() exits while peer_keepalive_timer is still armed,
      leading to use-after-free.
      
      syzbot report was:
      
      ODEBUG: free active (active state 0) object type: timer_list hint: rxrpc_peer_keepalive_timeout+0x0/0xb0
      WARNING: CPU: 0 PID: 3660 at lib/debugobjects.c:505 debug_print_object+0x16e/0x250 lib/debugobjects.c:505
      Modules linked in:
      CPU: 0 PID: 3660 Comm: kworker/u4:6 Not tainted 5.17.0-syzkaller-13993-g88e6c0207623 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Workqueue: netns cleanup_net
      RIP: 0010:debug_print_object+0x16e/0x250 lib/debugobjects.c:505
      Code: ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 af 00 00 00 48 8b 14 dd 00 1c 26 8a 4c 89 ee 48 c7 c7 00 10 26 8a e8 b1 e7 28 05 <0f> 0b 83 05 15 eb c5 09 01 48 83 c4 18 5b 5d 41 5c 41 5d 41 5e c3
      RSP: 0018:ffffc9000353fb00 EFLAGS: 00010082
      RAX: 0000000000000000 RBX: 0000000000000003 RCX: 0000000000000000
      RDX: ffff888029196140 RSI: ffffffff815efad8 RDI: fffff520006a7f52
      RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000
      R10: ffffffff815ea4ae R11: 0000000000000000 R12: ffffffff89ce23e0
      R13: ffffffff8a2614e0 R14: ffffffff816628c0 R15: dffffc0000000000
      FS:  0000000000000000(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007fe1f2908924 CR3: 0000000043720000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
       __debug_check_no_obj_freed lib/debugobjects.c:992 [inline]
       debug_check_no_obj_freed+0x301/0x420 lib/debugobjects.c:1023
       kfree+0xd6/0x310 mm/slab.c:3809
       ops_free_list.part.0+0x119/0x370 net/core/net_namespace.c:176
       ops_free_list net/core/net_namespace.c:174 [inline]
       cleanup_net+0x591/0xb00 net/core/net_namespace.c:598
       process_one_work+0x996/0x1610 kernel/workqueue.c:2289
       worker_thread+0x665/0x1080 kernel/workqueue.c:2436
       kthread+0x2e9/0x3a0 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
       </TASK>
      
      Fixes: ace45bec
      
       ("rxrpc: Fix firewall route keepalive")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Marc Dionne <marc.dionne@auristor.com>
      Cc: linux-afs@lists.infradead.org
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      08ff0e74
    • Ilya Maximets's avatar
      net: openvswitch: fix leak of nested actions · 5ae05b5e
      Ilya Maximets authored
      [ Upstream commit 1f30fb91 ]
      
      While parsing user-provided actions, openvswitch module may dynamically
      allocate memory and store pointers in the internal copy of the actions.
      So this memory has to be freed while destroying the actions.
      
      Currently there are only two such actions: ct() and set().  However,
      there are many actions that can hold nested lists of actions and
      ovs_nla_free_flow_actions() just jumps over them leaking the memory.
      
      For example, removal of the flow with the following actions will lead
      to a leak of the memory allocated by nf_ct_tmpl_alloc():
      
        actions:clone(ct(commit),0)
      
      Non-freed set() action may also leak the 'dst' structure for the
      tunnel info including device references.
      
      Under certain conditions with a high rate of flow rotation that may
      cause significant memory leak problem (2MB per second in reporter's
      case).  The problem is also hard to mitigate, because the user doesn't
      have direct control over the datapath flows generated by OVS.
      
      Fix that by iterating over all the nested actions and freeing
      everything that needs to be freed recursively.
      
      New build time assertion should protect us from this problem if new
      actions will be added in the future.
      
      Unfortunately, openvswitch module doesn't use NLA_F_NESTED, so all
      attributes has to be explicitly checked.  sample() and clone() actions
      are mixing extra attributes into the user-provided action list.  That
      prevents some code generalization too.
      
      Fixes: 34ae932a
      
       ("openvswitch: Make tunnel set action attach a metadata dst")
      Link: https://mail.openvswitch.org/pipermail/ovs-dev/2022-March/392922.html
      Reported-by: default avatarStéphane Graber <stgraber@ubuntu.com>
      Signed-off-by: default avatarIlya Maximets <i.maximets@ovn.org>
      Acked-by: default avatarAaron Conole <aconole@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5ae05b5e
    • Ilya Maximets's avatar
      net: openvswitch: don't send internal clone attribute to the userspace. · 42ab401d
      Ilya Maximets authored
      [ Upstream commit 3f2a3050 ]
      
      'OVS_CLONE_ATTR_EXEC' is an internal attribute that is used for
      performance optimization inside the kernel.  It's added by the kernel
      while parsing user-provided actions and should not be sent during the
      flow dump as it's not part of the uAPI.
      
      The issue doesn't cause any significant problems to the ovs-vswitchd
      process, because reported actions are not really used in the
      application lifecycle and only supposed to be shown to a human via
      ovs-dpctl flow dump.  However, the action list is still incorrect
      and causes the following error if the user wants to look at the
      datapath flows:
      
        # ovs-dpctl add-dp system@ovs-system
        # ovs-dpctl add-flow "<flow match>" "clone(ct(commit),0)"
        # ovs-dpctl dump-flows
        <flow match>, packets:0, bytes:0, used:never,
          actions:clone(bad length 4, expected -1 for: action0(01 00 00 00),
                        ct(commit),0)
      
      With the fix:
      
        # ovs-dpctl dump-flows
        <flow match>, packets:0, bytes:0, used:never,
          actions:clone(ct(commit),0)
      
      Additionally fixed an incorrect attribute name in the comment.
      
      Fixes: b2335040
      
       ("openvswitch: kernel datapath clone action")
      Signed-off-by: default avatarIlya Maximets <i.maximets@ovn.org>
      Acked-by: default avatarAaron Conole <aconole@redhat.com>
      Link: https://lore.kernel.org/r/20220404104150.2865736-1-i.maximets@ovn.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      42ab401d
    • Maciej Fijalkowski's avatar
      ice: synchronize_rcu() when terminating rings · e54ea8fc
      Maciej Fijalkowski authored
      [ Upstream commit f9124c68 ]
      
      Unfortunately, the ice driver doesn't respect the RCU critical section that
      XSK wakeup is surrounded with. To fix this, add synchronize_rcu() calls to
      paths that destroy resources that might be in use.
      
      This was addressed in other AF_XDP ZC enabled drivers, for reference see
      for example commit b3873a5b ("net/i40e: Fix concurrency issues
      between config flow and XSK")
      
      Fixes: efc2214b ("ice: Add support for XDP")
      Fixes: 2d4238f5
      
       ("ice: Add support for AF_XDP")
      Signed-off-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Tested-by: default avatarShwetha Nagaraju <shwetha.nagaraju@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e54ea8fc
    • David Ahern's avatar
      ipv6: Fix stats accounting in ip6_pkt_drop · e3dd1202
      David Ahern authored
      [ Upstream commit 1158f79f ]
      
      VRF devices are the loopbacks for VRFs, and a loopback can not be
      assigned to a VRF. Accordingly, the condition in ip6_pkt_drop should
      be '||' not '&&'.
      
      Fixes: 1d3fd8a1
      
       ("vrf: Use orig netdev to count Ip6InNoRoutes and a fresh route lookup when sending dest unreach")
      Reported-by: default avatarPudak, Filip <Filip.Pudak@windriver.com>
      Reported-by: default avatarXiao, Jiguang <Jiguang.Xiao@windriver.com>
      Signed-off-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20220404150908.2937-1-dsahern@kernel.org
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e3dd1202
    • Anatolii Gerasymenko's avatar
      ice: Do not skip not enabled queues in ice_vc_dis_qs_msg · ffce126c
      Anatolii Gerasymenko authored
      [ Upstream commit 05ef6813 ]
      
      Disable check for queue being enabled in ice_vc_dis_qs_msg, because
      there could be a case when queues were created, but were not enabled.
      We still need to delete those queues.
      
      Normal workflow for VF looks like:
      Enable path:
      VIRTCHNL_OP_ADD_ETH_ADDR (opcode 10)
      VIRTCHNL_OP_CONFIG_VSI_QUEUES (opcode 6)
      VIRTCHNL_OP_ENABLE_QUEUES (opcode 8)
      
      Disable path:
      VIRTCHNL_OP_DISABLE_QUEUES (opcode 9)
      VIRTCHNL_OP_DEL_ETH_ADDR (opcode 11)
      
      The issue appears only in stress conditions when VF is enabled and
      disabled very fast.
      Eventually there will be a case, when queues are created by
      VIRTCHNL_OP_CONFIG_VSI_QUEUES, but are not enabled by
      VIRTCHNL_OP_ENABLE_QUEUES.
      In turn, these queues are not deleted by VIRTCHNL_OP_DISABLE_QUEUES,
      because there is a check whether queues are enabled in
      ice_vc_dis_qs_msg.
      
      When we bring up the VF again, we will see the "Failed to set LAN Tx queue
      context" error during VIRTCHNL_OP_CONFIG_VSI_QUEUES step. This
      happens because old 16 queues were not deleted and VF requests to create
      16 more, but ice_sched_get_free_qparent in ice_ena_vsi_txq would fail to
      find a parent node for first newly requested queue (because all nodes
      are allocated to 16 old queues).
      
      Testing Hints:
      
      Just enable and disable VF fast enough, so it would be disabled before
      reaching VIRTCHNL_OP_ENABLE_QUEUES.
      
      while true; do
              ip link set dev ens785f0v0 up
              sleep 0.065 # adjust delay value for you machine
              ip link set dev ens785f0v0 down
      done
      
      Fixes: 77ca27c4
      
       ("ice: add support for virtchnl_queue_select.[tx|rx]_queues bitmap")
      Signed-off-by: default avatarAnatolii Gerasymenko <anatolii.gerasymenko@intel.com>
      Tested-by: default avatarKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: default avatarAlice Michael <alice.michael@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ffce126c
    • Anatolii Gerasymenko's avatar
      ice: Set txq_teid to ICE_INVAL_TEID on ring creation · b003fc49
      Anatolii Gerasymenko authored
      [ Upstream commit ccfee182 ]
      
      When VF is freshly created, but not brought up, ring->txq_teid
      value is by default set to 0.
      But 0 is a valid TEID. On some platforms the Root Node of
      Tx scheduler has a TEID = 0. This can cause issues as shown below.
      
      The proper way is to set ring->txq_teid to ICE_INVAL_TEID (0xFFFFFFFF).
      
      Testing Hints:
      echo 1 > /sys/class/net/ens785f0/device/sriov_numvfs
      ip link set dev ens785f0v0 up
      ip link set dev ens785f0v0 down
      
      If we have freshly created VF and quickly turn it on and off, so there
      would be no time to reach VIRTCHNL_OP_CONFIG_VSI_QUEUES stage, then
      VIRTCHNL_OP_DISABLE_QUEUES stage will fail with error:
      [  639.531454] disable queue 89 failed 14
      [  639.532233] Failed to disable LAN Tx queues, error: ICE_ERR_AQ_ERROR
      [  639.533107] ice 0000:02:00.0: Failed to stop Tx ring 0 on VSI 5
      
      The reason for the fail is that we are trying to send AQ command to
      delete queue 89, which has never been created and receive an "invalid
      argument" error from firmware.
      
      As this queue has never been created, it's teid and ring->txq_teid
      have default value 0.
      ice_dis_vsi_txq has a check against non-existent queues:
      
      node = ice_sched_find_node_by_teid(pi->root, q_teids[i]);
      if (!node)
      	continue;
      
      But on some platforms the Root Node of Tx scheduler has a teid = 0.
      Hence, ice_sched_find_node_by_teid finds a node with teid = 0 (it is
      pi->root), and we go further to submit an erroneous request to firmware.
      
      Fixes: 37bb8390
      
       ("ice: Move common functions out of ice_main.c part 7/7")
      Signed-off-by: default avatarAnatolii Gerasymenko <anatolii.gerasymenko@intel.com>
      Reviewed-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Tested-by: default avatarKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: default avatarAlice Michael <alice.michael@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b003fc49
    • Miaoqian Lin's avatar
      dpaa2-ptp: Fix refcount leak in dpaa2_ptp_probe · ebd1e345
      Miaoqian Lin authored
      [ Upstream commit 2b04bd4f ]
      
      This node pointer is returned by of_find_compatible_node() with
      refcount incremented. Calling of_node_put() to aovid the refcount leak.
      
      Fixes: d346c9e8
      
       ("dpaa2-ptp: reuse ptp_qoriq driver")
      Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
      Link: https://lore.kernel.org/r/20220404125336.13427-1-linmq006@gmail.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ebd1e345
    • Niels Dossche's avatar
      IB/rdmavt: add lock to call to rvt_error_qp to prevent a race condition · 43c2d789
      Niels Dossche authored
      [ Upstream commit 4d809f69 ]
      
      The documentation of the function rvt_error_qp says both r_lock and s_lock
      need to be held when calling that function.  It also asserts using lockdep
      that both of those locks are held.  However, the commit I referenced in
      Fixes accidentally makes the call to rvt_error_qp in rvt_ruc_loopback no
      longer covered by r_lock.  This results in the lockdep assertion failing
      and also possibly in a race condition.
      
      Fixes: d757c60e
      
       ("IB/rdmavt: Fix concurrency panics in QP post_send and modify to error")
      Link: https://lore.kernel.org/r/20220228165330.41546-1-dossche.niels@gmail.com
      Signed-off-by: default avatarNiels Dossche <dossche.niels@gmail.com>
      Acked-by: default avatarDennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      43c2d789
    • Aharon Landau's avatar
      RDMA/mlx5: Don't remove cache MRs when a delay is needed · 3a57babf
      Aharon Landau authored
      [ Upstream commit 84c2362f ]
      
      Don't remove MRs from the cache if need to delay the removal.
      
      Fixes: b9358bdb
      
       ("RDMA/mlx5: Fix locking in MR cache work queue")
      Link: https://lore.kernel.org/r/c3087a90ff362c8796c7eaa2715128743ce36722.1649062436.git.leonro@nvidia.com
      Signed-off-by: default avatarAharon Landau <aharonl@nvidia.com>
      Reviewed-by: default avatarShay Drory <shayd@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>
      3a57babf
    • Martin Habets's avatar
      sfc: Do not free an empty page_ring · d8992b39
      Martin Habets authored
      [ Upstream commit 458f5d92 ]
      
      When the page_ring is not used page_ptr_mask is 0.
      Do not dereference page_ring[0] in this case.
      
      Fixes: 2768935a
      
       ("sfc: reuse pages to avoid DMA mapping/unmapping costs")
      Reported-by: default avatarTaehee Yoo <ap420073@gmail.com>
      Signed-off-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d8992b39
    • Andy Gospodarek's avatar
      bnxt_en: reserve space inside receive page for skb_shared_info · 0ac74169
      Andy Gospodarek authored
      [ Upstream commit facc173c ]
      
      Insufficient space was being reserved in the page used for packet
      reception, so the interface MTU could be set too large to still have
      room for the contents of the packet when doing XDP redirect.  This
      resulted in the following message when redirecting a packet between
      3520 and 3822 bytes with an MTU of 3822:
      
      [311815.561880] XDP_WARN: xdp_update_frame_from_buff(line:200): Driver BUG: missing reserved tailroom
      
      Fixes: f18c2b77
      
       ("bnxt_en: optimized XDP_REDIRECT support")
      Reviewed-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Signed-off-by: default avatarAndy Gospodarek <gospo@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0ac74169
    • José Expósito's avatar
      drm/imx: Fix memory leak in imx_pd_connector_get_modes · f8b0ef0a
      José Expósito authored
      [ Upstream commit bce81feb ]
      
      Avoid leaking the display mode variable if of_get_drm_display_mode
      fails.
      
      Fixes: 76ecd9c9
      
       ("drm/imx: parallel-display: check return code from of_get_drm_display_mode()")
      Addresses-Coverity-ID: 1443943 ("Resource leak")
      Signed-off-by: default avatarJosé Expósito <jose.exposito89@gmail.com>
      Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
      Link: https://lore.kernel.org/r/20220108165230.44610-1-jose.exposito89@gmail.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f8b0ef0a
    • 蒋家盛's avatar
      drm/imx: imx-ldb: Check for null pointer after calling kmemdup · 25bc9fd4
      蒋家盛 authored
      [ Upstream commit 8027a9ad ]
      
      As the possible failure of the allocation, kmemdup() may return NULL
      pointer.
      Therefore, it should be better to check the return value of kmemdup()
      and return error if fails.
      
      Fixes: dc80d703
      
       ("drm/imx-ldb: Add support to drm-bridge")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
      Link: https://lore.kernel.org/r/20220105074729.2363657-1-jiasheng@iscas.ac.cn
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      25bc9fd4
    • Chen-Yu Tsai's avatar
      net: stmmac: Fix unset max_speed difference between DT and non-DT platforms · 02ab4abe
      Chen-Yu Tsai authored
      [ Upstream commit c21cabb0 ]
      
      In commit 9cbadf09 ("net: stmmac: support max-speed device tree
      property"), when DT platforms don't set "max-speed", max_speed is set to
      -1; for non-DT platforms, it stays the default 0.
      
      Prior to commit eeef2f6b ("net: stmmac: Start adding phylink support"),
      the check for a valid max_speed setting was to check if it was greater
      than zero. This commit got it right, but subsequent patches just checked
      for non-zero, which is incorrect for DT platforms.
      
      In commit 92c3807b ("net: stmmac: convert to phylink_get_linkmodes()")
      the conversion switched completely to checking for non-zero value as a
      valid value, which caused 1000base-T to stop getting advertised by
      default.
      
      Instead of trying to fix all the checks, simply leave max_speed alone if
      DT property parsing fails.
      
      Fixes: 9cbadf09 ("net: stmmac: support max-speed device tree property")
      Fixes: 92c3807b
      
       ("net: stmmac: convert to phylink_get_linkmodes()")
      Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
      Acked-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Reviewed-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20220331184832.16316-1-wens@kernel.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      02ab4abe
    • Nikolay Aleksandrov's avatar
      net: ipv4: fix route with nexthop object delete warning · 63ea5747
      Nikolay Aleksandrov authored
      [ Upstream commit 6bf92d70 ]
      
      FRR folks have hit a kernel warning[1] while deleting routes[2] which is
      caused by trying to delete a route pointing to a nexthop id without
      specifying nhid but matching on an interface. That is, a route is found
      but we hit a warning while matching it. The warning is from
      fib_info_nh() in include/net/nexthop.h because we run it on a fib_info
      with nexthop object. The call chain is:
       inet_rtm_delroute -> fib_table_delete -> fib_nh_match (called with a
      nexthop fib_info and also with fc_oif set thus calling fib_info_nh on
      the fib_info and triggering the warning). The fix is to not do any
      matching in that branch if the fi has a nexthop object because those are
      managed separately. I.e. we should match when deleting without nh spec and
      should fail when deleting a nexthop route with old-style nh spec because
      nexthop objects are managed separately, e.g.:
       $ ip r show 1.2.3.4/32
       1.2.3.4 nhid 12 via 192.168.11.2 dev dummy0
      
       $ ip r del 1.2.3.4/32
       $ ip r del 1.2.3.4/32 nhid 12
       <both should work>
      
       $ ip r del 1.2.3.4/32 dev dummy0
       <should fail with ESRCH>
      
      [1]
       [  523.462226] ------------[ cut here ]------------
       [  523.462230] WARNING: CPU: 14 PID: 22893 at include/net/nexthop.h:468 fib_nh_match+0x210/0x460
       [  523.462236] Modules linked in: dummy rpcsec_gss_krb5 xt_socket nf_socket_ipv4 nf_socket_ipv6 ip6table_raw iptable_raw bpf_preload xt_statistic ip_set ip_vs_sh ip_vs_wrr ip_vs_rr ip_vs xt_mark nf_tables xt_nat veth nf_conntrack_netlink nfnetlink xt_addrtype br_netfilter overlay dm_crypt nfsv3 nfs fscache netfs vhost_net vhost vhost_iotlb tap tun xt_CHECKSUM xt_MASQUERADE xt_conntrack 8021q garp mrp ipt_REJECT nf_reject_ipv4 ip6table_mangle ip6table_nat iptable_mangle iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_filter bridge stp llc rfcomm snd_seq_dummy snd_hrtimer rpcrdma rdma_cm iw_cm ib_cm ib_core ip6table_filter xt_comment ip6_tables vboxnetadp(OE) vboxnetflt(OE) vboxdrv(OE) qrtr bnep binfmt_misc xfs vfat fat squashfs loop nvidia_drm(POE) nvidia_modeset(POE) nvidia_uvm(POE) nvidia(POE) intel_rapl_msr intel_rapl_common snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio snd_hda_codec_hdmi btusb btrtl iwlmvm uvcvideo btbcm snd_hda_intel edac_mce_amd
       [  523.462274]  videobuf2_vmalloc videobuf2_memops btintel snd_intel_dspcfg videobuf2_v4l2 snd_intel_sdw_acpi bluetooth snd_usb_audio snd_hda_codec mac80211 snd_usbmidi_lib joydev snd_hda_core videobuf2_common kvm_amd snd_rawmidi snd_hwdep snd_seq videodev ccp snd_seq_device libarc4 ecdh_generic mc snd_pcm kvm iwlwifi snd_timer drm_kms_helper snd cfg80211 cec soundcore irqbypass rapl wmi_bmof i2c_piix4 rfkill k10temp pcspkr acpi_cpufreq nfsd auth_rpcgss nfs_acl lockd grace sunrpc drm zram ip_tables crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel nvme sp5100_tco r8169 nvme_core wmi ipmi_devintf ipmi_msghandler fuse
       [  523.462300] CPU: 14 PID: 22893 Comm: ip Tainted: P           OE     5.16.18-200.fc35.x86_64 #1
       [  523.462302] Hardware name: Micro-Star International Co., Ltd. MS-7C37/MPG X570 GAMING EDGE WIFI (MS-7C37), BIOS 1.C0 10/29/2020
       [  523.462303] RIP: 0010:fib_nh_match+0x210/0x460
       [  523.462304] Code: 7c 24 20 48 8b b5 90 00 00 00 e8 bb ee f4 ff 48 8b 7c 24 20 41 89 c4 e8 ee eb f4 ff 45 85 e4 0f 85 2e fe ff ff e9 4c ff ff ff <0f> 0b e9 17 ff ff ff 3c 0a 0f 85 61 fe ff ff 48 8b b5 98 00 00 00
       [  523.462306] RSP: 0018:ffffaa53d4d87928 EFLAGS: 00010286
       [  523.462307] RAX: 0000000000000000 RBX: ffffaa53d4d87a90 RCX: ffffaa53d4d87bb0
       [  523.462308] RDX: ffff9e3d2ee6be80 RSI: ffffaa53d4d87a90 RDI: ffffffff920ed380
       [  523.462309] RBP: ffff9e3d2ee6be80 R08: 0000000000000064 R09: 0000000000000000
       [  523.462310] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000031
       [  523.462310] R13: 0000000000000020 R14: 0000000000000000 R15: ffff9e3d331054e0
       [  523.462311] FS:  00007f245517c1c0(0000) GS:ffff9e492ed80000(0000) knlGS:0000000000000000
       [  523.462313] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       [  523.462313] CR2: 000055e5dfdd8268 CR3: 00000003ef488000 CR4: 0000000000350ee0
       [  523.462315] Call Trace:
       [  523.462316]  <TASK>
       [  523.462320]  fib_table_delete+0x1a9/0x310
       [  523.462323]  inet_rtm_delroute+0x93/0x110
       [  523.462325]  rtnetlink_rcv_msg+0x133/0x370
       [  523.462327]  ? _copy_to_iter+0xb5/0x6f0
       [  523.462330]  ? rtnl_calcit.isra.0+0x110/0x110
       [  523.462331]  netlink_rcv_skb+0x50/0xf0
       [  523.462334]  netlink_unicast+0x211/0x330
       [  523.462336]  netlink_sendmsg+0x23f/0x480
       [  523.462338]  sock_sendmsg+0x5e/0x60
       [  523.462340]  ____sys_sendmsg+0x22c/0x270
       [  523.462341]  ? import_iovec+0x17/0x20
       [  523.462343]  ? sendmsg_copy_msghdr+0x59/0x90
       [  523.462344]  ? __mod_lruvec_page_state+0x85/0x110
       [  523.462348]  ___sys_sendmsg+0x81/0xc0
       [  523.462350]  ? netlink_seq_start+0x70/0x70
       [  523.462352]  ? __dentry_kill+0x13a/0x180
       [  523.462354]  ? __fput+0xff/0x250
       [  523.462356]  __sys_sendmsg+0x49/0x80
       [  523.462358]  do_syscall_64+0x3b/0x90
       [  523.462361]  entry_SYSCALL_64_after_hwframe+0x44/0xae
       [  523.462364] RIP: 0033:0x7f24552aa337
       [  523.462365] Code: 0e 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b9 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 89 54 24 1c 48 89 74 24 10
       [  523.462366] RSP: 002b:00007fff7f05a838 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
       [  523.462368] RAX: ffffffffffffffda RBX: 000000006245bf91 RCX: 00007f24552aa337
       [  523.462368] RDX: 0000000000000000 RSI: 00007fff7f05a8a0 RDI: 0000000000000003
       [  523.462369] RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
       [  523.462370] R10: 0000000000000008 R11: 0000000000000246 R12: 0000000000000001
       [  523.462370] R13: 00007fff7f05ce08 R14: 0000000000000000 R15: 000055e5dfdd1040
       [  523.462373]  </TASK>
       [  523.462374] ---[ end trace ba537bc16f6bf4ed ]---
      
      [2] https://github.com/FRRouting/frr/issues/6412
      
      Fixes: 4c7e8084
      
       ("ipv4: Plumb support for nexthop object in a fib_info")
      Signed-off-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      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>
      63ea5747
    • Ivan Vecera's avatar
      ice: Clear default forwarding VSI during VSI release · 4be6ed03
      Ivan Vecera authored
      [ Upstream commit bd8c624c ]
      
      VSI is set as default forwarding one when promisc mode is set for
      PF interface, when PF is switched to switchdev mode or when VF
      driver asks to enable allmulticast or promisc mode for the VF
      interface (when vf-true-promisc-support priv flag is off).
      The third case is buggy because in that case VSI associated with
      VF remains as default one after VF removal.
      
      Reproducer:
      1. Create VF
         echo 1 > sys/class/net/ens7f0/device/sriov_numvfs
      2. Enable allmulticast or promisc mode on VF
         ip link set ens7f0v0 allmulticast on
         ip link set ens7f0v0 promisc on
      3. Delete VF
         echo 0 > sys/class/net/ens7f0/device/sriov_numvfs
      4. Try to enable promisc mode on PF
         ip link set ens7f0 promisc on
      
      Although it looks that promisc mode on PF is enabled the opposite
      is true because ice_vsi_sync_fltr() responsible for IFF_PROMISC
      handling first checks if any other VSI is set as default forwarding
      one and if so the function does not do anything. At this point
      it is not possible to enable promisc mode on PF without re-probe
      device.
      
      To resolve the issue this patch clear default forwarding VSI
      during ice_vsi_release() when the VSI to be released is the default
      one.
      
      Fixes: 01b5e89a
      
       ("ice: Add VF promiscuous support")
      Signed-off-by: default avatarIvan Vecera <ivecera@redhat.com>
      Reviewed-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
      Reviewed-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Signed-off-by: default avatarAlice Michael <alice.michael@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4be6ed03
    • Ziyang Xuan's avatar
      net/tls: fix slab-out-of-bounds bug in decrypt_internal · 589154d0
      Ziyang Xuan authored
      [ Upstream commit 9381fe8c ]
      
      The memory size of tls_ctx->rx.iv for AES128-CCM is 12 setting in
      tls_set_sw_offload(). The return value of crypto_aead_ivsize()
      for "ccm(aes)" is 16. So memcpy() require 16 bytes from 12 bytes
      memory space will trigger slab-out-of-bounds bug as following:
      
      ==================================================================
      BUG: KASAN: slab-out-of-bounds in decrypt_internal+0x385/0xc40 [tls]
      Read of size 16 at addr ffff888114e84e60 by task tls/10911
      
      Call Trace:
       <TASK>
       dump_stack_lvl+0x34/0x44
       print_report.cold+0x5e/0x5db
       ? decrypt_internal+0x385/0xc40 [tls]
       kasan_report+0xab/0x120
       ? decrypt_internal+0x385/0xc40 [tls]
       kasan_check_range+0xf9/0x1e0
       memcpy+0x20/0x60
       decrypt_internal+0x385/0xc40 [tls]
       ? tls_get_rec+0x2e0/0x2e0 [tls]
       ? process_rx_list+0x1a5/0x420 [tls]
       ? tls_setup_from_iter.constprop.0+0x2e0/0x2e0 [tls]
       decrypt_skb_update+0x9d/0x400 [tls]
       tls_sw_recvmsg+0x3c8/0xb50 [tls]
      
      Allocated by task 10911:
       kasan_save_stack+0x1e/0x40
       __kasan_kmalloc+0x81/0xa0
       tls_set_sw_offload+0x2eb/0xa20 [tls]
       tls_setsockopt+0x68c/0x700 [tls]
       __sys_setsockopt+0xfe/0x1b0
      
      Replace the crypto_aead_ivsize() with prot->iv_size + prot->salt_size
      when memcpy() iv value in TLS_1_3_VERSION scenario.
      
      Fixes: f295b3ae
      
       ("net/tls: Add support of AES128-CCM based ciphers")
      Signed-off-by: default avatarZiyang Xuan <william.xuanziyang@huawei.com>
      Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      589154d0
    • Christophe JAILLET's avatar
      scsi: zorro7xx: Fix a resource leak in zorro7xx_remove_one() · c5f77b59
      Christophe JAILLET authored
      [ Upstream commit 16ed828b ]
      
      The error handling path of the probe releases a resource that is not freed
      in the remove function. In some cases, a ioremap() must be undone.
      
      Add the missing iounmap() call in the remove function.
      
      Link: https://lore.kernel.org/r/247066a3104d25f9a05de8b3270fc3c848763bcc.1647673264.git.christophe.jaillet@wanadoo.fr
      Fixes: 45804fbb
      
       ("[SCSI] 53c700: Amiga Zorro NCR53c710 SCSI")
      Reviewed-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c5f77b59
    • ChenXiaoSong's avatar
      NFSv4: fix open failure with O_ACCMODE flag · 45b9932b
      ChenXiaoSong authored
      [ Upstream commit b243874f ]
      
      open() with O_ACCMODE|O_DIRECT flags secondly will fail.
      
      Reproducer:
        1. mount -t nfs -o vers=4.2 $server_ip:/ /mnt/
        2. fd = open("/mnt/file", O_ACCMODE|O_DIRECT|O_CREAT)
        3. close(fd)
        4. fd = open("/mnt/file", O_ACCMODE|O_DIRECT)
      
      Server nfsd4_decode_share_access() will fail with error nfserr_bad_xdr when
      client use incorrect share access mode of 0.
      
      Fix this by using NFS4_SHARE_ACCESS_BOTH share access mode in client,
      just like firstly opening.
      
      Fixes: ce4ef7c0
      
       ("NFS: Split out NFS v4 file operations")
      Signed-off-by: default avatarChenXiaoSong <chenxiaosong2@huawei.com>
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      45b9932b