Skip to content
  1. Dec 14, 2021
    • Douglas Anderson's avatar
      Revert "usb: dwc3: dwc3-qcom: Enable tx-fifo-resize property by default" · f5230fb9
      Douglas Anderson authored
      commit 6a97cee3 upstream.
      
      This reverts commit cefdd52f.
      
      On sc7180-trogdor class devices with 'fw_devlink=permissive' and KASAN
      enabled, you'll see a Use-After-Free reported at bootup.
      
      The root of the problem is that dwc3_qcom_of_register_core() is adding
      a devm-allocated "tx-fifo-resize" property to its device tree node
      using of_add_property().
      
      The issue is that of_add_property() makes a _permanent_ addition to
      the device tree that lasts until reboot. That means allocating memory
      for the property using "devm" managed memory is a terrible idea since
      that memory will be freed upon probe deferral or device unbinding.
      
      Let's revert the patch since the system is still functional without
      it. The fact that of_add_property() makes a permanent change is extra
      fodder for those folks who were aruging that the device tree isn't
      really the right way to pass information between parts of the
      driver. It is an exercise left to the reader to submit a patch
      re-adding the new feature in a way that makes everyone happier.
      
      Fixes: cefdd52f
      
       ("usb: dwc3: dwc3-qcom: Enable tx-fifo-resize property by default")
      Cc: stable <stable@vger.kernel.org>
      Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Link: https://lore.kernel.org/r/20211207094327.1.Ie3cde3443039342e2963262a4c3ac36dc2c08b30@changeid
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f5230fb9
    • Greg Kroah-Hartman's avatar
      USB: gadget: zero allocate endpoint 0 buffers · 6eea4ace
      Greg Kroah-Hartman authored
      commit 86ebbc11
      
       upstream.
      
      Under some conditions, USB gadget devices can show allocated buffer
      contents to a host.  Fix this up by zero-allocating them so that any
      extra data will all just be zeros.
      
      Reported-by: default avatarSzymon Heidrich <szymon.heidrich@gmail.com>
      Tested-by: default avatarSzymon Heidrich <szymon.heidrich@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6eea4ace
    • Greg Kroah-Hartman's avatar
      USB: gadget: detect too-big endpoint 0 requests · 36dfdf11
      Greg Kroah-Hartman authored
      commit 153a2d7e
      
       upstream.
      
      Sometimes USB hosts can ask for buffers that are too large from endpoint
      0, which should not be allowed.  If this happens for OUT requests, stall
      the endpoint, but for IN requests, trim the request size to the endpoint
      buffer size.
      
      Co-developed-by: default avatarSzymon Heidrich <szymon.heidrich@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      36dfdf11
    • Peilin Ye's avatar
      selftests/fib_tests: Rework fib_rp_filter_test() · ef472b02
      Peilin Ye authored
      commit f6071e5e upstream.
      
      Currently rp_filter tests in fib_tests.sh:fib_rp_filter_test() are
      failing.  ping sockets are bound to dummy1 using the "-I" option
      (SO_BINDTODEVICE), but socket lookup is failing when receiving ping
      replies, since the routing table thinks they belong to dummy0.
      
      For example, suppose ping is using a SOCK_RAW socket for ICMP messages.
      When receiving ping replies, in __raw_v4_lookup(), sk->sk_bound_dev_if
      is 3 (dummy1), but dif (skb_rtable(skb)->rt_iif) says 2 (dummy0), so the
      raw_sk_bound_dev_eq() check fails.  Similar things happen in
      ping_lookup() for SOCK_DGRAM sockets.
      
      These tests used to pass due to a bug [1] in iputils, where "ping -I"
      actually did not bind ICMP message sockets to device.  The bug has been
      fixed by iputils commit f455fee41c07 ("ping: also bind the ICMP socket
      to the specific device") in 2016, which is why our rp_filter tests
      started to fail.  See [2] .
      
      Fixing the tests while keeping everything in one netns turns out to be
      nontrivial.  Rework the tests and build the following topology:
      
       ┌─────────────────────────────┐    ┌─────────────────────────────┐
       │  network namespace 1 (ns1)  │    │  network namespace 2 (ns2)  │
       │                             │    │                             │
       │  ┌────┐     ┌─────┐         │    │  ┌─────┐            ┌────┐  │
       │  │ lo │<───>│veth1│<────────┼────┼─>│veth2│<──────────>│ lo │  │
       │  └────┘     ├─────┴──────┐  │    │  ├─────┴──────┐     └────┘  │
       │             │192.0.2.1/24│  │    │  │192.0.2.1/24│             │
       │             └────────────┘  │    │  └────────────┘             │
       └─────────────────────────────┘    └─────────────────────────────┘
      
      Consider sending an ICMP_ECHO packet A in ns2.  Both source and
      destination IP addresses are 192.0.2.1, and we use strict mode rp_filter
      in both ns1 and ns2:
      
        1. A is routed to lo since its destination IP address is one of ns2's
           local addresses (veth2);
        2. A is redirected from lo's egress to veth2's egress using mirred;
        3. A arrives at veth1's ingress in ns1;
        4. A is redirected from veth1's ingress to lo's ingress, again, using
           mirred;
        5. In __fib_validate_source(), fib_info_nh_uses_dev() returns false,
           since A was received on lo, but reverse path lookup says veth1;
        6. However A is not dropped since we have relaxed this check for lo in
           commit 66f82095
      
       ("fib: relax source validation check for loopback
           packets");
      
      Making sure A is not dropped here in this corner case is the whole point
      of having this test.
      
        7. As A reaches the ICMP layer, an ICMP_ECHOREPLY packet, B, is
           generated;
        8. Similarly, B is redirected from lo's egress to veth1's egress (in
           ns1), then redirected once again from veth2's ingress to lo's
           ingress (in ns2), using mirred.
      
      Also test "ping 127.0.0.1" from ns2.  It does not trigger the relaxed
      check in __fib_validate_source(), but just to make sure the topology
      works with loopback addresses.
      
      Tested with ping from iputils 20210722-41-gf9fb573:
      
      $ ./fib_tests.sh -t rp_filter
      
      IPv4 rp_filter tests
          TEST: rp_filter passes local packets		[ OK ]
          TEST: rp_filter passes loopback packets		[ OK ]
      
      [1] https://github.com/iputils/iputils/issues/55
      [2] https://github.com/iputils/iputils/commit/f455fee41c077d4b700a473b2f5b3487b8febc1d
      
      Reported-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Fixes: adb701d6
      
       ("selftests: add a test case for rp_filter")
      Reviewed-by: default avatarCong Wang <cong.wang@bytedance.com>
      Signed-off-by: default avatarPeilin Ye <peilin.ye@bytedance.com>
      Acked-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20211201004720.6357-1-yepeilin.cs@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ef472b02
    • Dan Carpenter's avatar
      net/qla3xxx: fix an error code in ql_adapter_up() · a72723e8
      Dan Carpenter authored
      commit d17b9737 upstream.
      
      The ql_wait_for_drvr_lock() fails and returns false, then this
      function should return an error code instead of returning success.
      
      The other problem is that the success path prints an error message
      netdev_err(ndev, "Releasing driver lock\n");  Delete that and
      re-order the code a little to make it more clear.
      
      Fixes: 5a4faa87
      
       ("[PATCH] qla3xxx NIC driver")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Link: https://lore.kernel.org/r/20211207082416.GA16110@kili
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a72723e8
    • Eric Dumazet's avatar
      net, neigh: clear whole pneigh_entry at alloc time · 0c9f1ab2
      Eric Dumazet authored
      commit e195e9b5 upstream.
      
      Commit 2c611ad9 ("net, neigh: Extend neigh->flags to 32 bit
      to allow for extensions") enables a new KMSAM warning [1]
      
      I think the bug is actually older, because the following intruction
      only occurred if ndm->ndm_flags had NTF_PROXY set.
      
      	pn->flags = ndm->ndm_flags;
      
      Let's clear all pneigh_entry fields at alloc time.
      
      [1]
      BUG: KMSAN: uninit-value in pneigh_fill_info+0x986/0xb30 net/core/neighbour.c:2593
       pneigh_fill_info+0x986/0xb30 net/core/neighbour.c:2593
       pneigh_dump_table net/core/neighbour.c:2715 [inline]
       neigh_dump_info+0x1e3f/0x2c60 net/core/neighbour.c:2832
       netlink_dump+0xaca/0x16a0 net/netlink/af_netlink.c:2265
       __netlink_dump_start+0xd1c/0xee0 net/netlink/af_netlink.c:2370
       netlink_dump_start include/linux/netlink.h:254 [inline]
       rtnetlink_rcv_msg+0x181b/0x18c0 net/core/rtnetlink.c:5534
       netlink_rcv_skb+0x447/0x800 net/netlink/af_netlink.c:2491
       rtnetlink_rcv+0x50/0x60 net/core/rtnetlink.c:5589
       netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
       netlink_unicast+0x1095/0x1360 net/netlink/af_netlink.c:1345
       netlink_sendmsg+0x16f3/0x1870 net/netlink/af_netlink.c:1916
       sock_sendmsg_nosec net/socket.c:704 [inline]
       sock_sendmsg net/socket.c:724 [inline]
       sock_write_iter+0x594/0x690 net/socket.c:1057
       call_write_iter include/linux/fs.h:2162 [inline]
       new_sync_write fs/read_write.c:503 [inline]
       vfs_write+0x1318/0x2030 fs/read_write.c:590
       ksys_write+0x28c/0x520 fs/read_write.c:643
       __do_sys_write fs/read_write.c:655 [inline]
       __se_sys_write fs/read_write.c:652 [inline]
       __x64_sys_write+0xdb/0x120 fs/read_write.c:652
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Uninit was created at:
       slab_post_alloc_hook mm/slab.h:524 [inline]
       slab_alloc_node mm/slub.c:3251 [inline]
       slab_alloc mm/slub.c:3259 [inline]
       __kmalloc+0xc3c/0x12d0 mm/slub.c:4437
       kmalloc include/linux/slab.h:595 [inline]
       pneigh_lookup+0x60f/0xd70 net/core/neighbour.c:766
       arp_req_set_public net/ipv4/arp.c:1016 [inline]
       arp_req_set+0x430/0x10a0 net/ipv4/arp.c:1032
       arp_ioctl+0x8d4/0xb60 net/ipv4/arp.c:1232
       inet_ioctl+0x4ef/0x820 net/ipv4/af_inet.c:947
       sock_do_ioctl net/socket.c:1118 [inline]
       sock_ioctl+0xa3f/0x13e0 net/socket.c:1235
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:874 [inline]
       __se_sys_ioctl+0x2df/0x4a0 fs/ioctl.c:860
       __x64_sys_ioctl+0xd8/0x110 fs/ioctl.c:860
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      CPU: 1 PID: 20001 Comm: syz-executor.0 Not tainted 5.16.0-rc3-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      
      Fixes: 62dd9318
      
       ("[IPV6] NDISC: Set per-entry is_router flag in Proxy NA.")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Roopa Prabhu <roopa@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20211206165329.1049835-1-eric.dumazet@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0c9f1ab2
    • Joakim Zhang's avatar
      net: fec: only clear interrupt of handling queue in fec_enet_rx_queue() · 48135149
      Joakim Zhang authored
      commit b5bd95d1 upstream.
      
      Background:
      We have a customer is running a Profinet stack on the 8MM which receives and
      responds PNIO packets every 4ms and PNIO-CM packets every 40ms. However, from
      time to time the received PNIO-CM package is "stock" and is only handled when
      receiving a new PNIO-CM or DCERPC-Ping packet (tcpdump shows the PNIO-CM and
      the DCERPC-Ping packet at the same time but the PNIO-CM HW timestamp is from
      the expected 40 ms and not the 2s delay of the DCERPC-Ping).
      
      After debugging, we noticed PNIO, PNIO-CM and DCERPC-Ping packets would
      be handled by different RX queues.
      
      The root cause should be driver ack all queues' interrupt when handle a
      specific queue in fec_enet_rx_queue(). The blamed patch is introduced to
      receive as much packets as possible once to avoid interrupt flooding.
      But it's unreasonable to clear other queues'interrupt when handling one
      queue, this patch tries to fix it.
      
      Fixes: ed63f1dc
      
       (net: fec: clear receive interrupts before processing a packet)
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Reported-by: default avatarNicolas Diaz <nicolas.diaz@nxp.com>
      Signed-off-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
      Link: https://lore.kernel.org/r/20211206135457.15946-1-qiangqing.zhang@nxp.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      48135149
    • Dan Carpenter's avatar
      net: altera: set a couple error code in probe() · 089bd0b0
      Dan Carpenter authored
      commit badd7857 upstream.
      
      There are two error paths which accidentally return success instead of
      a negative error code.
      
      Fixes: bbd2190c
      
       ("Altera TSE: Add main and header file for Altera Ethernet Driver")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      089bd0b0
    • Lee Jones's avatar
      net: cdc_ncm: Allow for dwNtbOutMaxSize to be unset or zero · 37493d4e
      Lee Jones authored
      commit 2be6d4d1 upstream.
      
      Currently, due to the sequential use of min_t() and clamp_t() macros,
      in cdc_ncm_check_tx_max(), if dwNtbOutMaxSize is not set, the logic
      sets tx_max to 0.  This is then used to allocate the data area of the
      SKB requested later in cdc_ncm_fill_tx_frame().
      
      This does not cause an issue presently because when memory is
      allocated during initialisation phase of SKB creation, more memory
      (512b) is allocated than is required for the SKB headers alone (320b),
      leaving some space (512b - 320b = 192b) for CDC data (172b).
      
      However, if more elements (for example 3 x u64 = [24b]) were added to
      one of the SKB header structs, say 'struct skb_shared_info',
      increasing its original size (320b [320b aligned]) to something larger
      (344b [384b aligned]), then suddenly the CDC data (172b) no longer
      fits in the spare SKB data area (512b - 384b = 128b).
      
      Consequently the SKB bounds checking semantics fails and panics:
      
        skbuff: skb_over_panic: text:ffffffff830a5b5f len:184 put:172   \
           head:ffff888119227c00 data:ffff888119227c00 tail:0xb8 end:0x80 dev:<NULL>
      
        ------------[ cut here ]------------
        kernel BUG at net/core/skbuff.c:110!
        RIP: 0010:skb_panic+0x14f/0x160 net/core/skbuff.c:106
        <snip>
        Call Trace:
         <IRQ>
         skb_over_panic+0x2c/0x30 net/core/skbuff.c:115
         skb_put+0x205/0x210 net/core/skbuff.c:1877
         skb_put_zero include/linux/skbuff.h:2270 [inline]
         cdc_ncm_ndp16 drivers/net/usb/cdc_ncm.c:1116 [inline]
         cdc_ncm_fill_tx_frame+0x127f/0x3d50 drivers/net/usb/cdc_ncm.c:1293
         cdc_ncm_tx_fixup+0x98/0xf0 drivers/net/usb/cdc_ncm.c:1514
      
      By overriding the max value with the default CDC_NCM_NTB_MAX_SIZE_TX
      when not offered through the system provided params, we ensure enough
      data space is allocated to handle the CDC data, meaning no crash will
      occur.
      
      Cc: Oliver Neukum <oliver@neukum.org>
      Fixes: 289507d3
      
       ("net: cdc_ncm: use sysfs for rx/tx aggregation tuning")
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Reviewed-by: default avatarBjørn Mork <bjorn@mork.no>
      Link: https://lore.kernel.org/r/20211202143437.1411410-1-lee.jones@linaro.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      37493d4e
    • Arnaldo Carvalho de Melo's avatar
      tools build: Remove needless libpython-version feature check that breaks test-all fast path · 8ca1ca40
      Arnaldo Carvalho de Melo authored
      commit 3d1d57de upstream.
      
      Since 66dfdff0 ("perf tools: Add Python 3 support") we don't use
      the tools/build/feature/test-libpython-version.c version in any Makefile
      feature check:
      
        $ find tools/ -type f | xargs grep feature-libpython-version
        $
      
      The only place where this was used was removed in 66dfdff0
      
      :
      
        -        ifneq ($(feature-libpython-version), 1)
        -          $(warning Python 3 is not yet supported; please set)
        -          $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
        -          $(warning If you also have Python 2 installed, then)
        -          $(warning try something like:)
        -          $(warning $(and ,))
        -          $(warning $(and ,)  make PYTHON=python2)
        -          $(warning $(and ,))
        -          $(warning Otherwise, disable Python support entirely:)
        -          $(warning $(and ,))
        -          $(warning $(and ,)  make NO_LIBPYTHON=1)
        -          $(warning $(and ,))
        -          $(error   $(and ,))
        -        else
        -          LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
        -          EXTLIBS += $(PYTHON_EMBED_LIBADD)
        -          LANG_BINDINGS += $(obj-perf)python/perf.so
        -          $(call detected,CONFIG_LIBPYTHON)
        -        endif
      
      And nowadays we either build with PYTHON=python3 or just install the
      python3 devel packages and perf will build against it.
      
      But the leftover feature-libpython-version check made the fast path
      feature detection to break in all cases except when python2 devel files
      were installed:
      
        $ rpm -qa | grep python.*devel
        python3-devel-3.9.7-1.fc34.x86_64
        $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf ;
        $ make -C tools/perf O=/tmp/build/perf install-bin
        make: Entering directory '/var/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j32' parallel build
          HOSTCC  /tmp/build/perf/fixdep.o
        <SNIP>
        $ cat /tmp/build/perf/feature/test-all.make.output
        In file included from test-all.c:18:
        test-libpython-version.c:5:10: error: #error
            5 |         #error
              |          ^~~~~
        $ ldd ~/bin/perf | grep python
      	libpython3.9.so.1.0 => /lib64/libpython3.9.so.1.0 (0x00007fda6dbcf000)
        $
      
      As python3 is the norm these days, fix this by just removing the unused
      feature-libpython-version feature check, making the test-all fast path
      to work with the common case.
      
      With this:
      
        $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf ;
        $ make -C tools/perf O=/tmp/build/perf install-bin |& head
        make: Entering directory '/var/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j32' parallel build
          HOSTCC  /tmp/build/perf/fixdep.o
          HOSTLD  /tmp/build/perf/fixdep-in.o
          LINK    /tmp/build/perf/fixdep
      
        Auto-detecting system features:
        ...                         dwarf: [ on  ]
        ...            dwarf_getlocations: [ on  ]
        ...                         glibc: [ on  ]
        $ ldd ~/bin/perf | grep python
      	libpython3.9.so.1.0 => /lib64/libpython3.9.so.1.0 (0x00007f58800b0000)
        $ cat /tmp/build/perf/feature/test-all.make.output
        $
      
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Fixes: 66dfdff0
      
       ("perf tools: Add Python 3 support")
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jaroslav Škarvada <jskarvad@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/YaYmeeC6CS2b8OSz@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8ca1ca40
    • Alexander Stein's avatar
      dt-bindings: net: Reintroduce PHY no lane swap binding · 9c2407af
      Alexander Stein authored
      commit 96db48c9 upstream.
      
      This binding was already documented in phy.txt, commit 252ae533
      ("Documentation: devicetree: Add PHY no lane swap binding"), but got
      accidently removed during YAML conversion in commit d8704342
      ("dt-bindings: net: Add a YAML schemas for the generic PHY options").
      
      Note: 'enet-phy-lane-no-swap' and the absence of 'enet-phy-lane-swap' are
      not identical, as the former one disable this feature, while the latter
      one doesn't change anything.
      
      Fixes: d8704342
      
       ("dt-bindings: net: Add a YAML schemas for the generic PHY options")
      Signed-off-by: default avatarAlexander Stein <alexander.stein@ew.tq-group.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20211130082756.713919-1-alexander.stein@ew.tq-group.com
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9c2407af
    • Sebastian Andrzej Siewior's avatar
      Documentation/locking/locktypes: Update migrate_disable() bits. · 2e837d90
      Sebastian Andrzej Siewior authored
      commit 6a631c04 upstream.
      
      The initial implementation of migrate_disable() for mainline was a
      wrapper around preempt_disable(). RT kernels substituted this with
      a real migrate disable implementation.
      
      Later on mainline gained true migrate disable support, but the
      documentation was not updated.
      
      Update the documentation, remove the claims about migrate_disable()
      mapping to preempt_disable() on non-PREEMPT_RT kernels.
      
      Fixes: 74d862b6
      
       ("sched: Make migrate_disable/enable() independent of RT")
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20211127163200.10466-2-bigeasy@linutronix.de
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2e837d90
    • Ian Rogers's avatar
      perf tools: Fix SMT detection fast read path · 395022a7
      Ian Rogers authored
      commit 4ffbe87e upstream.
      
      sysfs__read_int() returns 0 on success, and so the fast read path was
      always failing.
      
      Fixes: bb629484
      
       ("perf tools: Simplify checking if SMT is active.")
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20211124001231.3277836-2-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      395022a7
    • Nicholas Kazlauskas's avatar
      drm/amd/display: Fix DPIA outbox timeout after S3/S4/reset · f1131d3f
      Nicholas Kazlauskas authored
      commit af6902ec upstream.
      
      [Why]
      The HW interrupt gets disabled after S3/S4/reset so we don't receive
      notifications for HPD or AUX from DMUB - leading to timeout and
      black screen with (or without) DPIA links connected.
      
      [How]
      Re-enable the interrupt after S3/S4/reset like we do for the other
      DC interrupts.
      
      Guard both instances of the outbox interrupt enable or we'll hang
      during restore on ASIC that don't support it.
      
      Fixes: 6eff272d
      
       ("drm/amd/display: Fix DPIA outbox timeout after GPU reset")
      
      Reviewed-by: default avatarJude Shih <Jude.Shih@amd.com>
      Acked-by: default avatarPavle Kotarac <Pavle.Kotarac@amd.com>
      Signed-off-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f1131d3f
    • Marek Behún's avatar
      Revert "PCI: aardvark: Fix support for PCI_ROM_ADDRESS1 on emulated bridge" · 99bc1989
      Marek Behún authored
      commit 39bd54d4 upstream.
      
      This reverts commit 239edf68.
      
      239edf68 ("PCI: aardvark: Fix support for PCI_ROM_ADDRESS1 on emulated
      bridge") added support for the Type 1 Expansion ROM BAR at config offset
      0x38, based on the register being listed in the Marvell Armada A3720 spec.
      But the spec doesn't document it at all for RC mode, and there is no ROM in
      the SOC, so remove this emulation for now.
      
      The PCI bridge which represents aardvark's PCIe Root Port has an Expansion
      ROM Base Address register at offset 0x30, but its meaning is different than
      PCI's Expansion ROM BAR register, although the layout is the same.  (This
      is why we thought it does the same thing.)
      
      First: there is no ROM (or part of BootROM) in the A3720 SOC dedicated for
      PCIe Root Port (or controller in RC mode) containing executable code that
      would initialize the Root Port, suitable for execution in bootloader (this
      is how Expansion ROM BAR is used on x86).
      
      Second: in A3720 spec the register (address 0xD0070030) is not documented
      at all for Root Complex mode, but similar to other BAR registers, it has an
      "entangled partner" in register 0xD0075920, which does address translation
      for the BAR in 0xD0070030:
      
        - the BAR register sets the address from the view of PCIe bus
      
        - the translation register sets the address from the view of the CPU
      
      The other BAR registers also have this entangled partner, and they can be
      used to:
      
        - in RC mode: address-checking on the receive side of the RC (they can
          define address ranges for memory accesses from remote Endpoints to the
          RC)
      
        - in Endpoint mode: allow the remote CPU to access memory on A3720
      
      The Expansion ROM BAR has only the Endpoint part documented, but from the
      similarities we think that it can also be used in RC mode in that way.
      
      So either Expansion ROM BAR has different meaning (if the hypothesis above
      is true), or we don't know it's meaning (since it is not documented for RC
      mode).
      
      Remove the register from the emulated bridge accessing functions.
      
      [bhelgaas: summarize reason for removal (first paragraph)]
      Fixes: 239edf68
      
       ("PCI: aardvark: Fix support for PCI_ROM_ADDRESS1 on emulated bridge")
      Link: https://lore.kernel.org/r/20211125160148.26029-3-kabel@kernel.org
      Signed-off-by: default avatarMarek Behún <kabel@kernel.org>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarPali Rohár <pali@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      99bc1989
    • Norbert Zulinski's avatar
      i40e: Fix NULL pointer dereference in i40e_dbg_dump_desc · 16431e44
      Norbert Zulinski authored
      commit 23ec111b upstream.
      
      When trying to dump VFs VSI RX/TX descriptors
      using debugfs there was a crash
      due to NULL pointer dereference in i40e_dbg_dump_desc.
      Added a check to i40e_dbg_dump_desc that checks if
      VSI type is correct for dumping RX/TX descriptors.
      
      Fixes: 02e9c290
      
       ("i40e: debugfs interface")
      Signed-off-by: default avatarSylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
      Signed-off-by: default avatarNorbert Zulinski <norbertx.zulinski@intel.com>
      Signed-off-by: default avatarMateusz Palczewski <mateusz.palczewski@intel.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 avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      16431e44
    • John Fastabend's avatar
      bpf, sockmap: Re-evaluate proto ops when psock is removed from sockmap · f8358589
      John Fastabend authored
      commit c0d95d33 upstream.
      
      When a sock is added to a sock map we evaluate what proto op hooks need to
      be used. However, when the program is removed from the sock map we have not
      been evaluating if that changes the required program layout.
      
      Before the patch listed in the 'fixes' tag this was not causing failures
      because the base program set handles all cases. Specifically, the case with
      a stream parser and the case with out a stream parser are both handled. With
      the fix below we identified a race when running with a proto op that attempts
      to read skbs off both the stream parser and the skb->receive_queue. Namely,
      that a race existed where when the stream parser is empty checking the
      skb->receive_queue from recvmsg at the precies moment when the parser is
      paused and the receive_queue is not empty could result in skipping the stream
      parser. This may break a RX policy depending on the parser to run.
      
      The fix tag then loads a specific proto ops that resolved this race. But, we
      missed removing that proto ops recv hook when the sock is removed from the
      sockmap. The result is the stream parser is stopped so no more skbs will be
      aggregated there, but the hook and BPF program continues to be attached on
      the psock. User space will then get an EBUSY when trying to read the socket
      because the recvmsg() handler is now waiting on a stopped stream parser.
      
      To fix we rerun the proto ops init() function which will look at the new set
      of progs attached to the psock and rest the proto ops hook to the correct
      handlers. And in the above case where we remove the sock from the sock map
      the RX prog will no longer be listed so the proto ops is removed.
      
      Fixes: c5d2177a
      
       ("bpf, sockmap: Fix race in ingress receive verdict with redirect to self")
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20211119181418.353932-3-john.fastabend@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f8358589
    • Herve Codina's avatar
      mtd: rawnand: fsmc: Fix timing computation · a4953e7b
      Herve Codina authored
      commit 9472335e upstream.
      
      Under certain circumstances, the timing settings calculated by
      the FSMC NAND controller driver were inaccurate.
      These settings led to incorrect data reads or fallback to
      timing mode 0 depending on the NAND chip used.
      
      The timing computation did not take into account the following
      constraint given in SPEAr3xx reference manual:
        twait >= tCEA - (tset * TCLK) + TOUTDEL + TINDEL
      
      Enhance the timings calculation by taking into account this
      additional constraint.
      
      This change has no impact on slow timing modes such as mode 0.
      Indeed, on mode 0, computed values are the same with and
      without the patch.
      
      NANDs which previously stayed in mode 0 because of fallback to
      mode 0 can now work at higher speeds and NANDs which were not
      working at all because of the corrupted data work at high
      speeds without troubles.
      
      Overall improvement on a Micron/MT29F1G08 (flash_speed tool):
                              mode0       mode3
      eraseblock write speed  3220 KiB/s  4511 KiB/s
      eraseblock read speed   4491 KiB/s  7529 KiB/s
      
      Fixes: d9fb0795
      
       ("mtd: nand: fsmc: add support for SDR timings")
      Signed-off-by: default avatarHerve Codina <herve.codina@bootlin.com>
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Link: https://lore.kernel.org/linux-mtd/20211119150316.43080-5-herve.codina@bootlin.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a4953e7b
    • Herve Codina's avatar
      mtd: rawnand: fsmc: Take instruction delay into account · ebc8909f
      Herve Codina authored
      commit a4ca0c43 upstream.
      
      The FSMC NAND controller should apply a delay after the
      instruction has been issued on the bus.
      The FSMC NAND controller driver did not handle this delay.
      
      Add this waiting delay in the FSMC NAND controller driver.
      
      Fixes: 4da712e7
      
       ("mtd: nand: fsmc: use ->exec_op()")
      Signed-off-by: default avatarHerve Codina <herve.codina@bootlin.com>
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Link: https://lore.kernel.org/linux-mtd/20211119150316.43080-4-herve.codina@bootlin.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ebc8909f
    • Mateusz Palczewski's avatar
      i40e: Fix pre-set max number of queues for VF · fabfb7c1
      Mateusz Palczewski authored
      commit 8aa55ab4 upstream.
      
      After setting pre-set combined to 16 queues and reserving 16 queues by
      tc qdisc, pre-set maximum combined queues returned to default value
      after VF reset being 4 and this generated errors during removing tc.
      Fixed by removing clear num_req_queues before reset VF.
      
      Fixes: e284fc28
      
       (i40e: Add and delete cloud filter)
      Signed-off-by: default avatarGrzegorz Szczurek <grzegorzx.szczurek@intel.com>
      Signed-off-by: default avatarMateusz Palczewski <mateusz.palczewski@intel.com>
      Tested-by: default avatarBindushree P <Bindushree.p@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fabfb7c1
    • Karen Sornek's avatar
      i40e: Fix failed opcode appearing if handling messages from VF · 2132643b
      Karen Sornek authored
      commit 61125b8b upstream.
      
      Fix failed operation code appearing if handling messages from VF.
      Implemented by waiting for VF appropriate state if request starts
      handle while VF reset.
      Without this patch the message handling request while VF is in
      a reset state ends with error -5 (I40E_ERR_PARAM).
      
      Fixes: 5c3c48ac
      
       ("i40e: implement virtual device interface")
      Signed-off-by: default avatarGrzegorz Szczurek <grzegorzx.szczurek@intel.com>
      Signed-off-by: default avatarKaren Sornek <karen.sornek@intel.com>
      Tested-by: default avatarTony Brelinski <tony.brelinski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2132643b
    • Bjorn Andersson's avatar
      clk: qcom: clk-alpha-pll: Don't reconfigure running Trion · 06ece588
      Bjorn Andersson authored
      commit a1f0019c upstream.
      
      In the event that the bootloader has configured the Trion PLL as source
      for the display clocks, e.g. for the continuous splashscreen, then there
      will also be RCGs that are clocked by this instance.
      
      Reconfiguring, and in particular disabling the output of, the PLL will
      cause issues for these downstream RCGs and has been shown to prevent
      them from being re-parented.
      
      Follow downstream and skip configuration if it's determined that the PLL
      is already running.
      
      Fixes: 59128c20
      
       ("clk: qcom: clk-alpha-pll: Add support for controlling Lucid PLLs")
      Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
      Reviewed-by: default avatarRobert Foss <robert.foss@linaro.org>
      Reviewed-by: default avatarVinod Koul <vkoul@kernel.org>
      Link: https://lore.kernel.org/r/20211123162508.153711-1-bjorn.andersson@linaro.org
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      06ece588
    • Miles Chen's avatar
      clk: imx: use module_platform_driver · d259ae52
      Miles Chen authored
      commit eee377b8 upstream.
      
      Replace builtin_platform_driver_probe with module_platform_driver_probe
      because CONFIG_CLK_IMX8QXP can be set to =m (kernel module).
      
      Fixes: e0d0d4d8
      
       ("clk: imx8qxp: Support building i.MX8QXP clock driver as module")
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarMiles Chen <miles.chen@mediatek.com>
      Link: https://lore.kernel.org/r/20210904235418.2442-1-miles.chen@mediatek.com
      Reviewed-by: default avatarFabio Estevam <festevam@gmail.com>
      Reviewed-by: default avatarStephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d259ae52
    • Armin Wolf's avatar
      hwmon: (dell-smm) Fix warning on /proc/i8k creation error · 1d044701
      Armin Wolf authored
      commit dbd3e6ea upstream.
      
      The removal function is called regardless of whether
      /proc/i8k was created successfully or not, the later
      causing a WARN() on module removal.
      Fix that by only registering the removal function
      if /proc/i8k was created successfully.
      
      Tested on a Inspiron 3505.
      
      Fixes: 039ae585
      
       ("hwmon: Allow to compile dell-smm-hwmon driver without /proc/i8k")
      Signed-off-by: default avatarArmin Wolf <W_Armin@gmx.de>
      Acked-by: default avatarPali Rohár <pali@kernel.org>
      Link: https://lore.kernel.org/r/20211112171440.59006-1-W_Armin@gmx.de
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1d044701
    • Yangyang Li's avatar
      RDMA/hns: Do not destroy QP resources in the hw resetting phase · be7c5d58
      Yangyang Li authored
      commit b0969f83 upstream.
      
      When hns_roce_v2_destroy_qp() is called, the brief calling process of the
      driver is as follows:
      
       ......
       hns_roce_v2_destroy_qp
       hns_roce_v2_qp_modify
      	   hns_roce_cmd_mbox
       hns_roce_qp_destroy
      
      If hns_roce_cmd_mbox() detects that the hardware is being reset during the
      execution of the hns_roce_cmd_mbox(), the driver will not be able to get
      the return value from the hardware (the firmware cannot respond to the
      driver's mailbox during the hardware reset phase).
      
      The driver needs to wait for the hardware reset to complete before
      continuing to execute hns_roce_qp_destroy(), otherwise it may happen that
      the driver releases the resources but the hardware is still accessing. In
      order to fix this problem, HNS RoCE needs to add a piece of code to wait
      for the hardware reset to complete.
      
      The original interface get_hw_reset_stat() is the instantaneous state of
      the hardware reset, which cannot accurately reflect whether the hardware
      reset is completed, so it needs to be replaced with the ae_dev_reset_cnt
      interface.
      
      The sign that the hardware reset is complete is that the return value of
      the ae_dev_reset_cnt interface is greater than the original value
      reset_cnt recorded by the driver.
      
      Fixes: 6a04aed6
      
       ("RDMA/hns: Fix the chip hanging caused by sending mailbox&CMQ during reset")
      Link: https://lore.kernel.org/r/20211123142402.26936-1-liangwenpeng@huawei.com
      Signed-off-by: default avatarYangyang Li <liyangyang20@huawei.com>
      Signed-off-by: default avatarWenpeng Liang <liangwenpeng@huawei.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      be7c5d58
    • Yangyang Li's avatar
      RDMA/hns: Do not halt commands during reset until later · 207f5ea6
      Yangyang Li authored
      commit 52414e27 upstream.
      
      is_reset is used to indicate whether the hardware starts to reset. When
      hns_roce_hw_v2_reset_notify_down() is called, the hardware has not yet
      started to reset. If is_reset is set at this time, all mailbox operations
      of resource destroy actions will be intercepted by driver. When the driver
      cleans up resources, but the hardware is still accessed, the following
      errors will appear:
      
        arm-smmu-v3 arm-smmu-v3.2.auto: event 0x10 received:
        arm-smmu-v3 arm-smmu-v3.2.auto: 	0x0000350100000010
        arm-smmu-v3 arm-smmu-v3.2.auto: 	0x000002088000003f
        arm-smmu-v3 arm-smmu-v3.2.auto: 	0x00000000a50e0800
        arm-smmu-v3 arm-smmu-v3.2.auto: 	0x0000000000000000
        arm-smmu-v3 arm-smmu-v3.2.auto: event 0x10 received:
        arm-smmu-v3 arm-smmu-v3.2.auto: 	0x0000350100000010
        arm-smmu-v3 arm-smmu-v3.2.auto: 	0x000002088000043e
        arm-smmu-v3 arm-smmu-v3.2.auto: 	0x00000000a50a0800
        arm-smmu-v3 arm-smmu-v3.2.auto: 	0x0000000000000000
        arm-smmu-v3 arm-smmu-v3.2.auto: event 0x10 received:
        arm-smmu-v3 arm-smmu-v3.2.auto: 	0x0000350100000010
        arm-smmu-v3 arm-smmu-v3.2.auto: 	0x0000020880000436
        arm-smmu-v3 arm-smmu-v3.2.auto: 	0x00000000a50a0880
        arm-smmu-v3 arm-smmu-v3.2.auto: 	0x0000000000000000
        arm-smmu-v3 arm-smmu-v3.2.auto: event 0x10 received:
        arm-smmu-v3 arm-smmu-v3.2.auto: 	0x0000350100000010
        arm-smmu-v3 arm-smmu-v3.2.auto: 	0x000002088000043a
        arm-smmu-v3 arm-smmu-v3.2.auto: 	0x00000000a50e0840
        hns3 0000:35:00.0: INT status: CMDQ(0x0) HW errors(0x0) other(0x0)
        arm-smmu-v3 arm-smmu-v3.2.auto: 	0x0000000000000000
        hns3 0000:35:00.0: received unknown or unhandled event of vector0
        arm-smmu-v3 arm-smmu-v3.2.auto: event 0x10 received:
        arm-smmu-v3 arm-smmu-v3.2.auto: 	0x0000350100000010
        {34}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 7
      
      is_reset will be set correctly in check_aedev_reset_status(), so the
      setting in hns_roce_hw_v2_reset_notify_down() should be deleted.
      
      Fixes: 726be12f
      
       ("RDMA/hns: Set reset flag when hw resetting")
      Link: https://lore.kernel.org/r/20211123084809.37318-1-liangwenpeng@huawei.com
      Signed-off-by: default avatarYangyang Li <liyangyang20@huawei.com>
      Signed-off-by: default avatarWenpeng Liang <liangwenpeng@huawei.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      207f5ea6
    • Srinivas Kandagatla's avatar
      ASoC: codecs: wcd934x: return correct value from mixer put · 9b6bf6fc
      Srinivas Kandagatla authored
      commit d9be0ff4 upstream.
      
      wcd934x_compander_set() currently returns zero eventhough it changes the value.
      Fix this, so that change notifications are sent correctly.
      
      Fixes: 1cde8b82
      
       ("ASoC: wcd934x: add basic controls")
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20211130160507.22180-4-srinivas.kandagatla@linaro.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9b6bf6fc
    • Srinivas Kandagatla's avatar
      ASoC: codecs: wcd934x: handle channel mappping list correctly · 339ffb5b
      Srinivas Kandagatla authored
      commit 23ba2861 upstream.
      
      Currently each channel is added as list to dai channel list, however
      there is danger of adding same channel to multiple dai channel list
      which endups corrupting the other list where its already added.
      
      This patch ensures that the channel is actually free before adding to
      the dai channel list and also ensures that the channel is on the list
      before deleting it.
      
      This check was missing previously, and we did not hit this issue as
      we were testing very simple usecases with sequence of amixer commands.
      
      Fixes: a70d9245 ("ASoC: wcd934x: add capture dapm widgets")
      Fixes: dd9eb19b
      
       ("ASoC: wcd934x: add playback dapm widgets")
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20211130160507.22180-2-srinivas.kandagatla@linaro.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      339ffb5b
    • Srinivas Kandagatla's avatar
      ASoC: codecs: wsa881x: fix return values from kcontrol put · 71272640
      Srinivas Kandagatla authored
      commit 3fc27e9a upstream.
      
      wsa881x_set_port() and wsa881x_put_pa_gain() currently returns zero eventhough
      it changes the value. Fix this, so that change notifications are sent
      correctly.
      
      Fixes: a0aab9e1
      
       ("ASoC: codecs: add wsa881x amplifier support")
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20211130160507.22180-5-srinivas.kandagatla@linaro.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      71272640
    • Srinivas Kandagatla's avatar
      ASoC: qdsp6: q6routing: Fix return value from msm_routing_put_audio_mixer · e1e22179
      Srinivas Kandagatla authored
      commit 4739d88a upstream.
      
      msm_routing_put_audio_mixer() can return incorrect value in various scenarios.
      
      scenario 1:
      amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
      amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 0
      
      return value is 0 instead of 1 eventhough value was changed
      
      scenario 2:
      amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
      amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
      
      return value is 1 instead of 0 eventhough the value was not changed
      
      scenario 3:
      amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 0
      return value is 1 instead of 0 eventhough the value was not changed
      
      Fix this by adding checks, so that change notifications are sent correctly.
      
      Fixes: e3a33673
      
       ("ASoC: qdsp6: q6routing: Add q6routing driver")
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20211130163110.5628-1-srinivas.kandagatla@linaro.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e1e22179
    • Rob Clark's avatar
      ASoC: rt5682: Fix crash due to out of scope stack vars · cdb5a0d0
      Rob Clark authored
      commit 4999d703 upstream.
      
      Move the declaration of temporary arrays to somewhere that won't go out
      of scope before the devm_clk_hw_register() call, lest we be at the whim
      of the compiler for whether those stack variables get overwritten.
      
      Fixes a crash seen with gcc version 11.2.1 20210728 (Red Hat 11.2.1-1)
      
      Fixes: edbd24ea
      
       ("ASoC: rt5682: Drop usage of __clk_get_name()")
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
      Link: https://lore.kernel.org/r/20211118010453.843286-1-robdclark@gmail.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cdb5a0d0
    • Rafael J. Wysocki's avatar
      PM: runtime: Fix pm_runtime_active() kerneldoc comment · e9362a21
      Rafael J. Wysocki authored
      commit 444dd878 upstream.
      
      The kerneldoc comment of pm_runtime_active() does not reflect the
      behavior of the function, so update it accordingly.
      
      Fixes: 403d2d11
      
       ("PM: runtime: Add kerneldoc comments to multiple helpers")
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e9362a21
    • Manish Chopra's avatar
      qede: validate non LSO skb length · a3f0e9b1
      Manish Chopra authored
      commit 8e227b19 upstream.
      
      Although it is unlikely that stack could transmit a non LSO
      skb with length > MTU, however in some cases or environment such
      occurrences actually resulted into firmware asserts due to packet
      length being greater than the max supported by the device (~9700B).
      
      This patch adds the safeguard for such odd cases to avoid firmware
      asserts.
      
      v2: Added "Fixes" tag with one of the initial driver commit
          which enabled the TX traffic actually (as this was probably
          day1 issue which was discovered recently by some customer
          environment)
      
      Fixes: a2ec6172
      
       ("qede: Add support for link")
      Signed-off-by: default avatarManish Chopra <manishc@marvell.com>
      Signed-off-by: default avatarAlok Prasad <palok@marvell.com>
      Signed-off-by: default avatarPrabhakar Kushwaha <pkushwaha@marvell.com>
      Signed-off-by: default avatarAriel Elior <aelior@marvell.com>
      Link: https://lore.kernel.org/r/20211203174413.13090-1-manishc@marvell.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a3f0e9b1
    • Geraldo Nascimento's avatar
      ALSA: usb-audio: Reorder snd_djm_devices[] entries · 069a8498
      Geraldo Nascimento authored
      commit fb1af5be upstream.
      
      Olivia Mackintosh has posted to alsa-devel reporting that
      there's a potential bug that could break mixer quirks for Pioneer
      devices introduced by 6d277881
      "ALSA: usb-audio: Add support for the Pioneer DJM 750MK2
      Mixer/Soundcard".
      
      This happened because the DJM 750 MK2 was added last to the Pioneer DJM
      device table index and defined as 0x4 but was added to snd_djm_devices[]
      just after the DJM 750 (MK1) entry instead of last, after the DJM 900
      NXS2. This escaped review.
      
      To prevent that from ever happening again, Takashi Iwai suggested to use
      C99 array designators in snd_djm_devices[] instead of simply reordering
      the entries.
      
      Fixes: 6d277881
      
       ("ALSA: usb-audio: Add support for the Pioneer DJM 750MK2")
      Reported-by: default avatarOlivia Mackintosh <livvy@base.nu>
      Suggested-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGeraldo Nascimento <geraldogabriel@gmail.com>
      Link: https://lore.kernel.org/r/Yau46FDzoql0SNnW@geday
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      069a8498
    • Shin'ichiro Kawasaki's avatar
      scsi: scsi_debug: Fix buffer size of REPORT ZONES command · ebacb44c
      Shin'ichiro Kawasaki authored
      commit 7db0e0c8 upstream.
      
      According to ZBC and SPC specifications, the unit of ALLOCATION LENGTH
      field of REPORT ZONES command is byte. However, current scsi_debug
      implementation handles it as number of zones to calculate buffer size to
      report zones. When the ALLOCATION LENGTH has a large number, this results
      in too large buffer size and causes memory allocation failure.  Fix the
      failure by handling ALLOCATION LENGTH as byte unit.
      
      Link: https://lore.kernel.org/r/20211207010638.124280-1-shinichiro.kawasaki@wdc.com
      Fixes: f0d1cf93
      
       ("scsi: scsi_debug: Add ZBC zone commands")
      Reviewed-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
      Signed-off-by: default avatarShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ebacb44c
    • Igor Pylypiv's avatar
      scsi: pm80xx: Do not call scsi_remove_host() in pm8001_alloc() · f8dccc1b
      Igor Pylypiv authored
      commit 65392620 upstream.
      
      Calling scsi_remove_host() before scsi_add_host() results in a crash:
      
       BUG: kernel NULL pointer dereference, address: 0000000000000108
       RIP: 0010:device_del+0x63/0x440
       Call Trace:
        device_unregister+0x17/0x60
        scsi_remove_host+0xee/0x2a0
        pm8001_pci_probe+0x6ef/0x1b90 [pm80xx]
        local_pci_probe+0x3f/0x90
      
      We cannot call scsi_remove_host() in pm8001_alloc() because scsi_add_host()
      has not been called yet at that point in time.
      
      Function call tree:
      
        pm8001_pci_probe()
        |
        `- pm8001_pci_alloc()
        |  |
        |  `- pm8001_alloc()
        |     |
        |     `- scsi_remove_host()
        |
        `- scsi_add_host()
      
      Link: https://lore.kernel.org/r/20211201041627.1592487-1-ipylypiv@google.com
      Fixes: 05c6c029
      
       ("scsi: pm80xx: Increase number of supported queues")
      Reviewed-by: default avatarVishakha Channapattan <vishakhavc@google.com>
      Acked-by: default avatarJack Wang <jinpu.wang@ionos.com>
      Signed-off-by: default avatarIgor Pylypiv <ipylypiv@google.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f8dccc1b
    • Davidlohr Bueso's avatar
      block: fix ioprio_get(IOPRIO_WHO_PGRP) vs setuid(2) · d429b302
      Davidlohr Bueso authored
      commit e6a59aac upstream.
      
      do_each_pid_thread(PIDTYPE_PGID) can race with a concurrent
      change_pid(PIDTYPE_PGID) that can move the task from one hlist
      to another while iterating. Serialize ioprio_get to take
      the tasklist_lock in this case, just like it's set counterpart.
      
      Fixes: d69b78ba
      
       (ioprio: grab rcu_read_lock in sys_ioprio_{set,get}())
      Acked-by: default avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: default avatarDavidlohr Bueso <dbueso@suse.de>
      Link: https://lore.kernel.org/r/20211210182058.43417-1-dave@stgolabs.net
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d429b302
    • Chris Packham's avatar
      i2c: mpc: Use atomic read and fix break condition · e3098ce1
      Chris Packham authored
      commit a74c313a upstream.
      
      Maxime points out that the polling code in mpc_i2c_isr should use the
      _atomic API because it is called in an irq context and that the
      behaviour of the MCF bit is that it is 1 when the byte transfer is
      complete. All of this means the original code was effectively a
      udelay(100).
      
      Fix this by using readb_poll_timeout_atomic() and removing the negation
      of the break condition.
      
      Fixes: 4a8ac5e4
      
       ("i2c: mpc: Poll for MCF")
      Reported-by: default avatarMaxime Bizon <mbizon@freebox.fr>
      Signed-off-by: default avatarChris Packham <chris.packham@alliedtelesis.co.nz>
      Tested-by: default avatarMaxime Bizon <mbizon@freebox.fr>
      Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e3098ce1
    • Steven Rostedt (VMware)'s avatar
      tracefs: Set all files to the same group ownership as the mount option · 23a5f979
      Steven Rostedt (VMware) authored
      commit 48b27b6b
      
       upstream.
      
      As people have been asking to allow non-root processes to have access to
      the tracefs directory, it was considered best to only allow groups to have
      access to the directory, where it is easier to just set the tracefs file
      system to a specific group (as other would be too dangerous), and that way
      the admins could pick which processes would have access to tracefs.
      
      Unfortunately, this broke tooling on Android that expected the other bit
      to be set. For some special cases, for non-root tools to trace the system,
      tracefs would be mounted and change the permissions of the top level
      directory which gave access to all running tasks permission to the
      tracing directory. Even though this would be dangerous to do in a
      production environment, for testing environments this can be useful.
      
      Now with the new changes to not allow other (which is still the proper
      thing to do), it breaks the testing tooling. Now more code needs to be
      loaded on the system to change ownership of the tracing directory.
      
      The real solution is to have tracefs honor the gid=xxx option when
      mounting. That is,
      
      (tracing group tracing has value 1003)
      
       mount -t tracefs -o gid=1003 tracefs /sys/kernel/tracing
      
      should have it that all files in the tracing directory should be of the
      given group.
      
      Copy the logic from d_walk() from dcache.c and simplify it for the mount
      case of tracefs if gid is set. All the files in tracefs will be walked and
      their group will be set to the value passed in.
      
      Link: https://lkml.kernel.org/r/20211207171729.2a54e1b3@gandalf.local.home
      
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: linux-fsdevel@vger.kernel.org
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Reported-by: default avatarKalesh Singh <kaleshsingh@google.com>
      Reported-by: default avatarYabin Cui <yabinc@google.com>
      Fixes: 49d67e44
      
       ("tracefs: Have tracefs directories not set OTH permission bits by default")
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      23a5f979
    • Eric Biggers's avatar
      aio: fix use-after-free due to missing POLLFREE handling · 60d311f9
      Eric Biggers authored
      commit 50252e4b upstream.
      
      signalfd_poll() and binder_poll() are special in that they use a
      waitqueue whose lifetime is the current task, rather than the struct
      file as is normally the case.  This is okay for blocking polls, since a
      blocking poll occurs within one task; however, non-blocking polls
      require another solution.  This solution is for the queue to be cleared
      before it is freed, by sending a POLLFREE notification to all waiters.
      
      Unfortunately, only eventpoll handles POLLFREE.  A second type of
      non-blocking poll, aio poll, was added in kernel v4.18, and it doesn't
      handle POLLFREE.  This allows a use-after-free to occur if a signalfd or
      binder fd is polled with aio poll, and the waitqueue gets freed.
      
      Fix this by making aio poll handle POLLFREE.
      
      A patch by Ramji Jiyani <ramjiyani@google.com>
      (https://lore.kernel.org/r/20211027011834.2497484-1-ramjiyani@google.com)
      tried to do this by making aio_poll_wake() always complete the request
      inline if POLLFREE is seen.  However, that solution had two bugs.
      First, it introduced a deadlock, as it unconditionally locked the aio
      context while holding the waitqueue lock, which inverts the normal
      locking order.  Second, it didn't consider that POLLFREE notifications
      are missed while the request has been temporarily de-queued.
      
      The second problem was solved by my previous patch.  This patch then
      properly fixes the use-after-free by handling POLLFREE in a
      deadlock-free way.  It does this by taking advantage of the fact that
      freeing of the waitqueue is RCU-delayed, similar to what eventpoll does.
      
      Fixes: 2c14fa83
      
       ("aio: implement IOCB_CMD_POLL")
      Cc: <stable@vger.kernel.org> # v4.18+
      Link: https://lore.kernel.org/r/20211209010455.42744-6-ebiggers@kernel.org
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      60d311f9