Skip to content
  1. Dec 14, 2023
    • Petr Pavlu's avatar
      tracing: Fix a warning when allocating buffered events fails · a28083d4
      Petr Pavlu authored
      [ Upstream commit 34209fe8 ]
      
      Function trace_buffered_event_disable() produces an unexpected warning
      when the previous call to trace_buffered_event_enable() fails to
      allocate pages for buffered events.
      
      The situation can occur as follows:
      
      * The counter trace_buffered_event_ref is at 0.
      
      * The soft mode gets enabled for some event and
        trace_buffered_event_enable() is called. The function increments
        trace_buffered_event_ref to 1 and starts allocating event pages.
      
      * The allocation fails for some page and trace_buffered_event_disable()
        is called for cleanup.
      
      * Function trace_buffered_event_disable() decrements
        trace_buffered_event_ref back to 0, recognizes that it was the last
        use of buffered events and frees all allocated pages.
      
      * The control goes back to trace_buffered_event_enable() which returns.
        The caller of trace_buffered_event_enable() has no information that
        the function actually failed.
      
      * Some time later, the soft mode is disabled for the same event.
        Function trace_buffered_event_disable() is called. It warns on
        "WARN_ON_ONCE(!trace_buffered_event_ref)" and returns.
      
      Buffered events are just an optimization and can handle failures. Make
      trace_buffered_event_enable() exit on the first failure and left any
      cleanup later to when trace_buffered_event_disable() is called.
      
      Link: https://lore.kernel.org/all/20231127151248.7232-2-petr.pavlu@suse.com/
      Link: https://lkml.kernel.org/r/20231205161736.19663-3-petr.pavlu@suse.com
      
      Fixes: 0fc1b09f
      
       ("tracing: Use temp buffer when filtering events")
      Signed-off-by: default avatarPetr Pavlu <petr.pavlu@suse.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a28083d4
    • Dinghao Liu's avatar
      ASoC: wm_adsp: fix memleak in wm_adsp_buffer_populate · 888580bf
      Dinghao Liu authored
      [ Upstream commit 29046a78 ]
      
      When wm_adsp_buffer_read() fails, we should free buf->regions.
      Otherwise, the callers of wm_adsp_buffer_populate() will
      directly free buf on failure, which makes buf->regions a leaked
      memory.
      
      Fixes: a792af69
      
       ("ASoC: wm_adsp: Refactor compress stream initialisation")
      Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
      Reviewed-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
      Link: https://lore.kernel.org/r/20231204074158.12026-1-dinghao.liu@zju.edu.cn
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      888580bf
    • Armin Wolf's avatar
      hwmon: (acpi_power_meter) Fix 4.29 MW bug · 9dfd8624
      Armin Wolf authored
      [ Upstream commit 1fefca6c
      
       ]
      
      The ACPI specification says:
      
      "If an error occurs while obtaining the meter reading or if the value
      is not available then an Integer with all bits set is returned"
      
      Since the "integer" is 32 bits in case of the ACPI power meter,
      userspace will get a power reading of 2^32 * 1000 miliwatts (~4.29 MW)
      in case of such an error. This was discovered due to a lm_sensors
      bugreport (https://github.com/lm-sensors/lm-sensors/issues/460).
      Fix this by returning -ENODATA instead.
      
      Tested-by: default avatar <urbinek@gmail.com>
      Fixes: de584afa
      
       ("hwmon driver for ACPI 4.0 power meters")
      Signed-off-by: default avatarArmin Wolf <W_Armin@gmx.de>
      Link: https://lore.kernel.org/r/20231124182747.13956-1-W_Armin@gmx.de
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9dfd8624
    • Kalesh AP's avatar
      RDMA/bnxt_re: Correct module description string · c0a42824
      Kalesh AP authored
      [ Upstream commit 422b19f7 ]
      
      The word "Driver" is repeated twice in the "modinfo bnxt_re"
      output description. Fix it.
      
      Fixes: 1ac5a404
      
       ("RDMA/bnxt_re: Add bnxt_re RoCE driver")
      Signed-off-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Signed-off-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
      Link: https://lore.kernel.org/r/1700555387-6277-1-git-send-email-selvin.xavier@broadcom.com
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c0a42824
    • Jack Wang's avatar
      RDMA/rtrs-clt: Remove the warnings for req in_use check · 58a7281f
      Jack Wang authored
      [ Upstream commit 0c8bb6eb ]
      
      As we chain the WR during write request: memory registration,
      rdma write, local invalidate, if only the last WR fail to send due
      to send queue overrun, the server can send back the reply, while
      client mark the req->in_use to false in case of error in rtrs_clt_req
      when error out from rtrs_post_rdma_write_sg.
      
      Fixes: 6a98d71d
      
       ("RDMA/rtrs: client: main functionality")
      Signed-off-by: default avatarJack Wang <jinpu.wang@ionos.com>
      Reviewed-by: default avatarMd Haris Iqbal <haris.iqbal@ionos.com>
      Signed-off-by: default avatarGrzegorz Prajsner <grzegorz.prajsner@ionos.com>
      Link: https://lore.kernel.org/r/20231120154146.920486-8-haris.iqbal@ionos.com
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      58a7281f
    • Alex Bee's avatar
      arm64: dts: rockchip: Expand reg size of vdec node for RK3399 · 02916f39
      Alex Bee authored
      [ Upstream commit 35938c18 ]
      
      Expand the reg size for the vdec node to include cache/performance
      registers the rkvdec driver writes to. Also add missing clocks to the
      related power-domain.
      
      Fixes: cbd72144
      
       ("arm64: dts: rockchip: Define the rockchip Video Decoder node on rk3399")
      Signed-off-by: default avatarAlex Bee <knaerzche@gmail.com>
      Signed-off-by: default avatarJonas Karlman <jonas@kwiboo.se>
      Link: https://lore.kernel.org/r/20231105233630.3927502-10-jonas@kwiboo.se
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      02916f39
    • Sumit Garg's avatar
      tee: optee: Fix supplicant based device enumeration · a953e45e
      Sumit Garg authored
      [ Upstream commit 7269cba5
      
       ]
      
      Currently supplicant dependent optee device enumeration only registers
      devices whenever tee-supplicant is invoked for the first time. But it
      forgets to remove devices when tee-supplicant daemon stops running and
      closes its context gracefully. This leads to following error for fTPM
      driver during reboot/shutdown:
      
      [   73.466791] tpm tpm0: ftpm_tee_tpm_op_send: SUBMIT_COMMAND invoke error: 0xffff3024
      
      Fix this by adding an attribute for supplicant dependent devices so that
      the user-space service can detect and detach supplicant devices before
      closing the supplicant:
      
      $ for dev in /sys/bus/tee/devices/*; do if [[ -f "$dev/need_supplicant" && -f "$dev/driver/unbind" ]]; \
            then echo $(basename "$dev") > $dev/driver/unbind; fi done
      
      Reported-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
      Closes: https://github.com/OP-TEE/optee_os/issues/6094
      Fixes: 5f178bb7
      
       ("optee: enable support for multi-stage bus enumeration")
      Signed-off-by: default avatarSumit Garg <sumit.garg@linaro.org>
      Reviewed-by: default avatarIlias Apalodimas <ilias.apalodimas@linaro.org>
      Acked-by: default avatarJerome Forissier <jerome.forissier@linaro.org>
      [jw: fixed up Date documentation]
      Signed-off-by: default avatarJens Wiklander <jens.wiklander@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a953e45e
    • John Fastabend's avatar
      bpf: sockmap, updating the sg structure should also update curr · 3c852b26
      John Fastabend authored
      [ Upstream commit bb9aefde ]
      
      Curr pointer should be updated when the sg structure is shifted.
      
      Fixes: 7246d8ed
      
       ("bpf: helper to pop data from messages")
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Link: https://lore.kernel.org/r/20231206232706.374377-3-john.fastabend@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3c852b26
    • Eric Dumazet's avatar
      tcp: do not accept ACK of bytes we never sent · b17a886e
      Eric Dumazet authored
      [ Upstream commit 3d501dd3 ]
      
      This patch is based on a detailed report and ideas from Yepeng Pan
      and Christian Rossow.
      
      ACK seq validation is currently following RFC 5961 5.2 guidelines:
      
         The ACK value is considered acceptable only if
         it is in the range of ((SND.UNA - MAX.SND.WND) <= SEG.ACK <=
         SND.NXT).  All incoming segments whose ACK value doesn't satisfy the
         above condition MUST be discarded and an ACK sent back.  It needs to
         be noted that RFC 793 on page 72 (fifth check) says: "If the ACK is a
         duplicate (SEG.ACK < SND.UNA), it can be ignored.  If the ACK
         acknowledges something not yet sent (SEG.ACK > SND.NXT) then send an
         ACK, drop the segment, and return".  The "ignored" above implies that
         the processing of the incoming data segment continues, which means
         the ACK value is treated as acceptable.  This mitigation makes the
         ACK check more stringent since any ACK < SND.UNA wouldn't be
         accepted, instead only ACKs that are in the range ((SND.UNA -
         MAX.SND.WND) <= SEG.ACK <= SND.NXT) get through.
      
      This can be refined for new (and possibly spoofed) flows,
      by not accepting ACK for bytes that were never sent.
      
      This greatly improves TCP security at a little cost.
      
      I added a Fixes: tag to make sure this patch will reach stable trees,
      even if the 'blamed' patch was adhering to the RFC.
      
      tp->bytes_acked was added in linux-4.2
      
      Following packetdrill test (courtesy of Yepeng Pan) shows
      the issue at hand:
      
      0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
      +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
      +0 bind(3, ..., ...) = 0
      +0 listen(3, 1024) = 0
      
      // ---------------- Handshake ------------------- //
      
      // when window scale is set to 14 the window size can be extended to
      // 65535 * (2^14) = 1073725440. Linux would accept an ACK packet
      // with ack number in (Server_ISN+1-1073725440. Server_ISN+1)
      // ,though this ack number acknowledges some data never
      // sent by the server.
      
      +0 < S 0:0(0) win 65535 <mss 1400,nop,wscale 14>
      +0 > S. 0:0(0) ack 1 <...>
      +0 < . 1:1(0) ack 1 win 65535
      +0 accept(3, ..., ...) = 4
      
      // For the established connection, we send an ACK packet,
      // the ack packet uses ack number 1 - 1073725300 + 2^32,
      // where 2^32 is used to wrap around.
      // Note: we used 1073725300 instead of 1073725440 to avoid possible
      // edge cases.
      // 1 - 1073725300 + 2^32 = 3221241997
      
      // Oops, old kernels happily accept this packet.
      +0 < . 1:1001(1000) ack 3221241997 win 65535
      
      // After the kernel fix the following will be replaced by a challenge ACK,
      // and prior malicious frame would be dropped.
      +0 > . 1:1(0) ack 1001
      
      Fixes: 354e4aa3
      
       ("tcp: RFC 5961 5.2 Blind Data Injection Attack Mitigation")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarYepeng Pan <yepeng.pan@cispa.de>
      Reported-by: default avatarChristian Rossow <rossow@cispa.de>
      Acked-by: default avatarNeal Cardwell <ncardwell@google.com>
      Link: https://lore.kernel.org/r/20231205161841.2702925-1-edumazet@google.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b17a886e
    • Phil Sutter's avatar
      netfilter: xt_owner: Fix for unsafe access of sk->sk_socket · f1a6a949
      Phil Sutter authored
      [ Upstream commit 7ae836a3 ]
      
      A concurrently running sock_orphan() may NULL the sk_socket pointer in
      between check and deref. Follow other users (like nft_meta.c for
      instance) and acquire sk_callback_lock before dereferencing sk_socket.
      
      Fixes: 0265ab44
      
       ("[NETFILTER]: merge ipt_owner/ip6t_owner in xt_owner")
      Reported-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarPhil Sutter <phil@nwl.cc>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f1a6a949
    • Yonglong Liu's avatar
      net: hns: fix fake link up on xge port · e94b6e96
      Yonglong Liu authored
      [ Upstream commit f708aba4 ]
      
      If a xge port just connect with an optical module and no fiber,
      it may have a fake link up because there may be interference on
      the hardware. This patch adds an anti-shake to avoid the problem.
      And the time of anti-shake is base on tests.
      
      Fixes: b917078c
      
       ("net: hns: Add ACPI support to check SFP present")
      Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
      Signed-off-by: default avatarJijie Shao <shaojijie@huawei.com>
      Reviewed-by: default avatarWojciech Drewek <wojciech.drewek@intel.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e94b6e96
    • Shigeru Yoshida's avatar
      ipv4: ip_gre: Avoid skb_pull() failure in ipgre_xmit() · f2535683
      Shigeru Yoshida authored
      [ Upstream commit 80d875cf ]
      
      In ipgre_xmit(), skb_pull() may fail even if pskb_inet_may_pull() returns
      true. For example, applications can use PF_PACKET to create a malformed
      packet with no IP header. This type of packet causes a problem such as
      uninit-value access.
      
      This patch ensures that skb_pull() can pull the required size by checking
      the skb with pskb_network_may_pull() before skb_pull().
      
      Fixes: c5441932
      
       ("GRE: Refactor GRE tunneling code.")
      Signed-off-by: default avatarShigeru Yoshida <syoshida@redhat.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarSuman Ghosh <sumang@marvell.com>
      Link: https://lore.kernel.org/r/20231202161441.221135-1-syoshida@redhat.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f2535683
    • Brett Creeley's avatar
      ionic: Fix dim work handling in split interrupt mode · 860d53a3
      Brett Creeley authored
      [ Upstream commit 4115ba67 ]
      
      Currently ionic_dim_work() is incorrect when in
      split interrupt mode. This is because the interrupt
      rate is only being changed for the Rx side even for
      dim running on Tx. Fix this by using the qcq from
      the container_of macro. Also, introduce some local
      variables for a bit of cleanup.
      
      Fixes: a6ff85e0
      
       ("ionic: remove intr coalesce update from napi")
      Signed-off-by: default avatarBrett Creeley <brett.creeley@amd.com>
      Signed-off-by: default avatarShannon Nelson <shannon.nelson@amd.com>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Link: https://lore.kernel.org/r/20231204192234.21017-3-shannon.nelson@amd.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      860d53a3
    • Shannon Nelson's avatar
      ionic: fix snprintf format length warning · b41bf6ac
      Shannon Nelson authored
      [ Upstream commit 0ceb3860 ]
      
      Our friendly kernel test robot has reminded us that with a new
      check we have a warning about a potential string truncation.
      In this case it really doesn't hurt anything, but it is worth
      addressing especially since there really is no reason to reserve
      so many bytes for our queue names.  It seems that cutting the
      queue name buffer length in half stops the complaint.
      
      Fixes: c06107ca
      
       ("ionic: more ionic name tweaks")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Closes: https://lore.kernel.org/oe-kbuild-all/202311300201.lO8v7mKU-lkp@intel.com/
      Signed-off-by: default avatarShannon Nelson <shannon.nelson@amd.com>
      Reviewed-by: default avatarBrett Creeley <brett.creeley@amd.com>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Link: https://lore.kernel.org/r/20231204192234.21017-2-shannon.nelson@amd.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b41bf6ac
    • Dinghao Liu's avatar
      net: bnxt: fix a potential use-after-free in bnxt_init_tc · 49809af8
      Dinghao Liu authored
      [ Upstream commit d007caaa ]
      
      When flow_indr_dev_register() fails, bnxt_init_tc will free
      bp->tc_info through kfree(). However, the caller function
      bnxt_init_one() will ignore this failure and call
      bnxt_shutdown_tc() on failure of bnxt_dl_register(), where
      a use-after-free happens. Fix this issue by setting
      bp->tc_info to NULL after kfree().
      
      Fixes: 627c89d0
      
       ("bnxt_en: flow_offload: offload tunnel decap rules via indirect callbacks")
      Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Reviewed-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Reviewed-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
      Link: https://lore.kernel.org/r/20231204024004.8245-1-dinghao.liu@zju.edu.cn
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      49809af8
    • Ivan Vecera's avatar
      i40e: Fix unexpected MFS warning message · 2093072e
      Ivan Vecera authored
      [ Upstream commit 7d9f22b3 ]
      
      Commit 3a2c6ced ("i40e: Add a check to see if MFS is set") added
      a warning message that reports unexpected size of port's MFS (max
      frame size) value. This message use for the port number local
      variable 'i' that is wrong.
      In i40e_probe() this 'i' variable is used only to iterate VSIs
      to find FDIR VSI:
      
      <code>
      ...
      /* if FDIR VSI was set up, start it now */
              for (i = 0; i < pf->num_alloc_vsi; i++) {
                      if (pf->vsi[i] && pf->vsi[i]->type == I40E_VSI_FDIR) {
                              i40e_vsi_open(pf->vsi[i]);
                              break;
                      }
              }
      ...
      </code>
      
      So the warning message use for the port number index of FDIR VSI
      if this exists or pf->num_alloc_vsi if not.
      
      Fix the message by using 'pf->hw.port' for the port number.
      
      Fixes: 3a2c6ced
      
       ("i40e: Add a check to see if MFS is set")
      Signed-off-by: default avatarIvan Vecera <ivecera@redhat.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2093072e
    • Thomas Reichinger's avatar
      arcnet: restoring support for multiple Sohard Arcnet cards · d54f5a5b
      Thomas Reichinger authored
      [ Upstream commit 6b17a597 ]
      
      Probe of Sohard Arcnet cards fails,
      if 2 or more cards are installed in a system.
      See kernel log:
      [    2.759203] arcnet: arcnet loaded
      [    2.763648] arcnet:com20020: COM20020 chipset support (by David Woodhouse et al.)
      [    2.770585] arcnet:com20020_pci: COM20020 PCI support
      [    2.772295] com20020 0000:02:00.0: enabling device (0000 -> 0003)
      [    2.772354] (unnamed net_device) (uninitialized): PLX-PCI Controls
      ...
      [    3.071301] com20020 0000:02:00.0 arc0-0 (uninitialized): PCI COM20020: station FFh found at F080h, IRQ 101.
      [    3.071305] com20020 0000:02:00.0 arc0-0 (uninitialized): Using CKP 64 - data rate 2.5 Mb/s
      [    3.071534] com20020 0000:07:00.0: enabling device (0000 -> 0003)
      [    3.071581] (unnamed net_device) (uninitialized): PLX-PCI Controls
      ...
      [    3.369501] com20020 0000:07:00.0: Led pci:green:tx:0-0 renamed to pci:green:tx:0-0_1 due to name collision
      [    3.369535] com20020 0000:07:00.0: Led pci:red:recon:0-0 renamed to pci:red:recon:0-0_1 due to name collision
      [    3.370586] com20020 0000:07:00.0 arc0-0 (uninitialized): PCI COM20020: station E1h found at C000h, IRQ 35.
      [    3.370589] com20020 0000:07:00.0 arc0-0 (uninitialized): Using CKP 64 - data rate 2.5 Mb/s
      [    3.370608] com20020: probe of 0000:07:00.0 failed with error -5
      
      commit 5ef216c1
      
       ("arcnet: com20020-pci: add rotary index support")
      changes the device name of all COM20020 based PCI cards,
      even if only some cards support this:
      	snprintf(dev->name, sizeof(dev->name), "arc%d-%d", dev->dev_id, i);
      
      The error happens because all Sohard Arcnet cards would be called arc0-0,
      since the Sohard Arcnet cards don't have a PLX rotary coder.
      I.e. EAE Arcnet cards have a PLX rotary coder,
      which sets the first decimal, ensuring unique devices names.
      
      This patch adds two new card feature flags to indicate
      which cards support LEDs and the PLX rotary coder.
      For EAE based cards the names still depend on the PLX rotary coder
      (untested, since missing EAE hardware).
      For Sohard based cards, this patch will result in devices
      being called arc0, arc1, ... (tested).
      
      Signed-off-by: default avatarThomas Reichinger <thomas.reichinger@sohard.de>
      Fixes: 5ef216c1
      
       ("arcnet: com20020-pci: add rotary index support")
      Link: https://lore.kernel.org/r/20231130113503.6812-1-thomas.reichinger@sohard.de
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d54f5a5b
    • Tong Zhang's avatar
      net: arcnet: com20020 fix error handling · effb9ad0
      Tong Zhang authored
      [ Upstream commit 6577b9a5
      
       ]
      
      There are two issues when handling error case in com20020pci_probe()
      
      1. priv might be not initialized yet when calling com20020pci_remove()
      from com20020pci_probe(), since the priv is set at the very last but it
      can jump to error handling in the middle and priv remains NULL.
      2. memory leak - the net device is allocated in alloc_arcdev but not
      properly released if error happens in the middle of the big for loop
      
      [    1.529110] BUG: kernel NULL pointer dereference, address: 0000000000000008
      [    1.531447] RIP: 0010:com20020pci_remove+0x15/0x60 [com20020_pci]
      [    1.536805] Call Trace:
      [    1.536939]  com20020pci_probe+0x3f2/0x48c [com20020_pci]
      [    1.537226]  local_pci_probe+0x48/0x80
      [    1.539918]  com20020pci_init+0x3f/0x1000 [com20020_pci]
      
      Signed-off-by: default avatarTong Zhang <ztong0001@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Stable-dep-of: 6b17a597
      
       ("arcnet: restoring support for multiple Sohard Arcnet cards")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      effb9ad0
    • David Thompson's avatar
      mlxbf-bootctl: correctly identify secure boot with development keys · a657bddf
      David Thompson authored
      [ Upstream commit d4eef752 ]
      
      The secure boot state of the BlueField SoC is represented by two bits:
                      0 = production state
                      1 = secure boot enabled
                      2 = non-secure (secure boot disabled)
                      3 = RMA state
      There is also a single bit to indicate whether production keys or
      development keys are being used when secure boot is enabled.
      This single bit (specified by MLXBF_BOOTCTL_SB_DEV_MASK) only has
      meaning if secure boot state equals 1 (secure boot enabled).
      
      The secure boot states are as follows:
      - “GA secured” is when secure boot is enabled with official production keys.
      - “Secured (development)” is when secure boot is enabled with development keys.
      
      Without this fix “GA Secured” is displayed on development cards which is
      misleading. This patch updates the logic in "lifecycle_state_show()" to
      handle the case where the SoC is configured for secure boot and is using
      development keys.
      
      Fixes: 79e29cb8
      
       ("platform/mellanox: Add bootctl driver for Mellanox BlueField Soc")
      Reviewed-by: default avatarKhalil Blaiech <kblaiech@nvidia.com>
      Signed-off-by: default avatarDavid Thompson <davthompson@nvidia.com>
      Link: https://lore.kernel.org/r/20231130183515.17214-1-davthompson@nvidia.com
      Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
      Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a657bddf
    • Randy Dunlap's avatar
      hv_netvsc: rndis_filter needs to select NLS · d3f47928
      Randy Dunlap authored
      [ Upstream commit 6c89f499 ]
      
      rndis_filter uses utf8s_to_utf16s() which is provided by setting
      NLS, so select NLS to fix the build error:
      
      ERROR: modpost: "utf8s_to_utf16s" [drivers/net/hyperv/hv_netvsc.ko] undefined!
      
      Fixes: 1ce09e89
      
       ("hyperv: Add support for setting MAC from within guests")
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: K. Y. Srinivasan <kys@microsoft.com>
      Cc: Wei Liu <wei.liu@kernel.org>
      Cc: Dexuan Cui <decui@microsoft.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Tested-by: Simon Horman <horms@kernel.org> # build-tested
      Reviewed-by: default avatarMichael Kelley <mikelley@microsoft.com>
      Link: https://lore.kernel.org/r/20231130055853.19069-1-rdunlap@infradead.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d3f47928
    • Subbaraya Sundeep's avatar
      octeontx2-pf: Add missing mutex lock in otx2_get_pauseparam · 909de622
      Subbaraya Sundeep authored
      [ Upstream commit 9572c949 ]
      
      All the mailbox messages sent to AF needs to be guarded
      by mutex lock. Add the missing lock in otx2_get_pauseparam
      function.
      
      Fixes: 75f36270
      
       ("octeontx2-pf: Support to enable/disable pause frames via ethtool")
      Signed-off-by: default avatarSubbaraya Sundeep <sbhatta@marvell.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      909de622
    • Eric Dumazet's avatar
      ipv6: fix potential NULL deref in fib6_add() · 7827c180
      Eric Dumazet authored
      [ Upstream commit 75475bb5 ]
      
      If fib6_find_prefix() returns NULL, we should silently fallback
      using fib6_null_entry regardless of RT6_DEBUG value.
      
      syzbot reported:
      
      WARNING: CPU: 0 PID: 5477 at net/ipv6/ip6_fib.c:1516 fib6_add+0x310d/0x3fa0 net/ipv6/ip6_fib.c:1516
      Modules linked in:
      CPU: 0 PID: 5477 Comm: syz-executor.0 Not tainted 6.7.0-rc2-syzkaller-00029-g9b6de136b5f0 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
      RIP: 0010:fib6_add+0x310d/0x3fa0 net/ipv6/ip6_fib.c:1516
      Code: 00 48 8b 54 24 68 e8 42 22 00 00 48 85 c0 74 14 49 89 c6 e8 d5 d3 c2 f7 eb 5d e8 ce d3 c2 f7 e9 ca 00 00 00 e8 c4 d3 c2 f7 90 <0f> 0b 90 48 b8 00 00 00 00 00 fc ff df 48 8b 4c 24 38 80 3c 01 00
      RSP: 0018:ffffc90005067740 EFLAGS: 00010293
      RAX: ffffffff89cba5bc RBX: ffffc90005067ab0 RCX: ffff88801a2e9dc0
      RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
      RBP: ffffc90005067980 R08: ffffffff89cbca85 R09: 1ffff110040d4b85
      R10: dffffc0000000000 R11: ffffed10040d4b86 R12: 00000000ffffffff
      R13: 1ffff110051c3904 R14: ffff8880206a5c00 R15: ffff888028e1c820
      FS: 00007f763783c6c0(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
      CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f763783bff8 CR3: 000000007f74d000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
      <TASK>
      __ip6_ins_rt net/ipv6/route.c:1303 [inline]
      ip6_route_add+0x88/0x120 net/ipv6/route.c:3847
      ipv6_route_ioctl+0x525/0x7b0 net/ipv6/route.c:4467
      inet6_ioctl+0x21a/0x270 net/ipv6/af_inet6.c:575
      sock_do_ioctl+0x152/0x460 net/socket.c:1220
      sock_ioctl+0x615/0x8c0 net/socket.c:1339
      vfs_ioctl fs/ioctl.c:51 [inline]
      __do_sys_ioctl fs/ioctl.c:871 [inline]
      __se_sys_ioctl+0xf8/0x170 fs/ioctl.c:857
      do_syscall_x64 arch/x86/entry/common.c:51 [inline]
      do_syscall_64+0x45/0x110 arch/x86/entry/common.c:82
      
      Fixes: 7bbfe00e
      
       ("ipv6: fix general protection fault in fib6_add()")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Wei Wang <weiwan@google.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20231129160630.3509216-1-edumazet@google.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7827c180
    • Luca Ceresoli's avatar
      of: dynamic: Fix of_reconfig_get_state_change() return value documentation · ba6dc2f5
      Luca Ceresoli authored
      [ Upstream commit d7997278 ]
      
      The documented numeric return values do not match the actual returned
      values. Fix them by using the enum names instead of raw numbers.
      
      Fixes: b53a2340
      
       ("of/reconfig: Add of_reconfig_get_state_change() of notifier helper.")
      Signed-off-by: default avatarLuca Ceresoli <luca.ceresoli@bootlin.com>
      Link: https://lore.kernel.org/r/20231123-fix-of_reconfig_get_state_change-docs-v1-1-f51892050ff9@bootlin.com
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ba6dc2f5
    • Rob Herring's avatar
      of: Add missing 'Return' section in kerneldoc comments · 08dbdacb
      Rob Herring authored
      [ Upstream commit 8c8239c2
      
       ]
      
      Many of the DT kerneldoc comments are lacking a 'Return' section. Let's
      add the section in cases we have a description of return values. There's
      still some cases where the return values are not documented.
      
      Cc: Frank Rowand <frowand.list@gmail.com>
      Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Reviewed-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      Link: https://lore.kernel.org/r/20210325164713.1296407-8-robh@kernel.org
      Stable-dep-of: d7997278
      
       ("of: dynamic: Fix of_reconfig_get_state_change() return value documentation")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      08dbdacb
    • Rob Herring's avatar
      of: Fix kerneldoc output formatting · f58e3b36
      Rob Herring authored
      [ Upstream commit 62f026f0
      
       ]
      
      The indentation of the kerneldoc comments affects the output formatting.
      Leading tabs in particular don't work, sections need to be indented
      under the section header, and several code blocks are reformatted.
      
      Cc: Frank Rowand <frowand.list@gmail.com>
      Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Reviewed-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      Link: https://lore.kernel.org/r/20210326192606.3702739-1-robh@kernel.org
      Stable-dep-of: d7997278
      
       ("of: dynamic: Fix of_reconfig_get_state_change() return value documentation")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f58e3b36
    • Lee Jones's avatar
      of: base: Fix some formatting issues and provide missing descriptions · 58ccdcc9
      Lee Jones authored
      [ Upstream commit 3637d49e
      
       ]
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/of/base.c:315: warning: Function parameter or member 'cpun' not described in '__of_find_n_match_cpu_property'
       drivers/of/base.c:315: warning: Function parameter or member 'prop_name' not described in '__of_find_n_match_cpu_property'
       drivers/of/base.c:315: warning: Function parameter or member 'cpu' not described in '__of_find_n_match_cpu_property'
       drivers/of/base.c:315: warning: Function parameter or member 'thread' not described in '__of_find_n_match_cpu_property'
       drivers/of/base.c:315: warning: expecting prototype for property holds the physical id of the(). Prototype was for __of_find_n_match_cpu_property() instead
       drivers/of/base.c:1139: warning: Function parameter or member 'match' not described in 'of_find_matching_node_and_match'
       drivers/of/base.c:1779: warning: Function parameter or member 'np' not described in '__of_add_property'
       drivers/of/base.c:1779: warning: Function parameter or member 'prop' not described in '__of_add_property'
       drivers/of/base.c:1800: warning: Function parameter or member 'np' not described in 'of_add_property'
       drivers/of/base.c:1800: warning: Function parameter or member 'prop' not described in 'of_add_property'
       drivers/of/base.c:1849: warning: Function parameter or member 'np' not described in 'of_remove_property'
       drivers/of/base.c:1849: warning: Function parameter or member 'prop' not described in 'of_remove_property'
       drivers/of/base.c:2137: warning: Function parameter or member 'dn' not described in 'of_console_check'
       drivers/of/base.c:2137: warning: Function parameter or member 'name' not described in 'of_console_check'
       drivers/of/base.c:2137: warning: Function parameter or member 'index' not described in 'of_console_check'
      
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Frank Rowand <frowand.list@gmail.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: devicetree@vger.kernel.org
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Link: https://lore.kernel.org/r/20210318104036.3175910-5-lee.jones@linaro.org
      Stable-dep-of: d7997278
      
       ("of: dynamic: Fix of_reconfig_get_state_change() return value documentation")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      58ccdcc9
    • Hans de Goede's avatar
      platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code · 7db515e8
      Hans de Goede authored
      [ Upstream commit b52cbca2 ]
      
      asus-nb-wmi calls i8042_install_filter() in some cases, but it never
      calls i8042_remove_filter(). This means that a dangling pointer to
      the filter function is left after rmmod leading to crashes.
      
      Fix this by moving the i8042-filter installation to the shared
      asus-wmi code and also remove it from the shared code on driver unbind.
      
      Fixes: b5643539
      
       ("platform/x86: asus-wmi: Filter buggy scan codes on ASUS Q500A")
      Cc: Oleksij Rempel <linux@rempel-privat.de>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20231120154235.610808-2-hdegoede@redhat.com
      Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
      Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7db515e8
    • Hans de Goede's avatar
      platform/x86: asus-wmi: Simplify tablet-mode-switch handling · 5fe052b8
      Hans de Goede authored
      [ Upstream commit 1ea0d3b4
      
       ]
      
      Simplify tablet-mode-switch handling:
      1. The code is the same for all variants, the only difference is the
         dev_id and notify event code. Store the dev_id + code in struct asus_wmi
         and unify the handling
      2. Make the new unified asus_wmi_tablet_mode_get_state() check dev_id has
         been set and make it a no-op when not set. This allows calling it
         unconditionally at resume/restore time
      3. Simplify the tablet_mode_sw module-param handling, this also allows
         selecting the new lid-flip-rog type through the module-param.
      
      Cc: Luke D. Jones <luke@ljones.dev>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20220824151145.1448010-2-hdegoede@redhat.com
      Stable-dep-of: b52cbca2
      
       ("platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5fe052b8
    • Hans de Goede's avatar
      platform/x86: asus-wmi: Simplify tablet-mode-switch probing · a113da75
      Hans de Goede authored
      [ Upstream commit c98dc61e
      
       ]
      
      The 3 different tablet-mode-switch initialization paths repeat a lot
      of the same code. Add a helper function for this.
      
      This also makes the error-handling for the kbd_dock_devid case consistent
      with the other 2 cases.
      
      Cc: Luke D. Jones <luke@ljones.dev>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20220824151145.1448010-1-hdegoede@redhat.com
      Stable-dep-of: b52cbca2
      
       ("platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a113da75
    • Luke D. Jones's avatar
      platform/x86: asus-wmi: Add support for ROG X13 tablet mode · 68b795d0
      Luke D. Jones authored
      [ Upstream commit e397c3c4
      
       ]
      
      Add quirk for ASUS ROG X13 Flow 2-in-1 to enable tablet mode with
      lid flip (all screen rotations).
      
      Signed-off-by: default avatarLuke D. Jones <luke@ljones.dev>
      Link: https://lore.kernel.org/r/20220813092753.6635-2-luke@ljones.dev
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Stable-dep-of: b52cbca2
      
       ("platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      68b795d0
    • Luke D. Jones's avatar
      platform/x86: asus-wmi: Adjust tablet/lidflip handling to use enum · 97620a08
      Luke D. Jones authored
      [ Upstream commit 00aa8469
      
       ]
      
      Due to multiple types of tablet/lidflip, the existing code for
      handling these events is refactored to use an enum for each type.
      
      Signed-off-by: default avatarLuke D. Jones <luke@ljones.dev>
      Link: https://lore.kernel.org/r/20220813092753.6635-1-luke@ljones.dev
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Stable-dep-of: b52cbca2
      
       ("platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      97620a08
    • Luke D. Jones's avatar
      asus-wmi: Add dgpu disable method · ada7c5cc
      Luke D. Jones authored
      [ Upstream commit 98829e84
      
       ]
      
      In Windows the ASUS Armory Crate program can enable or disable the
      dGPU via a WMI call. This functions much the same as various Linux
      methods in software where the dGPU is removed from the device tree.
      
      However the WMI call saves the state of dGPU (enabled or not) and
      this then changes the dGPU visibility in Linux with no way for
      Linux users to re-enable it. We expose the WMI method so users can
      see and change the dGPU ACPI state.
      
      Signed-off-by: default avatarLuke D. Jones <luke@ljones.dev>
      Link: https://lore.kernel.org/r/20210807023656.25020-3-luke@ljones.dev
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Stable-dep-of: b52cbca2
      
       ("platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ada7c5cc
    • Hans de Goede's avatar
      platform/x86: asus-nb-wmi: Add tablet_mode_sw=lid-flip quirk for the TP200s · 3a8fc16d
      Hans de Goede authored
      [ Upstream commit 411f48bb
      
       ]
      
      The Asus TP200s / E205SA 360 degree hinges 2-in-1 supports reporting
      SW_TABLET_MODE info through the ASUS_WMI_DEVID_LID_FLIP WMI device-id.
      Add a quirk to enable this.
      
      BugLink: https://gitlab.freedesktop.org/libinput/libinput/-/issues/639
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20210812145513.39117-2-hdegoede@redhat.com
      Stable-dep-of: b52cbca2
      
       ("platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3a8fc16d
    • Hans de Goede's avatar
      platform/x86: asus-nb-wmi: Allow configuring SW_TABLET_MODE method with a module option · 79b86338
      Hans de Goede authored
      [ Upstream commit 6be70ccd
      
       ]
      
      Unfortunately we have been unable to find a reliable way to detect if
      and how SW_TABLET_MODE reporting is supported, so we are relying on
      DMI quirks for this.
      
      Add a module-option to specify the SW_TABLET_MODE method so that this can
      be easily tested without needing to rebuild the kernel.
      
      BugLink: https://gitlab.freedesktop.org/libinput/libinput/-/issues/639
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20210812145513.39117-1-hdegoede@redhat.com
      Stable-dep-of: b52cbca2
      
       ("platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      79b86338
    • Samuel Čavoj's avatar
      platform/x86: asus-wmi: Add support for SW_TABLET_MODE on UX360 · 9a861dde
      Samuel Čavoj authored
      [ Upstream commit ea856ec2
      
       ]
      
      The UX360CA has a WMI device id 0x00060062, which reports whether the
      lid is flipped in tablet mode (1) or in normal laptop mode (0).
      
      Add a quirk (quirk_asus_use_lid_flip_devid) for devices on which this
      WMI device should be used to figure out the SW_TABLET_MODE state, as
      opposed to the quirk_asus_use_kbd_dock_devid.
      
      Additionally, the device needs to be queried on resume and restore
      because the firmware does not generate an event if the laptop is put to
      sleep while in tablet mode, flipped to normal mode, and later awoken.
      
      It is assumed other UX360* models have the same WMI device. As such, the
      quirk is applied to devices with DMI_MATCH(DMI_PRODUCT_NAME, "UX360").
      More devices with this feature need to be tested and added accordingly.
      
      The reason for using an allowlist via the quirk mechanism is that the new
      WMI device (0x00060062) is also present on some models which do not have
      a 360 degree hinge (at least FX503VD and GL503VD from Hans' DSTS
      collection) and therefore its presence cannot be relied on.
      
      Signed-off-by: default avatarSamuel Čavoj <samuel@cavoj.net>
      Cc: Hans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20201020220944.1075530-1-samuel@cavoj.net
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Stable-dep-of: b52cbca2
      
       ("platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9a861dde
    • YuanShang's avatar
      drm/amdgpu: correct chunk_ptr to a pointer to chunk. · 13b1fa54
      YuanShang authored
      [ Upstream commit 50d51374
      
       ]
      
      The variable "chunk_ptr" should be a pointer pointing
      to a struct drm_amdgpu_cs_chunk instead of to a pointer
      of that.
      
      Signed-off-by: default avatarYuanShang <YuanShang.Mao@amd.com>
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      13b1fa54
    • Masahiro Yamada's avatar
      kconfig: fix memory leak from range properties · 8887047d
      Masahiro Yamada authored
      [ Upstream commit ae1eff03
      
       ]
      
      Currently, sym_validate_range() duplicates the range string using
      xstrdup(), which is overwritten by a subsequent sym_calc_value() call.
      It results in a memory leak.
      
      Instead, only the pointer should be copied.
      
      Below is a test case, with a summary from Valgrind.
      
      [Test Kconfig]
      
        config FOO
                int "foo"
                range 10 20
      
      [Test .config]
      
        CONFIG_FOO=0
      
      [Before]
      
        LEAK SUMMARY:
           definitely lost: 3 bytes in 1 blocks
           indirectly lost: 0 bytes in 0 blocks
             possibly lost: 0 bytes in 0 blocks
           still reachable: 17,465 bytes in 21 blocks
                suppressed: 0 bytes in 0 blocks
      
      [After]
      
        LEAK SUMMARY:
           definitely lost: 0 bytes in 0 blocks
           indirectly lost: 0 bytes in 0 blocks
             possibly lost: 0 bytes in 0 blocks
           still reachable: 17,462 bytes in 20 blocks
                suppressed: 0 bytes in 0 blocks
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8887047d
    • Alex Pakhunov's avatar
      tg3: Increment tx_dropped in tg3_tso_bug() · 96d55414
      Alex Pakhunov authored
      [ Upstream commit 17dd5efe
      
       ]
      
      tg3_tso_bug() drops a packet if it cannot be segmented for any reason.
      The number of discarded frames should be incremented accordingly.
      
      Signed-off-by: default avatarAlex Pakhunov <alexey.pakhunov@spacex.com>
      Signed-off-by: default avatarVincent Wong <vincent.wong2@spacex.com>
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Link: https://lore.kernel.org/r/20231113182350.37472-2-alexey.pakhunov@spacex.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      96d55414
    • Alex Pakhunov's avatar
      tg3: Move the [rt]x_dropped counters to tg3_napi · 9068403d
      Alex Pakhunov authored
      [ Upstream commit 907d1bdb
      
       ]
      
      This change moves [rt]x_dropped counters to tg3_napi so that they can be
      updated by a single writer, race-free.
      
      Signed-off-by: default avatarAlex Pakhunov <alexey.pakhunov@spacex.com>
      Signed-off-by: default avatarVincent Wong <vincent.wong2@spacex.com>
      Reviewed-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Link: https://lore.kernel.org/r/20231113182350.37472-1-alexey.pakhunov@spacex.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9068403d
    • Jozsef Kadlecsik's avatar
      netfilter: ipset: fix race condition between swap/destroy and kernel side add/del/test · e7152a13
      Jozsef Kadlecsik authored
      [ Upstream commit 28628fa9
      
       ]
      
      Linkui Xiao reported that there's a race condition when ipset swap and destroy is
      called, which can lead to crash in add/del/test element operations. Swap then
      destroy are usual operations to replace a set with another one in a production
      system. The issue can in some cases be reproduced with the script:
      
      ipset create hash_ip1 hash:net family inet hashsize 1024 maxelem 1048576
      ipset add hash_ip1 172.20.0.0/16
      ipset add hash_ip1 192.168.0.0/16
      iptables -A INPUT -m set --match-set hash_ip1 src -j ACCEPT
      while [ 1 ]
      do
      	# ... Ongoing traffic...
              ipset create hash_ip2 hash:net family inet hashsize 1024 maxelem 1048576
              ipset add hash_ip2 172.20.0.0/16
              ipset swap hash_ip1 hash_ip2
              ipset destroy hash_ip2
              sleep 0.05
      done
      
      In the race case the possible order of the operations are
      
      	CPU0			CPU1
      	ip_set_test
      				ipset swap hash_ip1 hash_ip2
      				ipset destroy hash_ip2
      	hash_net_kadt
      
      Swap replaces hash_ip1 with hash_ip2 and then destroy removes hash_ip2 which
      is the original hash_ip1. ip_set_test was called on hash_ip1 and because destroy
      removed it, hash_net_kadt crashes.
      
      The fix is to force ip_set_swap() to wait for all readers to finish accessing the
      old set pointers by calling synchronize_rcu().
      
      The first version of the patch was written by Linkui Xiao <xiaolinkui@kylinos.cn>.
      
      v2: synchronize_rcu() is moved into ip_set_swap() in order not to burden
          ip_set_destroy() unnecessarily when all sets are destroyed.
      v3: Florian Westphal pointed out that all netfilter hooks run with rcu_read_lock() held
          and em_ipset.c wraps the entire ip_set_test() in rcu read lock/unlock pair.
          So there's no need to extend the rcu read locked area in ipset itself.
      
      Closes: https://lore.kernel.org/all/69e7963b-e7f8-3ad0-210-7b86eebf7f78@netfilter.org/
      Reported by: Linkui Xiao <xiaolinkui@kylinos.cn>
      Signed-off-by: default avatarJozsef Kadlecsik <kadlec@netfilter.org>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e7152a13