Skip to content
Snippets Groups Projects
  1. May 14, 2021
    • Lorenzo Bianconi's avatar
      mt76: mt7615: fix mib stats counter reporting to mac80211 · 0b39be51
      Lorenzo Bianconi authored
      
      [ Upstream commit 2eb6f6c4 ]
      
      In order to properly report MIB counters to mac80211, resets stats in
      mt7615_get_stats routine and hold mt76 mutex accessing MIB counters.
      Sum up MIB counters in mt7615_mac_update_mib_stats routine.
      
      Fixes: c388d858 ("mt76: mt7615: add a get_stats() callback")
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0b39be51
    • Lorenzo Bianconi's avatar
      mt76: mt7915: fix aggr len debugfs node · 2da92db4
      Lorenzo Bianconi authored
      
      [ Upstream commit 9fb9d755 ]
      
      Similar to mt7921, fix 802.11 aggr len debugfs reporting for mt7915 driver.
      
      Fixes: e57b7901 ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2da92db4
    • Felix Fietkau's avatar
      mt76: mt7915: fix tx skb dma unmap · 4e7914ce
      Felix Fietkau authored
      
      [ Upstream commit 7dcf3c04 ]
      
      The first pointer in the txp needs to be unmapped as well, otherwise it will
      leak DMA mapping entries
      
      Reported-by: default avatarBen Greear <greearb@candelatech.com>
      Fixes: 27d5c528 ("mt76: fix double DMA unmap of the first buffer on 7615/7915")
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4e7914ce
    • Felix Fietkau's avatar
      mt76: mt7615: fix tx skb dma unmap · 75bc5f77
      Felix Fietkau authored
      
      [ Upstream commit ebee7885 ]
      
      The first pointer in the txp needs to be unmapped as well, otherwise it will
      leak DMA mapping entries
      
      Fixes: 27d5c528 ("mt76: fix double DMA unmap of the first buffer on 7615/7915")
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      75bc5f77
    • Colin Ian King's avatar
      mt7601u: fix always true expression · 3443c54c
      Colin Ian King authored
      
      [ Upstream commit 87fce886 ]
      
      Currently the expression ~nic_conf1 is always true because nic_conf1
      is a u16 and according to 6.5.3.3 of the C standard the ~ operator
      promotes the u16 to an integer before flipping all the bits. Thus
      the top 16 bits of the integer result are all set so the expression
      is always true.  If the intention was to flip all the bits of nic_conf1
      then casting the integer result back to a u16 is a suitabel fix.
      
      Interestingly static analyzers seem to thing a bitwise ! should be
      used instead of ~ for this scenario, so I think the original intent
      of the expression may need some extra consideration.
      
      Addresses-Coverity: ("Logical vs. bitwise operator")
      Fixes: c869f77d ("add mt7601u driver")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Acked-by: default avatarJakub Kicinski <kubakici@wp.pl>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20210225183241.1002129-1-colin.king@canonical.com
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3443c54c
    • Dan Carpenter's avatar
      rtw88: Fix an error code in rtw_debugfs_set_rsvd_page() · 00792f31
      Dan Carpenter authored
      
      [ Upstream commit c9eaee0c ]
      
      The sscanf() function returns the number of matches (0 or 1 in this
      case).  It doesn't return error codes.  We should return -EINVAL if the
      string is invalid
      
      Fixes: c376c1fc ("rtw88: add h2c command in debugfs")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/YE8nmatMDBDDWkjq@mwanda
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      00792f31
    • Colin Ian King's avatar
      liquidio: Fix unintented sign extension of a left shift of a u16 · f9e9df72
      Colin Ian King authored
      
      [ Upstream commit 298b58f0 ]
      
      The macro CN23XX_PEM_BAR1_INDEX_REG is being used to shift oct->pcie_port
      (a u16) left 24 places. There are two subtle issues here, first the
      shift gets promoted to an signed int and then sign extended to a u64.
      If oct->pcie_port is 0x80 or more then the upper bits get sign extended
      to 1. Secondly shfiting a u16 24 bits will lead to an overflow so it
      needs to be cast to a u64 for all the bits to not overflow.
      
      It is entirely possible that the u16 port value is never large enough
      for this to fail, but it is useful to fix unintended overflows such
      as this.
      
      Fix this by casting the port parameter to the macro to a u64 before
      the shift.
      
      Addresses-Coverity: ("Unintended sign extension")
      Fixes: 5bc67f58 ("liquidio: CN23XX register definitions")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f9e9df72
    • Salil Mehta's avatar
      net: hns3: Limiting the scope of vector_ring_chain variable · 3cf9fac7
      Salil Mehta authored
      
      [ Upstream commit d392ecd1 ]
      
      Limiting the scope of the variable vector_ring_chain to the block where it
      is used.
      
      Fixes: 424eb834 ("net: hns3: Unified HNS3 {VF|PF} Ethernet Driver for hip08 SoC")
      Signed-off-by: default avatarSalil Mehta <salil.mehta@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3cf9fac7
    • Andre Edich's avatar
      net: phy: lan87xx: fix access to wrong register of LAN87xx · c45cb22a
      Andre Edich authored
      
      [ Upstream commit fdb5cc6a ]
      
      The function lan87xx_config_aneg_ext was introduced to configure
      LAN95xxA but as well writes to undocumented register of LAN87xx.
      This fix prevents that access.
      
      The function lan87xx_config_aneg_ext gets more suitable for the new
      behavior name.
      
      Reported-by: default avatarMåns Rullgård <mans@mansr.com>
      Fixes: 05b35e7e ("smsc95xx: add phylib support")
      Signed-off-by: default avatarAndre Edich <andre.edich@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c45cb22a
    • Xie He's avatar
      net: lapbether: Prevent racing when checking whether the netif is running · f72e3d81
      Xie He authored
      
      [ Upstream commit 5acd0cfb ]
      
      There are two "netif_running" checks in this driver. One is in
      "lapbeth_xmit" and the other is in "lapbeth_rcv". They serve to make
      sure that the LAPB APIs called in these functions are called before
      "lapb_unregister" is called by the "ndo_stop" function.
      
      However, these "netif_running" checks are unreliable, because it's
      possible that immediately after "netif_running" returns true, "ndo_stop"
      is called (which causes "lapb_unregister" to be called).
      
      This patch adds locking to make sure "lapbeth_xmit" and "lapbeth_rcv" can
      reliably check and ensure the netif is running while doing their work.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarXie He <xie.he.0141@gmail.com>
      Acked-by: default avatarMartin Schiller <ms@dev.tdt.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f72e3d81
    • Marcus Folkesson's avatar
      wilc1000: write value to WILC_INTR2_ENABLE register · cd6e679b
      Marcus Folkesson authored
      
      [ Upstream commit e21b6e5a ]
      
      Write the value instead of reading it twice.
      
      Fixes: c5c77ba1 ("staging: wilc1000: Add SDIO/SPI 802.11 driver")
      Signed-off-by: default avatarMarcus Folkesson <marcus.folkesson@gmail.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20210224163706.519658-1-marcus.folkesson@gmail.com
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cd6e679b
    • Xie He's avatar
      Revert "drivers/net/wan/hdlc_fr: Fix a double free in pvc_xmit" · 545dbb1b
      Xie He authored
      
      commit d362fd0b upstream.
      
      This reverts commit 1b479fb8
      ("drivers/net/wan/hdlc_fr: Fix a double free in pvc_xmit").
      
      1. This commit is incorrect. "__skb_pad" will NOT free the skb on
      failure when its "free_on_error" parameter is "false".
      
      2. This commit claims to fix my commit. But it didn't CC me??
      
      Fixes: 1b479fb8 ("drivers/net/wan/hdlc_fr: Fix a double free in pvc_xmit")
      Cc: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
      Signed-off-by: default avatarXie He <xie.he.0141@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      545dbb1b
    • Maciej W. Rozycki's avatar
      FDDI: defxx: Make MMIO the configuration default except for EISA · 3b999f3e
      Maciej W. Rozycki authored
      
      commit 193ced4a upstream.
      
      Recent versions of the PCI Express specification have deprecated support
      for I/O transactions and actually some PCIe host bridges, such as Power
      Systems Host Bridge 4 (PHB4), do not implement them.
      
      The default kernel configuration choice for the defxx driver is the use
      of I/O ports rather than MMIO for PCI and EISA systems.  It may have
      made sense as a conservative backwards compatible choice back when MMIO
      operation support was added to the driver as a part of TURBOchannel bus
      support.  However nowadays this configuration choice makes the driver
      unusable with systems that do not implement I/O transactions for PCIe.
      
      Make DEFXX_MMIO the configuration default then, except where configured
      for EISA.  This exception is because an EISA adapter can have its MMIO
      decoding disabled with ECU (EISA Configuration Utility) and therefore
      not available with the resource allocation infrastructure we implement,
      while port I/O is always readily available as it uses slot-specific
      addressing, directly mapped to the slot an option card has been placed
      in and handled with our EISA bus support core.  Conversely a kernel that
      supports modern systems which may not have I/O transactions implemented
      for PCIe will usually not be expected to handle legacy EISA systems.
      
      The change of the default will make it easier for people, including but
      not limited to distribution packagers, to make a working choice for the
      driver.
      
      Update the option description accordingly and while at it replace the
      potentially ambiguous PIO acronym with IOP for "port I/O" vs "I/O ports"
      according to our nomenclature used elsewhere.
      
      Signed-off-by: default avatarMaciej W. Rozycki <macro@orcam.me.uk>
      Fixes: e89a2cfb ("[TC] defxx: TURBOchannel support")
      Cc: stable@vger.kernel.org # v2.6.21+
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3b999f3e
    • Felix Fietkau's avatar
      mt76: fix potential DMA mapping leak · 9fa26701
      Felix Fietkau authored
      
      commit b4403cee upstream.
      
      With buf uninitialized in mt76_dma_tx_queue_skb_raw, its field skip_unmap
      could potentially inherit a non-zero value from stack garbage.
      If this happens, it will cause DMA mappings for MCU command frames to not be
      unmapped after completion
      
      Fixes: 27d5c528 ("mt76: fix double DMA unmap of the first buffer on 7615/7915")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9fa26701
    • Ping-Ke Shih's avatar
      rtw88: Fix array overrun in rtw_get_tx_power_params() · 95fb153c
      Ping-Ke Shih authored
      
      commit 2ff25985 upstream.
      
      Using a kernel with the Undefined Behaviour Sanity Checker (UBSAN) enabled, the
      following array overrun is logged:
      
      ================================================================================
      UBSAN: array-index-out-of-bounds in /home/finger/wireless-drivers-next/drivers/net/wireless/realtek/rtw88/phy.c:1789:34
      index 5 is out of range for type 'u8 [5]'
      CPU: 2 PID: 84 Comm: kworker/u16:3 Tainted: G           O      5.12.0-rc5-00086-gd88bba47038e-dirty #651
      Hardware name: TOSHIBA TECRA A50-A/TECRA A50-A, BIOS Version 4.50   09/29/2014
      Workqueue: phy0 ieee80211_scan_work [mac80211]
      Call Trace:
       dump_stack+0x64/0x7c
       ubsan_epilogue+0x5/0x40
       __ubsan_handle_out_of_bounds.cold+0x43/0x48
       rtw_get_tx_power_params+0x83a/drivers/net/wireless/realtek/rtw88/0xad0 [rtw_core]
       ? rtw_pci_read16+0x20/0x20 [rtw_pci]
       ? check_hw_ready+0x50/0x90 [rtw_core]
       rtw_phy_get_tx_power_index+0x4d/0xd0 [rtw_core]
       rtw_phy_set_tx_power_level+0xee/0x1b0 [rtw_core]
       rtw_set_channel+0xab/0x110 [rtw_core]
       rtw_ops_config+0x87/0xc0 [rtw_core]
       ieee80211_hw_config+0x9d/0x130 [mac80211]
       ieee80211_scan_state_set_channel+0x81/0x170 [mac80211]
       ieee80211_scan_work+0x19f/0x2a0 [mac80211]
       process_one_work+0x1dd/0x3a0
       worker_thread+0x49/0x330
       ? rescuer_thread+0x3a0/0x3a0
       kthread+0x134/0x150
       ? kthread_create_worker_on_cpu+0x70/0x70
       ret_from_fork+0x22/0x30
      ================================================================================
      
      The statement where an array is being overrun is shown in the following snippet:
      
      	if (rate <= DESC_RATE11M)
      		tx_power = pwr_idx_2g->cck_base[group];
      	else
      ====>		tx_power = pwr_idx_2g->bw40_base[group];
      
      The associated arrays are defined in main.h as follows:
      
      struct rtw_2g_txpwr_idx {
      	u8 cck_base[6];
      	u8 bw40_base[5];
      	struct rtw_2g_1s_pwr_idx_diff ht_1s_diff;
      	struct rtw_2g_ns_pwr_idx_diff ht_2s_diff;
      	struct rtw_2g_ns_pwr_idx_diff ht_3s_diff;
      	struct rtw_2g_ns_pwr_idx_diff ht_4s_diff;
      };
      
      The problem arises because the value of group is 5 for channel 14. The trivial
      increase in the dimension of bw40_base fails as this struct must match the layout of
      efuse. The fix is to add the rate as an argument to rtw_get_channel_group() and set
      the group for channel 14 to 4 if rate <= DESC_RATE11M.
      
      This patch fixes commit fa6dfe6b ("rtw88: resolve order of tx power setting routines")
      
      Fixes: fa6dfe6b ("rtw88: resolve order of tx power setting routines")
      Reported-by: default avatarБогдан Пилипенко <bogdan.pylypenko107@gmail.com>
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
      Cc: Stable <stable@vger.kernel.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20210401192717.28927-1-Larry.Finger@lwfinger.net
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      95fb153c
    • Dan Carpenter's avatar
      ipw2x00: potential buffer overflow in libipw_wx_set_encodeext() · c9996845
      Dan Carpenter authored
      
      commit 260a9ad9 upstream.
      
      The "ext->key_len" is a u16 that comes from the user.  If it's over
      SCM_KEY_LEN (32) that could lead to memory corruption.
      
      Fixes: e0d369d1 ("[PATCH] ieee82011: Added WE-18 support to default wireless extension handler")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarStanislav Yakovlev <stas.yakovlev@gmail.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/YHaoA1i+8uT4ir4h@mwanda
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c9996845
    • Ryder Lee's avatar
      mt76: mt7615: use ieee80211_free_txskb() in mt7615_tx_token_put() · f54f21c0
      Ryder Lee authored
      
      commit 06991d1f upstream.
      
      We should use ieee80211_free_txskb() to report skb status avoid wrong
      aql accounting after reset.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarRyder Lee <ryder.lee@mediatek.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f54f21c0
    • Maciej W. Rozycki's avatar
      FDDI: defxx: Bail out gracefully with unassigned PCI resource for CSR · a22fc2eb
      Maciej W. Rozycki authored
      
      commit f626ca68 upstream.
      
      Recent versions of the PCI Express specification have deprecated support
      for I/O transactions and actually some PCIe host bridges, such as Power
      Systems Host Bridge 4 (PHB4), do not implement them.
      
      For those systems the PCI BARs that request a mapping in the I/O space
      have the length recorded in the corresponding PCI resource set to zero,
      which makes it unassigned:
      
      # lspci -s 0031:02:04.0 -v
      0031:02:04.0 FDDI network controller: Digital Equipment Corporation PCI-to-PDQ Interface Chip [PFI] FDDI (DEFPA) (rev 02)
      	Subsystem: Digital Equipment Corporation FDDIcontroller/PCI (DEFPA)
      	Flags: bus master, medium devsel, latency 136, IRQ 57, NUMA node 8
      	Memory at 620c080020000 (32-bit, non-prefetchable) [size=128]
      	I/O ports at <unassigned> [disabled]
      	Memory at 620c080030000 (32-bit, non-prefetchable) [size=64K]
      	Capabilities: [50] Power Management version 2
      	Kernel driver in use: defxx
      	Kernel modules: defxx
      
      #
      
      Regardless the driver goes ahead and requests it (here observed with a
      Raptor Talos II POWER9 system), resulting in an odd /proc/ioport entry:
      
      # cat /proc/ioports
      00000000-ffffffffffffffff : 0031:02:04.0
      #
      
      Furthermore, the system gets confused as the driver actually continues
      and pokes at those locations, causing a flood of messages being output
      to the system console by the underlying system firmware, like:
      
      defxx: v1.11 2014/07/01  Lawrence V. Stefani and others
      defxx 0031:02:04.0: enabling device (0140 -> 0142)
      LPC[000]: Got SYNC no-response error. Error address reg: 0xd0010000
      IPMI: dropping non severe PEL event
      LPC[000]: Got SYNC no-response error. Error address reg: 0xd0010014
      IPMI: dropping non severe PEL event
      LPC[000]: Got SYNC no-response error. Error address reg: 0xd0010014
      IPMI: dropping non severe PEL event
      
      and so on and so on (possibly intermixed actually, as there's no locking
      between the kernel and the firmware in console port access with this
      particular system, but cleaned up above for clarity), and once some 10k
      of such pairs of the latter two messages have been produced an interace
      eventually shows up in a useless state:
      
      0031:02:04.0: DEFPA at I/O addr = 0x0, IRQ = 57, Hardware addr = 00-00-00-00-00-00
      
      This was not expected to happen as resource handling was added to the
      driver a while ago, because it was not known at that time that a PCI
      system would be possible that cannot assign port I/O resources, and
      oddly enough `request_region' does not fail, which would have caught it.
      
      Correct the problem then by checking for the length of zero for the CSR
      resource and bail out gracefully refusing to register an interface if
      that turns out to be the case, producing messages like:
      
      defxx: v1.11 2014/07/01  Lawrence V. Stefani and others
      0031:02:04.0: Cannot use I/O, no address set, aborting
      0031:02:04.0: Recompile driver with "CONFIG_DEFXX_MMIO=y"
      
      Keep the original check for the EISA MMIO resource as implemented,
      because in that case the length is hardwired to 0x400 as a consequence
      of how the compare/mask address decoding works in the ESIC chip and it
      is only the base address that is set to zero if MMIO has been disabled
      for the adapter in EISA configuration, which in turn could be a valid
      bus address in a legacy-free system implementing PCI, especially for
      port I/O.
      
      Where the EISA MMIO resource has been disabled for the adapter in EISA
      configuration this arrangement keeps producing messages like:
      
      eisa 00:05: EISA: slot 5: DEC3002 detected
      defxx: v1.11 2014/07/01  Lawrence V. Stefani and others
      00:05: Cannot use MMIO, no address set, aborting
      00:05: Recompile driver with "CONFIG_DEFXX_MMIO=n"
      00:05: Or run ECU and set adapter's MMIO location
      
      with the last two lines now swapped for easier handling in the driver.
      
      There is no need to check for and catch the case of a port I/O resource
      not having been assigned for EISA as the adapter uses the slot-specific
      I/O space, which gets assigned by how EISA has been specified and maps
      directly to the particular slot an option card has been placed in.  And
      the EISA variant of the adapter has additional registers that are only
      accessible via the port I/O space anyway.
      
      While at it factor out the error message calls into helpers and fix an
      argument order bug with the `pr_err' call now in `dfx_register_res_err'.
      
      Signed-off-by: default avatarMaciej W. Rozycki <macro@orcam.me.uk>
      Fixes: 4d0438e5 ("defxx: Clean up DEFEA resource management")
      Cc: stable@vger.kernel.org # v3.19+
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a22fc2eb
  2. May 11, 2021
  3. May 07, 2021
  4. May 02, 2021
  5. Apr 28, 2021
  6. Apr 21, 2021
Loading