Skip to content
  1. Feb 16, 2022
    • Greg Kroah-Hartman's avatar
      Revert "usb: dwc2: drd: fix soft connect when gadget is unconfigured" · a66a2b17
      Greg Kroah-Hartman authored
      commit 736e8d89 upstream.
      
      This reverts commit 269cbcf7
      
      .
      
      It causes build errors as reported by the kernel test robot.
      
      Link: https://lore.kernel.org/r/202202112236.AwoOTtHO-lkp@intel.com
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Fixes: 269cbcf7
      
       ("usb: dwc2: drd: fix soft connect when gadget is unconfigured")
      Cc: stable@kernel.org
      Cc: Amelie Delaunay <amelie.delaunay@foss.st.com>
      Cc: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
      Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a66a2b17
    • Fabrice Gasnier's avatar
      usb: dwc2: drd: fix soft connect when gadget is unconfigured · 73961057
      Fabrice Gasnier authored
      commit 269cbcf7 upstream.
      
      When the gadget driver hasn't been (yet) configured, and the cable is
      connected to a HOST, the SFTDISCON gets cleared unconditionally, so the
      HOST tries to enumerate it.
      At the host side, this can result in a stuck USB port or worse. When
      getting lucky, some dmesg can be observed at the host side:
       new high-speed USB device number ...
       device descriptor read/64, error -110
      
      Fix it in drd, by checking the enabled flag before calling
      dwc2_hsotg_core_connect(). It will be called later, once configured,
      by the normal flow:
      - udc_bind_to_driver
       - usb_gadget_connect
         - dwc2_hsotg_pullup
           - dwc2_hsotg_core_connect
      
      Fixes: 17f93402
      
       ("usb: dwc2: override PHY input signals with usb role switch support")
      Cc: stable@kernel.org
      Reviewed-by: default avatarAmelie Delaunay <amelie.delaunay@foss.st.com>
      Acked-by: default avatarMinas Harutyunyan <Minas.Harutyunyan@synopsys.com>
      Signed-off-by: default avatarFabrice Gasnier <fabrice.gasnier@foss.st.com>
      Link: https://lore.kernel.org/r/1644423353-17859-1-git-send-email-fabrice.gasnier@foss.st.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      73961057
    • Jonas Malaco's avatar
      eeprom: ee1004: limit i2c reads to I2C_SMBUS_BLOCK_MAX · a37960df
      Jonas Malaco authored
      commit c0689e46 upstream.
      
      Commit effa4531 ("i2c: i801: Don't silently correct invalid transfer
      size") revealed that ee1004_eeprom_read() did not properly limit how
      many bytes to read at once.
      
      In particular, i2c_smbus_read_i2c_block_data_or_emulated() takes the
      length to read as an u8.  If count == 256 after taking into account the
      offset and page boundary, the cast to u8 overflows.  And this is common
      when user space tries to read the entire EEPROM at once.
      
      To fix it, limit each read to I2C_SMBUS_BLOCK_MAX (32) bytes, already
      the maximum length i2c_smbus_read_i2c_block_data_or_emulated() allows.
      
      Fixes: effa4531
      
       ("i2c: i801: Don't silently correct invalid transfer size")
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarJonas Malaco <jonas@protocubo.io>
      Link: https://lore.kernel.org/r/20220203165024.47767-1-jonas@protocubo.io
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a37960df
    • TATSUKAWA KOSUKE (立川 江介)'s avatar
      n_tty: wake up poll(POLLRDNORM) on receiving data · 1b99fe34
      TATSUKAWA KOSUKE (立川 江介) authored
      commit c816b2e6 upstream.
      
      The poll man page says POLLRDNORM is equivalent to POLLIN when used as
      an event.
      $ man poll
      <snip>
                    POLLRDNORM
                           Equivalent to POLLIN.
      
      However, in n_tty driver, POLLRDNORM does not return until timeout even
      if there is terminal input, whereas POLLIN returns.
      
      The following test program works until kernel-3.17, but the test stops
      in poll() after commit 57087d51 ("tty: Fix spurious poll() wakeups").
      
      [Steps to run test program]
        $ cc -o test-pollrdnorm test-pollrdnorm.c
        $ ./test-pollrdnorm
        foo          <-- Type in something from the terminal followed by [RET].
                         The string should be echoed back.
      
        ------------------------< test-pollrdnorm.c >------------------------
        #include <stdio.h>
        #include <errno.h>
        #include <poll.h>
        #include <unistd.h>
      
        void main(void)
        {
      	int		n;
      	unsigned char	buf[8];
      	struct pollfd	fds[1] = {{ 0, POLLRDNORM, 0 }};
      
      	n = poll(fds, 1, -1);
      	if (n < 0)
      		perror("poll");
      	n = read(0, buf, 8);
      	if (n < 0)
      		perror("read");
      	if (n > 0)
      		write(1, buf, n);
        }
        ------------------------------------------------------------------------
      
      The attached patch fixes this problem.  Many calls to
      wake_up_interruptible_poll() in the kernel source code already specify
      "POLLIN | POLLRDNORM".
      
      Fixes: 57087d51
      
       ("tty: Fix spurious poll() wakeups")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarKosuke Tatsukawa <tatsu-ab1@nec.com>
      Link: https://lore.kernel.org/r/TYCPR01MB81901C0F932203D30E452B3EA5209@TYCPR01MB8190.jpnprd01.prod.outlook.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1b99fe34
    • Jakob Koschel's avatar
      vt_ioctl: add array_index_nospec to VT_ACTIVATE · f1b25737
      Jakob Koschel authored
      commit 28cb138f
      
       upstream.
      
      in vt_setactivate an almost identical code path has been patched
      with array_index_nospec. In the VT_ACTIVATE path the user input
      is from a system call argument instead of a usercopy.
      For consistency both code paths should have the same mitigations
      applied.
      
      Kasper Acknowledgements: Jakob Koschel, Brian Johannesmeyer, Kaveh
      Razavi, Herbert Bos, Cristiano Giuffrida from the VUSec group at VU
      Amsterdam.
      
      Co-developed-by: default avatarBrian Johannesmeyer <bjohannesmeyer@gmail.com>
      Signed-off-by: default avatarBrian Johannesmeyer <bjohannesmeyer@gmail.com>
      Signed-off-by: default avatarJakob Koschel <jakobkoschel@gmail.com>
      Link: https://lore.kernel.org/r/20220127144406.3589293-2-jakobkoschel@gmail.com
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f1b25737
    • Jakob Koschel's avatar
      vt_ioctl: fix array_index_nospec in vt_setactivate · 778302ca
      Jakob Koschel authored
      commit 61cc70d9
      
       upstream.
      
      array_index_nospec ensures that an out-of-bounds value is set to zero
      on the transient path. Decreasing the value by one afterwards causes
      a transient integer underflow. vsa.console should be decreased first
      and then sanitized with array_index_nospec.
      
      Kasper Acknowledgements: Jakob Koschel, Brian Johannesmeyer, Kaveh
      Razavi, Herbert Bos, Cristiano Giuffrida from the VUSec group at VU
      Amsterdam.
      
      Co-developed-by: default avatarBrian Johannesmeyer <bjohannesmeyer@gmail.com>
      Signed-off-by: default avatarBrian Johannesmeyer <bjohannesmeyer@gmail.com>
      Signed-off-by: default avatarJakob Koschel <jakobkoschel@gmail.com>
      Link: https://lore.kernel.org/r/20220127144406.3589293-1-jakobkoschel@gmail.com
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      778302ca
    • Vladimir Oltean's avatar
      net: dsa: mv88e6xxx: fix use-after-free in mv88e6xxx_mdios_unregister · 22249886
      Vladimir Oltean authored
      [ Upstream commit 51a04ebf ]
      
      Since struct mv88e6xxx_mdio_bus *mdio_bus is the bus->priv of something
      allocated with mdiobus_alloc_size(), this means that mdiobus_free(bus)
      will free the memory backing the mdio_bus as well. Therefore, the
      mdio_bus->list element is freed memory, but we continue to iterate
      through the list of MDIO buses using that list element.
      
      To fix this, use the proper list iterator that handles element deletion
      by keeping a copy of the list element next pointer.
      
      Fixes: f53a2ce8
      
       ("net: dsa: mv88e6xxx: don't use devres for mdiobus")
      Reported-by: default avatarRafael Richter <rafael.richter@gin.de>
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Link: https://lore.kernel.org/r/20220210174017.3271099-1-vladimir.oltean@nxp.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      22249886
    • Colin Foster's avatar
      net: mscc: ocelot: fix mutex lock error during ethtool stats read · 3a3c65c4
      Colin Foster authored
      [ Upstream commit 7fbf6795
      
       ]
      
      An ongoing workqueue populates the stats buffer. At the same time, a user
      might query the statistics. While writing to the buffer is mutex-locked,
      reading from the buffer wasn't. This could lead to buggy reads by ethtool.
      
      This patch fixes the former blamed commit, but the bug was introduced in
      the latter.
      
      Signed-off-by: default avatarColin Foster <colin.foster@in-advantage.com>
      Fixes: 1e1caa97 ("ocelot: Clean up stats update deferred work")
      Fixes: a556c76a
      
       ("net: mscc: Add initial Ocelot switch support")
      Reported-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Link: https://lore.kernel.org/all/20220210150451.416845-2-colin.foster@in-advantage.com/
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3a3c65c4
    • Jesse Brandeburg's avatar
      ice: fix IPIP and SIT TSO offload · 809f0307
      Jesse Brandeburg authored
      [ Upstream commit 46b699c5 ]
      
      The driver was avoiding offload for IPIP (at least) frames due to
      parsing the inner header offsets incorrectly when trying to check
      lengths.
      
      This length check works for VXLAN frames but fails on IPIP frames
      because skb_transport_offset points to the inner header in IPIP
      frames, which meant the subtraction of transport_header from
      inner_network_header returns a negative value (-20).
      
      With the code before this patch, everything continued to work, but GSO
      was being used to segment, causing throughputs of 1.5Gb/s per thread.
      After this patch, throughput is more like 10Gb/s per thread for IPIP
      traffic.
      
      Fixes: e94d4478
      
       ("ice: Implement filter sync, NDO operations and bump version")
      Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Reviewed-by: default avatarPaul Menzel <pmenzel@molgen.mpg.de>
      Tested-by: default avatarGurucharan G <gurucharanx.g@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      809f0307
    • Dan Carpenter's avatar
      ice: fix an error code in ice_cfg_phy_fec() · cf11949b
      Dan Carpenter authored
      [ Upstream commit 21338d58 ]
      
      Propagate the error code from ice_get_link_default_override() instead
      of returning success.
      
      Fixes: ea78ce4d
      
       ("ice: add link lenient and default override support")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Tested-by: default avatarGurucharan G <gurucharanx.g@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cf11949b
    • Robert-Ionut Alexa's avatar
      dpaa2-eth: unregister the netdev before disconnecting from the PHY · f8edc6fe
      Robert-Ionut Alexa authored
      [ Upstream commit 9ccc6e0c ]
      
      The netdev should be unregistered before we are disconnecting from the
      MAC/PHY so that the dev_close callback is called and the PHY and the
      phylink workqueues are actually stopped before we are disconnecting and
      destroying the phylink instance.
      
      Fixes: 71947923
      
       ("dpaa2-eth: add MAC/PHY support through phylink")
      Signed-off-by: default avatarRobert-Ionut Alexa <robert-ionut.alexa@nxp.com>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f8edc6fe
    • Raju Rangoju's avatar
      net: amd-xgbe: disable interrupts during pci removal · ff6c9e0f
      Raju Rangoju authored
      [ Upstream commit 68c2d6af ]
      
      Hardware interrupts are enabled during the pci probe, however,
      they are not disabled during pci removal.
      
      Disable all hardware interrupts during pci removal to avoid any
      issues.
      
      Fixes: e7537740
      
       ("amd-xgbe: Update PCI support to use new IRQ functions")
      Suggested-by: default avatarSelwin Sebastian <Selwin.Sebastian@amd.com>
      Signed-off-by: default avatarRaju Rangoju <Raju.Rangoju@amd.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ff6c9e0f
    • Jon Maloy's avatar
      tipc: rate limit warning for received illegal binding update · 657aea78
      Jon Maloy authored
      [ Upstream commit c7223d68 ]
      
      It would be easy to craft a message containing an illegal binding table
      update operation. This is handled correctly by the code, but the
      corresponding warning printout is not rate limited as is should be.
      We fix this now.
      
      Fixes: b97bf3fd
      
       ("[TIPC] Initial merge")
      Signed-off-by: default avatarJon Maloy <jmaloy@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      657aea78
    • Joel Stanley's avatar
      net: mdio: aspeed: Add missing MODULE_DEVICE_TABLE · ef5cdae8
      Joel Stanley authored
      [ Upstream commit bc1c3c3b ]
      
      Fix loading of the driver when built as a module.
      
      Fixes: f160e994
      
       ("net: phy: Add mdio-aspeed")
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Acked-by: default avatarAndrew Jeffery <andrew@aj.id.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ef5cdae8
    • Eric Dumazet's avatar
      veth: fix races around rq->rx_notify_masked · bf99c144
      Eric Dumazet authored
      [ Upstream commit 68468d8c ]
      
      veth being NETIF_F_LLTX enabled, we need to be more careful
      whenever we read/write rq->rx_notify_masked.
      
      BUG: KCSAN: data-race in veth_xmit / veth_xmit
      
      write to 0xffff888133d9a9f8 of 1 bytes by task 23552 on cpu 0:
       __veth_xdp_flush drivers/net/veth.c:269 [inline]
       veth_xmit+0x307/0x470 drivers/net/veth.c:350
       __netdev_start_xmit include/linux/netdevice.h:4683 [inline]
       netdev_start_xmit include/linux/netdevice.h:4697 [inline]
       xmit_one+0x105/0x2f0 net/core/dev.c:3473
       dev_hard_start_xmit net/core/dev.c:3489 [inline]
       __dev_queue_xmit+0x86d/0xf90 net/core/dev.c:4116
       dev_queue_xmit+0x13/0x20 net/core/dev.c:4149
       br_dev_queue_push_xmit+0x3ce/0x430 net/bridge/br_forward.c:53
       NF_HOOK include/linux/netfilter.h:307 [inline]
       br_forward_finish net/bridge/br_forward.c:66 [inline]
       NF_HOOK include/linux/netfilter.h:307 [inline]
       __br_forward+0x2e4/0x400 net/bridge/br_forward.c:115
       br_flood+0x521/0x5c0 net/bridge/br_forward.c:242
       br_dev_xmit+0x8b6/0x960
       __netdev_start_xmit include/linux/netdevice.h:4683 [inline]
       netdev_start_xmit include/linux/netdevice.h:4697 [inline]
       xmit_one+0x105/0x2f0 net/core/dev.c:3473
       dev_hard_start_xmit net/core/dev.c:3489 [inline]
       __dev_queue_xmit+0x86d/0xf90 net/core/dev.c:4116
       dev_queue_xmit+0x13/0x20 net/core/dev.c:4149
       neigh_hh_output include/net/neighbour.h:525 [inline]
       neigh_output include/net/neighbour.h:539 [inline]
       ip_finish_output2+0x6f8/0xb70 net/ipv4/ip_output.c:228
       ip_finish_output+0xfb/0x240 net/ipv4/ip_output.c:316
       NF_HOOK_COND include/linux/netfilter.h:296 [inline]
       ip_output+0xf3/0x1a0 net/ipv4/ip_output.c:430
       dst_output include/net/dst.h:451 [inline]
       ip_local_out net/ipv4/ip_output.c:126 [inline]
       ip_send_skb+0x6e/0xe0 net/ipv4/ip_output.c:1570
       udp_send_skb+0x641/0x880 net/ipv4/udp.c:967
       udp_sendmsg+0x12ea/0x14c0 net/ipv4/udp.c:1254
       inet_sendmsg+0x5f/0x80 net/ipv4/af_inet.c:819
       sock_sendmsg_nosec net/socket.c:705 [inline]
       sock_sendmsg net/socket.c:725 [inline]
       ____sys_sendmsg+0x39a/0x510 net/socket.c:2413
       ___sys_sendmsg net/socket.c:2467 [inline]
       __sys_sendmmsg+0x267/0x4c0 net/socket.c:2553
       __do_sys_sendmmsg net/socket.c:2582 [inline]
       __se_sys_sendmmsg net/socket.c:2579 [inline]
       __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2579
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      read to 0xffff888133d9a9f8 of 1 bytes by task 23563 on cpu 1:
       __veth_xdp_flush drivers/net/veth.c:268 [inline]
       veth_xmit+0x2d6/0x470 drivers/net/veth.c:350
       __netdev_start_xmit include/linux/netdevice.h:4683 [inline]
       netdev_start_xmit include/linux/netdevice.h:4697 [inline]
       xmit_one+0x105/0x2f0 net/core/dev.c:3473
       dev_hard_start_xmit net/core/dev.c:3489 [inline]
       __dev_queue_xmit+0x86d/0xf90 net/core/dev.c:4116
       dev_queue_xmit+0x13/0x20 net/core/dev.c:4149
       br_dev_queue_push_xmit+0x3ce/0x430 net/bridge/br_forward.c:53
       NF_HOOK include/linux/netfilter.h:307 [inline]
       br_forward_finish net/bridge/br_forward.c:66 [inline]
       NF_HOOK include/linux/netfilter.h:307 [inline]
       __br_forward+0x2e4/0x400 net/bridge/br_forward.c:115
       br_flood+0x521/0x5c0 net/bridge/br_forward.c:242
       br_dev_xmit+0x8b6/0x960
       __netdev_start_xmit include/linux/netdevice.h:4683 [inline]
       netdev_start_xmit include/linux/netdevice.h:4697 [inline]
       xmit_one+0x105/0x2f0 net/core/dev.c:3473
       dev_hard_start_xmit net/core/dev.c:3489 [inline]
       __dev_queue_xmit+0x86d/0xf90 net/core/dev.c:4116
       dev_queue_xmit+0x13/0x20 net/core/dev.c:4149
       neigh_hh_output include/net/neighbour.h:525 [inline]
       neigh_output include/net/neighbour.h:539 [inline]
       ip_finish_output2+0x6f8/0xb70 net/ipv4/ip_output.c:228
       ip_finish_output+0xfb/0x240 net/ipv4/ip_output.c:316
       NF_HOOK_COND include/linux/netfilter.h:296 [inline]
       ip_output+0xf3/0x1a0 net/ipv4/ip_output.c:430
       dst_output include/net/dst.h:451 [inline]
       ip_local_out net/ipv4/ip_output.c:126 [inline]
       ip_send_skb+0x6e/0xe0 net/ipv4/ip_output.c:1570
       udp_send_skb+0x641/0x880 net/ipv4/udp.c:967
       udp_sendmsg+0x12ea/0x14c0 net/ipv4/udp.c:1254
       inet_sendmsg+0x5f/0x80 net/ipv4/af_inet.c:819
       sock_sendmsg_nosec net/socket.c:705 [inline]
       sock_sendmsg net/socket.c:725 [inline]
       ____sys_sendmsg+0x39a/0x510 net/socket.c:2413
       ___sys_sendmsg net/socket.c:2467 [inline]
       __sys_sendmmsg+0x267/0x4c0 net/socket.c:2553
       __do_sys_sendmmsg net/socket.c:2582 [inline]
       __se_sys_sendmmsg net/socket.c:2579 [inline]
       __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2579
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      value changed: 0x00 -> 0x01
      
      Reported by Kernel Concurrency Sanitizer on:
      CPU: 1 PID: 23563 Comm: syz-executor.5 Not tainted 5.17.0-rc2-syzkaller-00064-gc36c04c2e132 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      
      Fixes: 948d4f21
      
       ("veth: Add driver XDP")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
      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>
      bf99c144
    • Antoine Tenart's avatar
      net: fix a memleak when uncloning an skb dst and its metadata · 00e6d6c3
      Antoine Tenart authored
      [ Upstream commit 9eeabdf1 ]
      
      When uncloning an skb dst and its associated metadata, a new
      dst+metadata is allocated and later replaces the old one in the skb.
      This is helpful to have a non-shared dst+metadata attached to a specific
      skb.
      
      The issue is the uncloned dst+metadata is initialized with a refcount of
      1, which is increased to 2 before attaching it to the skb. When
      tun_dst_unclone returns, the dst+metadata is only referenced from a
      single place (the skb) while its refcount is 2. Its refcount will never
      drop to 0 (when the skb is consumed), leading to a memory leak.
      
      Fix this by removing the call to dst_hold in tun_dst_unclone, as the
      dst+metadata refcount is already 1.
      
      Fixes: fc4099f1
      
       ("openvswitch: Fix egress tunnel info.")
      Cc: Pravin B Shelar <pshelar@ovn.org>
      Reported-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Tested-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Signed-off-by: default avatarAntoine Tenart <atenart@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      00e6d6c3
    • Antoine Tenart's avatar
      net: do not keep the dst cache when uncloning an skb dst and its metadata · 2e9fd2d0
      Antoine Tenart authored
      [ Upstream commit cfc56f85 ]
      
      When uncloning an skb dst and its associated metadata a new dst+metadata
      is allocated and the tunnel information from the old metadata is copied
      over there.
      
      The issue is the tunnel metadata has references to cached dst, which are
      copied along the way. When a dst+metadata refcount drops to 0 the
      metadata is freed including the cached dst entries. As they are also
      referenced in the initial dst+metadata, this ends up in UaFs.
      
      In practice the above did not happen because of another issue, the
      dst+metadata was never freed because its refcount never dropped to 0
      (this will be fixed in a subsequent patch).
      
      Fix this by initializing the dst cache after copying the tunnel
      information from the old metadata to also unshare the dst cache.
      
      Fixes: d71785ff
      
       ("net: add dst_cache to ovs vxlan lwtunnel")
      Cc: Paolo Abeni <pabeni@redhat.com>
      Reported-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Tested-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Signed-off-by: default avatarAntoine Tenart <atenart@kernel.org>
      Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2e9fd2d0
    • Louis Peens's avatar
      nfp: flower: fix ida_idx not being released · 0bae953d
      Louis Peens authored
      [ Upstream commit 7db788ad ]
      
      When looking for a global mac index the extra NFP_TUN_PRE_TUN_IDX_BIT
      that gets set if nfp_flower_is_supported_bridge is true is not taken
      into account. Consequently the path that should release the ida_index
      in cleanup is never triggered, causing messages like:
      
          nfp 0000:02:00.0: nfp: Failed to offload MAC on br-ex.
          nfp 0000:02:00.0: nfp: Failed to offload MAC on br-ex.
          nfp 0000:02:00.0: nfp: Failed to offload MAC on br-ex.
      
      after NFP_MAX_MAC_INDEX number of reconfigs. Ultimately this lead to
      new tunnel flows not being offloaded.
      
      Fix this by unsetting the NFP_TUN_PRE_TUN_IDX_BIT before checking if
      the port is of type OTHER.
      
      Fixes: 2e0bc7f3
      
       ("nfp: flower: encode mac indexes with pre-tunnel rule check")
      Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
      Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
      Link: https://lore.kernel.org/r/20220208101453.321949-1-simon.horman@corigine.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0bae953d
    • Eric Dumazet's avatar
      ipmr,ip6mr: acquire RTNL before calling ip[6]mr_free_table() on failure path · 09ac0fcb
      Eric Dumazet authored
      [ Upstream commit 5611a006 ]
      
      ip[6]mr_free_table() can only be called under RTNL lock.
      
      RTNL: assertion failed at net/core/dev.c (10367)
      WARNING: CPU: 1 PID: 5890 at net/core/dev.c:10367 unregister_netdevice_many+0x1246/0x1850 net/core/dev.c:10367
      Modules linked in:
      CPU: 1 PID: 5890 Comm: syz-executor.2 Not tainted 5.16.0-syzkaller-11627-g422ee58dc0ef #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      RIP: 0010:unregister_netdevice_many+0x1246/0x1850 net/core/dev.c:10367
      Code: 0f 85 9b ee ff ff e8 69 07 4b fa ba 7f 28 00 00 48 c7 c6 00 90 ae 8a 48 c7 c7 40 90 ae 8a c6 05 6d b1 51 06 01 e8 8c 90 d8 01 <0f> 0b e9 70 ee ff ff e8 3e 07 4b fa 4c 89 e7 e8 86 2a 59 fa e9 ee
      RSP: 0018:ffffc900046ff6e0 EFLAGS: 00010286
      RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
      RDX: ffff888050f51d00 RSI: ffffffff815fa008 RDI: fffff520008dfece
      RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
      R10: ffffffff815f3d6e R11: 0000000000000000 R12: 00000000fffffff4
      R13: dffffc0000000000 R14: ffffc900046ff750 R15: ffff88807b7dc000
      FS:  00007f4ab736e700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007fee0b4f8990 CR3: 000000001e7d2000 CR4: 00000000003506e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
       mroute_clean_tables+0x244/0xb40 net/ipv6/ip6mr.c:1509
       ip6mr_free_table net/ipv6/ip6mr.c:389 [inline]
       ip6mr_rules_init net/ipv6/ip6mr.c:246 [inline]
       ip6mr_net_init net/ipv6/ip6mr.c:1306 [inline]
       ip6mr_net_init+0x3f0/0x4e0 net/ipv6/ip6mr.c:1298
       ops_init+0xaf/0x470 net/core/net_namespace.c:140
       setup_net+0x54f/0xbb0 net/core/net_namespace.c:331
       copy_net_ns+0x318/0x760 net/core/net_namespace.c:475
       create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110
       copy_namespaces+0x391/0x450 kernel/nsproxy.c:178
       copy_process+0x2e0c/0x7300 kernel/fork.c:2167
       kernel_clone+0xe7/0xab0 kernel/fork.c:2555
       __do_sys_clone+0xc8/0x110 kernel/fork.c:2672
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      RIP: 0033:0x7f4ab89f9059
      Code: Unable to access opcode bytes at RIP 0x7f4ab89f902f.
      RSP: 002b:00007f4ab736e118 EFLAGS: 00000206 ORIG_RAX: 0000000000000038
      RAX: ffffffffffffffda RBX: 00007f4ab8b0bf60 RCX: 00007f4ab89f9059
      RDX: 0000000020000280 RSI: 0000000020000270 RDI: 0000000040200000
      RBP: 00007f4ab8a5308d R08: 0000000020000300 R09: 0000000020000300
      R10: 00000000200002c0 R11: 0000000000000206 R12: 0000000000000000
      R13: 00007ffc3977cc1f R14: 00007f4ab736e300 R15: 0000000000022000
       </TASK>
      
      Fixes: f243e5a7
      
       ("ipmr,ip6mr: call ip6mr_free_table() on failure path")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Cong Wang <cong.wang@bytedance.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Link: https://lore.kernel.org/r/20220208053451.2885398-1-eric.dumazet@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      09ac0fcb
    • Vladimir Oltean's avatar
      net: dsa: lantiq_gswip: don't use devres for mdiobus · e177d2e8
      Vladimir Oltean authored
      [ Upstream commit 0d120dfb ]
      
      As explained in commits:
      74b6d7d1 ("net: dsa: realtek: register the MDIO bus under devres")
      5135e96a ("net: dsa: don't allocate the slave_mii_bus using devres")
      
      mdiobus_free() will panic when called from devm_mdiobus_free() <-
      devres_release_all() <- __device_release_driver(), and that mdiobus was
      not previously unregistered.
      
      The GSWIP switch is a platform device, so the initial set of constraints
      that I thought would cause this (I2C or SPI buses which call ->remove on
      ->shutdown) do not apply. But there is one more which applies here.
      
      If the DSA master itself is on a bus that calls ->remove from ->shutdown
      (like dpaa2-eth, which is on the fsl-mc bus), there is a device link
      between the switch and the DSA master, and device_links_unbind_consumers()
      will unbind the GSWIP switch driver on shutdown.
      
      So the same treatment must be applied to all DSA switch drivers, which
      is: either use devres for both the mdiobus allocation and registration,
      or don't use devres at all.
      
      The gswip driver has the code structure in place for orderly mdiobus
      removal, so just replace devm_mdiobus_alloc() with the non-devres
      variant, and add manual free where necessary, to ensure that we don't
      let devres free a still-registered bus.
      
      Fixes: ac3a68d5
      
       ("net: phy: don't abuse devres in devm_mdiobus_register()")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e177d2e8
    • Vladimir Oltean's avatar
      net: dsa: felix: don't use devres for mdiobus · 95e5402f
      Vladimir Oltean authored
      [ Upstream commit 209bdb7e ]
      
      As explained in commits:
      74b6d7d1 ("net: dsa: realtek: register the MDIO bus under devres")
      5135e96a ("net: dsa: don't allocate the slave_mii_bus using devres")
      
      mdiobus_free() will panic when called from devm_mdiobus_free() <-
      devres_release_all() <- __device_release_driver(), and that mdiobus was
      not previously unregistered.
      
      The Felix VSC9959 switch is a PCI device, so the initial set of
      constraints that I thought would cause this (I2C or SPI buses which call
      ->remove on ->shutdown) do not apply. But there is one more which
      applies here.
      
      If the DSA master itself is on a bus that calls ->remove from ->shutdown
      (like dpaa2-eth, which is on the fsl-mc bus), there is a device link
      between the switch and the DSA master, and device_links_unbind_consumers()
      will unbind the felix switch driver on shutdown.
      
      So the same treatment must be applied to all DSA switch drivers, which
      is: either use devres for both the mdiobus allocation and registration,
      or don't use devres at all.
      
      The felix driver has the code structure in place for orderly mdiobus
      removal, so just replace devm_mdiobus_alloc_size() with the non-devres
      variant, and add manual free where necessary, to ensure that we don't
      let devres free a still-registered bus.
      
      Fixes: ac3a68d5
      
       ("net: phy: don't abuse devres in devm_mdiobus_register()")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      95e5402f
    • Vladimir Oltean's avatar
      net: dsa: bcm_sf2: don't use devres for mdiobus · 2770b795
      Vladimir Oltean authored
      [ Upstream commit 08f1a208 ]
      
      As explained in commits:
      74b6d7d1 ("net: dsa: realtek: register the MDIO bus under devres")
      5135e96a ("net: dsa: don't allocate the slave_mii_bus using devres")
      
      mdiobus_free() will panic when called from devm_mdiobus_free() <-
      devres_release_all() <- __device_release_driver(), and that mdiobus was
      not previously unregistered.
      
      The Starfighter 2 is a platform device, so the initial set of
      constraints that I thought would cause this (I2C or SPI buses which call
      ->remove on ->shutdown) do not apply. But there is one more which
      applies here.
      
      If the DSA master itself is on a bus that calls ->remove from ->shutdown
      (like dpaa2-eth, which is on the fsl-mc bus), there is a device link
      between the switch and the DSA master, and device_links_unbind_consumers()
      will unbind the bcm_sf2 switch driver on shutdown.
      
      So the same treatment must be applied to all DSA switch drivers, which
      is: either use devres for both the mdiobus allocation and registration,
      or don't use devres at all.
      
      The bcm_sf2 driver has the code structure in place for orderly mdiobus
      removal, so just replace devm_mdiobus_alloc() with the non-devres
      variant, and add manual free where necessary, to ensure that we don't
      let devres free a still-registered bus.
      
      Fixes: ac3a68d5
      
       ("net: phy: don't abuse devres in devm_mdiobus_register()")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2770b795
    • Vladimir Oltean's avatar
      net: dsa: ar9331: register the mdiobus under devres · 475ce5dc
      Vladimir Oltean authored
      [ Upstream commit 50facd86 ]
      
      As explained in commits:
      74b6d7d1 ("net: dsa: realtek: register the MDIO bus under devres")
      5135e96a ("net: dsa: don't allocate the slave_mii_bus using devres")
      
      mdiobus_free() will panic when called from devm_mdiobus_free() <-
      devres_release_all() <- __device_release_driver(), and that mdiobus was
      not previously unregistered.
      
      The ar9331 is an MDIO device, so the initial set of constraints that I
      thought would cause this (I2C or SPI buses which call ->remove on
      ->shutdown) do not apply. But there is one more which applies here.
      
      If the DSA master itself is on a bus that calls ->remove from ->shutdown
      (like dpaa2-eth, which is on the fsl-mc bus), there is a device link
      between the switch and the DSA master, and device_links_unbind_consumers()
      will unbind the ar9331 switch driver on shutdown.
      
      So the same treatment must be applied to all DSA switch drivers, which
      is: either use devres for both the mdiobus allocation and registration,
      or don't use devres at all.
      
      The ar9331 driver doesn't have a complex code structure for mdiobus
      removal, so just replace of_mdiobus_register with the devres variant in
      order to be all-devres and ensure that we don't free a still-registered
      bus.
      
      Fixes: ac3a68d5
      
       ("net: phy: don't abuse devres in devm_mdiobus_register()")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Tested-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      475ce5dc
    • Vladimir Oltean's avatar
      net: dsa: mv88e6xxx: don't use devres for mdiobus · 8ccebe77
      Vladimir Oltean authored
      [ Upstream commit f53a2ce8 ]
      
      As explained in commits:
      74b6d7d1 ("net: dsa: realtek: register the MDIO bus under devres")
      5135e96a ("net: dsa: don't allocate the slave_mii_bus using devres")
      
      mdiobus_free() will panic when called from devm_mdiobus_free() <-
      devres_release_all() <- __device_release_driver(), and that mdiobus was
      not previously unregistered.
      
      The mv88e6xxx is an MDIO device, so the initial set of constraints that
      I thought would cause this (I2C or SPI buses which call ->remove on
      ->shutdown) do not apply. But there is one more which applies here.
      
      If the DSA master itself is on a bus that calls ->remove from ->shutdown
      (like dpaa2-eth, which is on the fsl-mc bus), there is a device link
      between the switch and the DSA master, and device_links_unbind_consumers()
      will unbind the Marvell switch driver on shutdown.
      
      systemd-shutdown[1]: Powering off.
      mv88e6085 0x0000000008b96000:00 sw_gl0: Link is Down
      fsl-mc dpbp.9: Removing from iommu group 7
      fsl-mc dpbp.8: Removing from iommu group 7
      ------------[ cut here ]------------
      kernel BUG at drivers/net/phy/mdio_bus.c:677!
      Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
      Modules linked in:
      CPU: 0 PID: 1 Comm: systemd-shutdow Not tainted 5.16.5-00040-gdc05f73788e5 #15
      pc : mdiobus_free+0x44/0x50
      lr : devm_mdiobus_free+0x10/0x20
      Call trace:
       mdiobus_free+0x44/0x50
       devm_mdiobus_free+0x10/0x20
       devres_release_all+0xa0/0x100
       __device_release_driver+0x190/0x220
       device_release_driver_internal+0xac/0xb0
       device_links_unbind_consumers+0xd4/0x100
       __device_release_driver+0x4c/0x220
       device_release_driver_internal+0xac/0xb0
       device_links_unbind_consumers+0xd4/0x100
       __device_release_driver+0x94/0x220
       device_release_driver+0x28/0x40
       bus_remove_device+0x118/0x124
       device_del+0x174/0x420
       fsl_mc_device_remove+0x24/0x40
       __fsl_mc_device_remove+0xc/0x20
       device_for_each_child+0x58/0xa0
       dprc_remove+0x90/0xb0
       fsl_mc_driver_remove+0x20/0x5c
       __device_release_driver+0x21c/0x220
       device_release_driver+0x28/0x40
       bus_remove_device+0x118/0x124
       device_del+0x174/0x420
       fsl_mc_bus_remove+0x80/0x100
       fsl_mc_bus_shutdown+0xc/0x1c
       platform_shutdown+0x20/0x30
       device_shutdown+0x154/0x330
       kernel_power_off+0x34/0x6c
       __do_sys_reboot+0x15c/0x250
       __arm64_sys_reboot+0x20/0x30
       invoke_syscall.constprop.0+0x4c/0xe0
       do_el0_svc+0x4c/0x150
       el0_svc+0x24/0xb0
       el0t_64_sync_handler+0xa8/0xb0
       el0t_64_sync+0x178/0x17c
      
      So the same treatment must be applied to all DSA switch drivers, which
      is: either use devres for both the mdiobus allocation and registration,
      or don't use devres at all.
      
      The Marvell driver already has a good structure for mdiobus removal, so
      just plug in mdiobus_free and get rid of devres.
      
      Fixes: ac3a68d5
      
       ("net: phy: don't abuse devres in devm_mdiobus_register()")
      Reported-by: default avatarRafael Richter <Rafael.Richter@gin.de>
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Tested-by: default avatarDaniel Klauer <daniel.klauer@gin.de>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8ccebe77
    • Mahesh Bandewar's avatar
      bonding: pair enable_port with slave_arr_updates · 4a384c1e
      Mahesh Bandewar authored
      [ Upstream commit 23de0d7b ]
      
      When 803.2ad mode enables a participating port, it should update
      the slave-array. I have observed that the member links are participating
      and are part of the active aggregator while the traffic is egressing via
      only one member link (in a case where two links are participating). Via
      kprobes I discovered that slave-arr has only one link added while
      the other participating link wasn't part of the slave-arr.
      
      I couldn't see what caused that situation but the simple code-walk
      through provided me hints that the enable_port wasn't always associated
      with the slave-array update.
      
      Fixes: ee637714
      
       ("bonding: Simplify the xmit function for modes that use xmit_hash")
      Signed-off-by: default avatarMahesh Bandewar <maheshb@google.com>
      Acked-by: default avatarJay Vosburgh <jay.vosburgh@canonical.com>
      Link: https://lore.kernel.org/r/20220207222901.1795287-1-maheshb@google.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4a384c1e
    • Niklas Cassel's avatar
      gpio: sifive: use the correct register to read output values · 1ba45dd3
      Niklas Cassel authored
      [ Upstream commit cc38ef93 ]
      
      Setting the output of a GPIO to 1 using gpiod_set_value(), followed by
      reading the same GPIO using gpiod_get_value(), will currently yield an
      incorrect result.
      
      This is because the SiFive GPIO device stores the output values in reg_set,
      not reg_dat.
      
      Supply the flag BGPIOF_READ_OUTPUT_REG_SET to bgpio_init() so that the
      generic driver reads the correct register.
      
      Fixes: 96868dce
      
       ("gpio/sifive: Add GPIO driver for SiFive SoCs")
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      [Bartosz: added the Fixes tag]
      Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1ba45dd3
    • Rafael J. Wysocki's avatar
      ACPI: PM: s2idle: Cancel wakeup before dispatching EC GPE · 48e41308
      Rafael J. Wysocki authored
      [ Upstream commit dc0075ba ]
      
      Commit 4a9af6ca ("ACPI: EC: Rework flushing of EC work while
      suspended to idle") made acpi_ec_dispatch_gpe() check
      pm_wakeup_pending(), but that is before canceling the SCI wakeup,
      so pm_wakeup_pending() is always true.  This causes the loop in
      acpi_ec_dispatch_gpe() to always terminate after one iteration which
      may not be correct.
      
      Address this issue by canceling the SCI wakeup earlier, from
      acpi_ec_dispatch_gpe() itself.
      
      Fixes: 4a9af6ca
      
       ("ACPI: EC: Rework flushing of EC work while suspended to idle")
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      48e41308
    • Christoph Niedermaier's avatar
      drm/panel: simple: Assign data from panel_dpi_probe() correctly · 3b72d3f0
      Christoph Niedermaier authored
      [ Upstream commit 6df4432a ]
      
      In the function panel_simple_probe() the pointer panel->desc is
      assigned to the passed pointer desc. If function panel_dpi_probe()
      is called panel->desc will be updated, but further on only desc
      will be evaluated. So update the desc pointer to be able to use
      the data from the function panel_dpi_probe().
      
      Fixes: 4a1d0dbc
      
       ("drm/panel: simple: add panel-dpi support")
      
      Signed-off-by: default avatarChristoph Niedermaier <cniedermaier@dh-electronics.com>
      Cc: Marek Vasut <marex@denx.de>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      To: dri-devel@lists.freedesktop.org
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220201110153.3479-1-cniedermaier@dh-electronics.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3b72d3f0
    • Samuel Mendoza-Jonas's avatar
      ixgbevf: Require large buffers for build_skb on 82599VF · bf356391
      Samuel Mendoza-Jonas authored
      [ Upstream commit fe68195d ]
      
      From 4.17 onwards the ixgbevf driver uses build_skb() to build an skb
      around new data in the page buffer shared with the ixgbe PF.
      This uses either a 2K or 3K buffer, and offsets the DMA mapping by
      NET_SKB_PAD + NET_IP_ALIGN. When using a smaller buffer RXDCTL is set to
      ensure the PF does not write a full 2K bytes into the buffer, which is
      actually 2K minus the offset.
      
      However on the 82599 virtual function, the RXDCTL mechanism is not
      available. The driver attempts to work around this by using the SET_LPE
      mailbox method to lower the maximm frame size, but the ixgbe PF driver
      ignores this in order to keep the PF and all VFs in sync[0].
      
      This means the PF will write up to the full 2K set in SRRCTL, causing it
      to write NET_SKB_PAD + NET_IP_ALIGN bytes past the end of the buffer.
      With 4K pages split into two buffers, this means it either writes
      NET_SKB_PAD + NET_IP_ALIGN bytes past the first buffer (and into the
      second), or NET_SKB_PAD + NET_IP_ALIGN bytes past the end of the DMA
      mapping.
      
      Avoid this by only enabling build_skb when using "large" buffers (3K).
      These are placed in each half of an order-1 page, preventing the PF from
      writing past the end of the mapping.
      
      [0]: Technically it only ever raises the max frame size, see
      ixgbe_set_vf_lpe() in ixgbe_sriov.c
      
      Fixes: f15c5ba5
      
       ("ixgbevf: add support for using order 1 pages to receive large frames")
      Signed-off-by: default avatarSamuel Mendoza-Jonas <samjonas@amazon.com>
      Tested-by: default avatarKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bf356391
    • Dongjin Kim's avatar
      arm64: dts: meson-g12b-odroid-n2: fix typo 'dio2133' · e5a64f54
      Dongjin Kim authored
      [ Upstream commit bc41099f
      
       ]
      
      Typo in audio amplifier node, dioo2133 -> dio2133
      
      Signed-off-by: default avatarDongjin Kim <tobetter@gmail.com>
      Fixes: ef599f5f ("arm64: dts: meson: convert ODROID-N2 to dtsi")
      Fixes: 67d141c1
      
       ("arm64: dts: meson: odroid-n2: add jack audio output support")
      Reviewed-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Link: https://lore.kernel.org/r/YfKQJejh0bfGYvof@anyang
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e5a64f54
    • Florian Westphal's avatar
      netfilter: ctnetlink: disable helper autoassign · 04fe6569
      Florian Westphal authored
      [ Upstream commit d1ca60ef ]
      
      When userspace, e.g. conntrackd, inserts an entry with a specified helper,
      its possible that the helper is lost immediately after its added:
      
      ctnetlink_create_conntrack
        -> nf_ct_helper_ext_add + assign helper
          -> ctnetlink_setup_nat
            -> ctnetlink_parse_nat_setup
               -> parse_nat_setup -> nfnetlink_parse_nat_setup
      	                       -> nf_nat_setup_info
                                       -> nf_conntrack_alter_reply
                                         -> __nf_ct_try_assign_helper
      
      ... and __nf_ct_try_assign_helper will zero the helper again.
      
      Set IPS_HELPER bit to bypass auto-assign logic, its unwanted, just like
      when helper is assigned via ruleset.
      
      Dropped old 'not strictly necessary' comment, it referred to use of
      rcu_assign_pointer() before it got replaced by RCU_INIT_POINTER().
      
      NB: Fixes tag intentionally incorrect, this extends the referenced commit,
      but this change won't build without IPS_HELPER introduced there.
      
      Fixes: 6714cf54
      
       ("netfilter: nf_conntrack: fix explicit helper attachment and NAT")
      Reported-by: default avatarPham Thanh Tuyen <phamtyn@gmail.com>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      04fe6569
    • Mathias Krause's avatar
      misc: fastrpc: avoid double fput() on failed usercopy · a5ce7ee5
      Mathias Krause authored
      [ Upstream commit 46963e2e ]
      
      If the copy back to userland fails for the FASTRPC_IOCTL_ALLOC_DMA_BUFF
      ioctl(), we shouldn't assume that 'buf->dmabuf' is still valid. In fact,
      dma_buf_fd() called fd_install() before, i.e. "consumed" one reference,
      leaving us with none.
      
      Calling dma_buf_put() will therefore put a reference we no longer own,
      leading to a valid file descritor table entry for an already released
      'file' object which is a straight use-after-free.
      
      Simply avoid calling dma_buf_put() and rely on the process exit code to
      do the necessary cleanup, if needed, i.e. if the file descriptor is
      still valid.
      
      Fixes: 6cffd795
      
       ("misc: fastrpc: Add support for dmabuf exporter")
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarMathias Krause <minipli@grsecurity.net>
      Link: https://lore.kernel.org/r/20220127130218.809261-1-minipli@grsecurity.net
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a5ce7ee5
    • Dave Stevenson's avatar
      drm/vc4: hdmi: Allow DBLCLK modes even if horz timing is odd. · 21c890ca
      Dave Stevenson authored
      [ Upstream commit 1d118965 ]
      
      The 2711 pixel valve can't produce odd horizontal timings, and
      checks were added to vc4_hdmi_encoder_atomic_check and
      vc4_hdmi_encoder_mode_valid to filter out/block selection of
      such modes.
      
      Modes with DRM_MODE_FLAG_DBLCLK double all the horizontal timing
      values before programming them into the PV. The PV values,
      therefore, can not be odd, and so the modes can be supported.
      
      Amend the filtering appropriately.
      
      Fixes: 57fb32e6
      
       ("drm/vc4: hdmi: Block odd horizontal timings")
      Signed-off-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220127135116.298278-1-maxime@cerno.tech
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      21c890ca
    • Geert Uytterhoeven's avatar
      gpio: aggregator: Fix calling into sleeping GPIO controllers · 70ea0056
      Geert Uytterhoeven authored
      [ Upstream commit 2cba0545
      
       ]
      
      If the parent GPIO controller is a sleeping controller (e.g. a GPIO
      controller connected to I2C), getting or setting a GPIO triggers a
      might_sleep() warning.  This happens because the GPIO Aggregator takes
      the can_sleep flag into account only for its internal locking, not for
      calling into the parent GPIO controller.
      
      Fix this by using the gpiod_[gs]et*_cansleep() APIs when calling into a
      sleeping GPIO controller.
      
      Reported-by: default avatarMikko Salomäki <ms@datarespons.se>
      Fixes: 828546e2
      
       ("gpio: Add GPIO Aggregator")
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      70ea0056
    • Udipto Goswami's avatar
      usb: f_fs: Fix use-after-free for epfile · 0042178a
      Udipto Goswami authored
      [ Upstream commit ebe2b1ad ]
      
      Consider a case where ffs_func_eps_disable is called from
      ffs_func_disable as part of composition switch and at the
      same time ffs_epfile_release get called from userspace.
      ffs_epfile_release will free up the read buffer and call
      ffs_data_closed which in turn destroys ffs->epfiles and
      mark it as NULL. While this was happening the driver has
      already initialized the local epfile in ffs_func_eps_disable
      which is now freed and waiting to acquire the spinlock. Once
      spinlock is acquired the driver proceeds with the stale value
      of epfile and tries to free the already freed read buffer
      causing use-after-free.
      
      Following is the illustration of the race:
      
            CPU1                                  CPU2
      
         ffs_func_eps_disable
         epfiles (local copy)
      					ffs_epfile_release
      					ffs_data_closed
      					if (last file closed)
      					ffs_data_reset
      					ffs_data_clear
      					ffs_epfiles_destroy
      spin_lock
      dereference epfiles
      
      Fix this races by taking epfiles local copy & assigning it under
      spinlock and if epfiles(local) is null then update it in ffs->epfiles
      then finally destroy it.
      Extending the scope further from the race, protecting the ep related
      structures, and concurrent accesses.
      
      Fixes: a9e6f83c
      
       ("usb: gadget: f_fs: stop sleeping in ffs_func_eps_disable")
      Co-developed-by: default avatarUdipto Goswami <quic_ugoswami@quicinc.com>
      Reviewed-by: default avatarJohn Keeping <john@metanate.com>
      Signed-off-by: default avatarPratham Pratap <quic_ppratap@quicinc.com>
      Signed-off-by: default avatarUdipto Goswami <quic_ugoswami@quicinc.com>
      Link: https://lore.kernel.org/r/1643256595-10797-1-git-send-email-quic_ugoswami@quicinc.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0042178a
    • Rob Herring's avatar
      ARM: dts: imx7ulp: Fix 'assigned-clocks-parents' typo · 5a37fd9f
      Rob Herring authored
      [ Upstream commit 6d58c5e2
      
       ]
      
      The correct property name is 'assigned-clock-parents', not
      'assigned-clocks-parents'. Though if the platform works with the typo, one
      has to wonder if the property is even needed.
      
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Fixes: 8b8c7d97
      
       ("ARM: dts: imx7ulp: Add wdog1 node")
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5a37fd9f
    • Robert Hancock's avatar
      phy: xilinx: zynqmp: Fix bus width setting for SGMII · 39bf132a
      Robert Hancock authored
      [ Upstream commit 37291f60 ]
      
      TX_PROT_BUS_WIDTH and RX_PROT_BUS_WIDTH are single registers with
      separate bit fields for each lane. The code in xpsgtr_phy_init_sgmii was
      not preserving the existing register value for other lanes, so enabling
      the PHY in SGMII mode on one lane zeroed out the settings for all other
      lanes, causing other PS-GTR peripherals such as USB3 to malfunction.
      
      Use xpsgtr_clr_set to only manipulate the desired bits in the register.
      
      Fixes: 4a33bea0
      
       ("phy: zynqmp: Add PHY driver for the Xilinx ZynqMP Gigabit Transceiver")
      Signed-off-by: default avatarRobert Hancock <robert.hancock@calian.com>
      Acked-by: default avatarMichal Simek <michal.simek@xilinx.com>
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Link: https://lore.kernel.org/r/20220126001600.1592218-1-robert.hancock@calian.com
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      39bf132a
    • Fabio Estevam's avatar
      ARM: dts: imx6qdl-udoo: Properly describe the SD card detect · 108868da
      Fabio Estevam authored
      [ Upstream commit 993d6614 ]
      
      GPIO7_IO00 is used as SD card detect.
      
      Properly describe this in the devicetree.
      
      Fixes: 40cdaa54
      
       ("ARM: dts: imx6q-udoo: Add initial board support")
      Signed-off-by: default avatarFabio Estevam <festevam@gmail.com>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      108868da
    • Uwe Kleine-König's avatar
      staging: fbtft: Fix error path in fbtft_driver_module_init() · 0a7b5e8d
      Uwe Kleine-König authored
      [ Upstream commit 426aca16 ]
      
      If registering the platform driver fails, the function must not return
      without undoing the spi driver registration first.
      
      Fixes: c296d5f9
      
       ("staging: fbtft: core support")
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Link: https://lore.kernel.org/r/20220118181338.207943-1-u.kleine-koenig@pengutronix.de
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0a7b5e8d
    • Martin Blumenstingl's avatar
      ARM: dts: meson8b: Fix the UART device-tree schema validation · 74cd5cb2
      Martin Blumenstingl authored
      [ Upstream commit 3375aa77 ]
      
      The dt-bindings for the UART controller only allow the following values
      for Meson8 SoCs:
      - "amlogic,meson8b-uart", "amlogic,meson-ao-uart"
      - "amlogic,meson8b-uart"
      
      Use the correct fallback compatible string "amlogic,meson-ao-uart" for
      AO UART. Drop the "amlogic,meson-uart" compatible string from the EE
      domain UART controllers.
      
      Also update the order of the clocks to match the order defined in the
      yaml bindings.
      
      Fixes: b02d6e73
      
       ("ARM: dts: meson8b: use stable UART bindings with correct gate clock")
      Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Link: https://lore.kernel.org/r/20211227180026.4068352-4-martin.blumenstingl@googlemail.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      74cd5cb2