Skip to content
Snippets Groups Projects
  1. Mar 15, 2024
    • Michal Pecio's avatar
      xhci: handle isoc Babble and Buffer Overrun events properly · 696e4112
      Michal Pecio authored
      
      [ Upstream commit 7c4650de ]
      
      xHCI 4.9 explicitly forbids assuming that the xHC has released its
      ownership of a multi-TRB TD when it reports an error on one of the
      early TRBs. Yet the driver makes such assumption and releases the TD,
      allowing the remaining TRBs to be freed or overwritten by new TDs.
      
      The xHC should also report completion of the final TRB due to its IOC
      flag being set by us, regardless of prior errors. This event cannot
      be recognized if the TD has already been freed earlier, resulting in
      "Transfer event TRB DMA ptr not part of current TD" error message.
      
      Fix this by reusing the logic for processing isoc Transaction Errors.
      This also handles hosts which fail to report the final completion.
      
      Fix transfer length reporting on Babble errors. They may be caused by
      device malfunction, no guarantee that the buffer has been filled.
      
      Signed-off-by: default avatarMichal Pecio <michal.pecio@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20240125152737.2983959-5-mathias.nyman@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      696e4112
    • Mathias Nyman's avatar
      xhci: process isoc TD properly when there was a transaction error mid TD. · fe2322ca
      Mathias Nyman authored
      
      [ Upstream commit 5372c65e ]
      
      The last TRB of a isoc TD might not trigger an event if there was
      an error event for a TRB mid TD. This is seen on a NEC Corporation
      uPD720200 USB 3.0 Host
      
      After an error mid a multi-TRB TD the xHC should according to xhci 4.9.1
      generate events for passed TRBs with IOC flag set if it proceeds to the
      next TD. This event is either a copy of the original error, or a
      "success" transfer event.
      
      If that event is missing then the driver and xHC host get out of sync as
      the driver is still expecting a transfer event for that first TD, while
      xHC host is already sending events for the next TD in the list.
      This leads to
      "Transfer event TRB DMA ptr not part of current TD" messages.
      
      As a solution we tag the isoc TDs that get error events mid TD.
      If an event doesn't match the first TD, then check if the tag is
      set, and event points to the next TD.
      In that case give back the fist TD and process the next TD normally
      
      Make sure TD status and transferred length stay valid in both cases
      with and without final TD completion event.
      
      Reported-by: default avatarMichał Pecio <michal.pecio@gmail.com>
      Closes: https://lore.kernel.org/linux-usb/20240112235205.1259f60c@foxbook/
      
      
      Tested-by: default avatarMichał Pecio <michal.pecio@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20240125152737.2983959-4-mathias.nyman@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fe2322ca
    • Mathias Nyman's avatar
      xhci: prevent double-fetch of transfer and transfer event TRBs · fa5aaf31
      Mathias Nyman authored
      
      [ Upstream commit e9fcb077 ]
      
      The same values are parsed several times from transfer and event
      TRBs by different functions in the same call path, all while processing
      one transfer event.
      
      As the TRBs are in DMA memory and can be accessed by the xHC host we want
      to avoid this to prevent double-fetch issues.
      
      To resolve this pass the already parsed values to the different functions
      in the path of parsing a transfer event
      
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20210406070208.3406266-5-mathias.nyman@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Stable-dep-of: 5372c65e ("xhci: process isoc TD properly when there was a transaction error mid TD.")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fa5aaf31
    • Mathias Nyman's avatar
      xhci: remove extra loop in interrupt context · 89ed7eba
      Mathias Nyman authored
      
      [ Upstream commit 55f6153d ]
      
      When finishing a TD we walk the endpoint dequeue trb pointer
      until it matches the last TRB of the TD.
      
      TDs can contain over 100 TRBs, meaning we call a function 100 times,
      do a few comparisons and increase a couple values for each of these calls,
      all in interrupt context.
      
      This can all be avoided by adding a pointer to the last TRB segment, and
      a number of TRBs in the TD. So instead of walking through each TRB just
      set the new dequeue segment, pointer, and number of free TRBs directly.
      
      Getting rid of the while loop also reduces the risk of getting stuck in a
      infinite loop in the interrupt handler. Loop relied on valid matching
      dequeue and last_trb values to break.
      
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20210129130044.206855-12-mathias.nyman@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Stable-dep-of: 5372c65e ("xhci: process isoc TD properly when there was a transaction error mid TD.")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      89ed7eba
    • Johannes Berg's avatar
      um: allow not setting extra rpaths in the linux binary · 9c398afd
      Johannes Berg authored
      
      [ Upstream commit 386093c6 ]
      
      There doesn't seem to be any reason for the rpath being set in
      the binaries, at on systems that I tested on. On the other hand,
      setting rpath is actually harming binaries in some cases, e.g.
      if using nix-based compilation environments where /lib & /lib64
      are not part of the actual environment.
      
      Add a new Kconfig option (under EXPERT, for less user confusion)
      that allows disabling the rpath additions.
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      Stable-dep-of: 846cfbee ("um: Fix adding '-no-pie' for clang")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9c398afd
    • Nico Pache's avatar
      selftests: mm: fix map_hugetlb failure on 64K page size systems · c9c3cc6a
      Nico Pache authored
      [ Upstream commit 91b80cc5 ]
      
      On systems with 64k page size and 512M huge page sizes, the allocation and
      test succeeds but errors out at the munmap.  As the comment states, munmap
      will failure if its not HUGEPAGE aligned.  This is due to the length of
      the mapping being 1/2 the size of the hugepage causing the munmap to not
      be hugepage aligned.  Fix this by making the mapping length the full
      hugepage if the hugepage is larger than the length of the mapping.
      
      Link: https://lkml.kernel.org/r/20240119131429.172448-1-npache@redhat.com
      
      
      Signed-off-by: default avatarNico Pache <npache@redhat.com>
      Cc: Donet Tom <donettom@linux.vnet.ibm.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c9c3cc6a
    • Muhammad Usama Anjum's avatar
      selftests/mm: switch to bash from sh · 1dee72c0
      Muhammad Usama Anjum authored
      [ Upstream commit bc29036e ]
      
      Running charge_reserved_hugetlb.sh generates errors if sh is set to
      dash:
      
      ./charge_reserved_hugetlb.sh: 9: [[: not found
      ./charge_reserved_hugetlb.sh: 19: [[: not found
      ./charge_reserved_hugetlb.sh: 27: [[: not found
      ./charge_reserved_hugetlb.sh: 37: [[: not found
      ./charge_reserved_hugetlb.sh: 45: Syntax error: "(" unexpected
      
      Switch to using /bin/bash instead of /bin/sh.  Make the switch for
      write_hugetlb_memory.sh as well which is called from
      charge_reserved_hugetlb.sh.
      
      Link: https://lkml.kernel.org/r/20240116090455.3407378-1-usama.anjum@collabora.com
      
      
      Signed-off-by: default avatarMuhammad Usama Anjum <usama.anjum@collabora.com>
      Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: David Laight <David.Laight@ACULAB.COM>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1dee72c0
    • Jason Xing's avatar
      netrom: Fix data-races around sysctl_net_busy_read · bbf950a6
      Jason Xing authored
      
      [ Upstream commit d380ce70 ]
      
      We need to protect the reader reading the sysctl value because the
      value can be changed concurrently.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarJason Xing <kernelxing@tencent.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bbf950a6
    • Jason Xing's avatar
      netrom: Fix a data-race around sysctl_netrom_link_fails_count · cfe0f73f
      Jason Xing authored
      
      [ Upstream commit bc76645e ]
      
      We need to protect the reader reading the sysctl value because the
      value can be changed concurrently.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarJason Xing <kernelxing@tencent.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cfe0f73f
    • Jason Xing's avatar
      netrom: Fix a data-race around sysctl_netrom_routing_control · b7d33e08
      Jason Xing authored
      
      [ Upstream commit b5dffcb8 ]
      
      We need to protect the reader reading the sysctl value because the
      value can be changed concurrently.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarJason Xing <kernelxing@tencent.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b7d33e08
    • Jason Xing's avatar
      netrom: Fix a data-race around sysctl_netrom_transport_no_activity_timeout · 01d4e3af
      Jason Xing authored
      
      [ Upstream commit f99b494b ]
      
      We need to protect the reader reading the sysctl value because the
      value can be changed concurrently.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarJason Xing <kernelxing@tencent.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      01d4e3af
    • Jason Xing's avatar
      netrom: Fix a data-race around sysctl_netrom_transport_requested_window_size · 652b0b35
      Jason Xing authored
      
      [ Upstream commit a2e70684 ]
      
      We need to protect the reader reading the sysctl value because the
      value can be changed concurrently.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarJason Xing <kernelxing@tencent.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      652b0b35
    • Jason Xing's avatar
      netrom: Fix a data-race around sysctl_netrom_transport_busy_delay · f3315a6e
      Jason Xing authored
      
      [ Upstream commit 43547d86 ]
      
      We need to protect the reader reading the sysctl value because the
      value can be changed concurrently.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarJason Xing <kernelxing@tencent.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f3315a6e
    • Jason Xing's avatar
      netrom: Fix a data-race around sysctl_netrom_transport_acknowledge_delay · 34c84e00
      Jason Xing authored
      
      [ Upstream commit 806f462b ]
      
      We need to protect the reader reading the sysctl value because the
      value can be changed concurrently.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarJason Xing <kernelxing@tencent.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      34c84e00
    • Jason Xing's avatar
      netrom: Fix a data-race around sysctl_netrom_transport_maximum_tries · 34a164d2
      Jason Xing authored
      
      [ Upstream commit e799299a ]
      
      We need to protect the reader reading the sysctl value because the
      value can be changed concurrently.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarJason Xing <kernelxing@tencent.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      34a164d2
    • Jason Xing's avatar
      netrom: Fix a data-race around sysctl_netrom_transport_timeout · 291d36d7
      Jason Xing authored
      
      [ Upstream commit 60a7a152 ]
      
      We need to protect the reader reading the sysctl value because the
      value can be changed concurrently.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarJason Xing <kernelxing@tencent.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      291d36d7
    • Jason Xing's avatar
      netrom: Fix data-races around sysctl_netrom_network_ttl_initialiser · d1261bde
      Jason Xing authored
      
      [ Upstream commit 119cae5e ]
      
      We need to protect the reader reading the sysctl value because the
      value can be changed concurrently.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarJason Xing <kernelxing@tencent.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d1261bde
    • Jason Xing's avatar
      netrom: Fix a data-race around sysctl_netrom_obsolescence_count_initialiser · 18c95d11
      Jason Xing authored
      
      [ Upstream commit cfd9f4a7 ]
      
      We need to protect the reader reading the sysctl value
      because the value can be changed concurrently.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarJason Xing <kernelxing@tencent.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      18c95d11
    • Jason Xing's avatar
      netrom: Fix a data-race around sysctl_netrom_default_path_quality · e041df5d
      Jason Xing authored
      
      [ Upstream commit 958d6145 ]
      
      We need to protect the reader reading sysctl_netrom_default_path_quality
      because the value can be changed concurrently.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarJason Xing <kernelxing@tencent.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e041df5d
    • Lena Wang's avatar
      netfilter: nf_conntrack_h323: Add protection for bmp length out of range · ccd1108b
      Lena Wang authored
      
      [ Upstream commit 76714663 ]
      
      UBSAN load reports an exception of BRK#5515 SHIFT_ISSUE:Bitwise shifts
      that are out of bounds for their data type.
      
      vmlinux   get_bitmap(b=75) + 712
      <net/netfilter/nf_conntrack_h323_asn1.c:0>
      vmlinux   decode_seq(bs=0xFFFFFFD008037000, f=0xFFFFFFD008037018, level=134443100) + 1956
      <net/netfilter/nf_conntrack_h323_asn1.c:592>
      vmlinux   decode_choice(base=0xFFFFFFD0080370F0, level=23843636) + 1216
      <net/netfilter/nf_conntrack_h323_asn1.c:814>
      vmlinux   decode_seq(f=0xFFFFFFD0080371A8, level=134443500) + 812
      <net/netfilter/nf_conntrack_h323_asn1.c:576>
      vmlinux   decode_choice(base=0xFFFFFFD008037280, level=0) + 1216
      <net/netfilter/nf_conntrack_h323_asn1.c:814>
      vmlinux   DecodeRasMessage() + 304
      <net/netfilter/nf_conntrack_h323_asn1.c:833>
      vmlinux   ras_help() + 684
      <net/netfilter/nf_conntrack_h323_main.c:1728>
      vmlinux   nf_confirm() + 188
      <net/netfilter/nf_conntrack_proto.c:137>
      
      Due to abnormal data in skb->data, the extension bitmap length
      exceeds 32 when decoding ras message then uses the length to make
      a shift operation. It will change into negative after several loop.
      UBSAN load could detect a negative shift as an undefined behaviour
      and reports exception.
      So we add the protection to avoid the length exceeding 32. Or else
      it will return out of range error and stop decoding.
      
      Fixes: 5e35941d ("[NETFILTER]: Add H.323 conntrack/NAT helper")
      Signed-off-by: default avatarLena Wang <lena.wang@mediatek.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ccd1108b
    • Florian Westphal's avatar
      netfilter: nft_ct: fix l3num expectations with inet pseudo family · 2b4e7cb7
      Florian Westphal authored
      
      [ Upstream commit 99993789 ]
      
      Following is rejected but should be allowed:
      
      table inet t {
              ct expectation exp1 {
                      [..]
                      l3proto ip
      
      Valid combos are:
      table ip t, l3proto ip
      table ip6 t, l3proto ip6
      table inet t, l3proto ip OR l3proto ip6
      
      Disallow inet pseudeo family, the l3num must be a on-wire protocol known
      to conntrack.
      
      Retain NFPROTO_INET case to make it clear its rejected
      intentionally rather as oversight.
      
      Fixes: 8059918a ("netfilter: nft_ct: sanitize layer 3 and 4 protocol number in custom expectations")
      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>
      2b4e7cb7
    • Edward Adam Davis's avatar
      net/rds: fix WARNING in rds_conn_connect_if_down · 9dfc15a1
      Edward Adam Davis authored
      
      [ Upstream commit c055fc00 ]
      
      If connection isn't established yet, get_mr() will fail, trigger connection after
      get_mr().
      
      Fixes: 584a8279 ("RDS: RDMA: return appropriate error on rdma map failures")
      Reported-and-tested-by: default avatar <syzbot+d4faee732755bba9838e@syzkaller.appspotmail.com>
      Signed-off-by: default avatarEdward Adam Davis <eadavis@qq.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9dfc15a1
    • Toke Høiland-Jørgensen's avatar
      cpumap: Zero-initialise xdp_rxq_info struct before running XDP program · 5f4e51ab
      Toke Høiland-Jørgensen authored
      
      [ Upstream commit 2487007a ]
      
      When running an XDP program that is attached to a cpumap entry, we don't
      initialise the xdp_rxq_info data structure being used in the xdp_buff
      that backs the XDP program invocation. Tobias noticed that this leads to
      random values being returned as the xdp_md->rx_queue_index value for XDP
      programs running in a cpumap.
      
      This means we're basically returning the contents of the uninitialised
      memory, which is bad. Fix this by zero-initialising the rxq data
      structure before running the XDP program.
      
      Fixes: 92164774 ("bpf: cpumap: Add the possibility to attach an eBPF program to cpumap")
      Reported-by: default avatarTobias Böhm <tobias@aibor.de>
      Signed-off-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      Link: https://lore.kernel.org/r/20240305213132.11955-1-toke@redhat.com
      
      
      Signed-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5f4e51ab
    • Eric Dumazet's avatar
      net/ipv6: avoid possible UAF in ip6_route_mpath_notify() · 79ce2e54
      Eric Dumazet authored
      
      [ Upstream commit 685f7d53 ]
      
      syzbot found another use-after-free in ip6_route_mpath_notify() [1]
      
      Commit f7225172 ("net/ipv6: prevent use after free in
      ip6_route_mpath_notify") was not able to fix the root cause.
      
      We need to defer the fib6_info_release() calls after
      ip6_route_mpath_notify(), in the cleanup phase.
      
      [1]
      BUG: KASAN: slab-use-after-free in rt6_fill_node+0x1460/0x1ac0
      Read of size 4 at addr ffff88809a07fc64 by task syz-executor.2/23037
      
      CPU: 0 PID: 23037 Comm: syz-executor.2 Not tainted 6.8.0-rc4-syzkaller-01035-gea7f3cfaa588 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
      Call Trace:
       <TASK>
        __dump_stack lib/dump_stack.c:88 [inline]
        dump_stack_lvl+0x1e7/0x2e0 lib/dump_stack.c:106
        print_address_description mm/kasan/report.c:377 [inline]
        print_report+0x167/0x540 mm/kasan/report.c:488
        kasan_report+0x142/0x180 mm/kasan/report.c:601
       rt6_fill_node+0x1460/0x1ac0
        inet6_rt_notify+0x13b/0x290 net/ipv6/route.c:6184
        ip6_route_mpath_notify net/ipv6/route.c:5198 [inline]
        ip6_route_multipath_add net/ipv6/route.c:5404 [inline]
        inet6_rtm_newroute+0x1d0f/0x2300 net/ipv6/route.c:5517
        rtnetlink_rcv_msg+0x885/0x1040 net/core/rtnetlink.c:6597
        netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2543
        netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline]
        netlink_unicast+0x7ea/0x980 net/netlink/af_netlink.c:1367
        netlink_sendmsg+0xa3b/0xd70 net/netlink/af_netlink.c:1908
        sock_sendmsg_nosec net/socket.c:730 [inline]
        __sock_sendmsg+0x221/0x270 net/socket.c:745
        ____sys_sendmsg+0x525/0x7d0 net/socket.c:2584
        ___sys_sendmsg net/socket.c:2638 [inline]
        __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2667
       do_syscall_64+0xf9/0x240
       entry_SYSCALL_64_after_hwframe+0x6f/0x77
      RIP: 0033:0x7f73dd87dda9
      Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007f73de6550c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 00007f73dd9ac050 RCX: 00007f73dd87dda9
      RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000000000005
      RBP: 00007f73dd8ca47a R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
      R13: 000000000000006e R14: 00007f73dd9ac050 R15: 00007ffdbdeb7858
       </TASK>
      
      Allocated by task 23037:
        kasan_save_stack mm/kasan/common.c:47 [inline]
        kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
        poison_kmalloc_redzone mm/kasan/common.c:372 [inline]
        __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:389
        kasan_kmalloc include/linux/kasan.h:211 [inline]
        __do_kmalloc_node mm/slub.c:3981 [inline]
        __kmalloc+0x22e/0x490 mm/slub.c:3994
        kmalloc include/linux/slab.h:594 [inline]
        kzalloc include/linux/slab.h:711 [inline]
        fib6_info_alloc+0x2e/0xf0 net/ipv6/ip6_fib.c:155
        ip6_route_info_create+0x445/0x12b0 net/ipv6/route.c:3758
        ip6_route_multipath_add net/ipv6/route.c:5298 [inline]
        inet6_rtm_newroute+0x744/0x2300 net/ipv6/route.c:5517
        rtnetlink_rcv_msg+0x885/0x1040 net/core/rtnetlink.c:6597
        netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2543
        netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline]
        netlink_unicast+0x7ea/0x980 net/netlink/af_netlink.c:1367
        netlink_sendmsg+0xa3b/0xd70 net/netlink/af_netlink.c:1908
        sock_sendmsg_nosec net/socket.c:730 [inline]
        __sock_sendmsg+0x221/0x270 net/socket.c:745
        ____sys_sendmsg+0x525/0x7d0 net/socket.c:2584
        ___sys_sendmsg net/socket.c:2638 [inline]
        __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2667
       do_syscall_64+0xf9/0x240
       entry_SYSCALL_64_after_hwframe+0x6f/0x77
      
      Freed by task 16:
        kasan_save_stack mm/kasan/common.c:47 [inline]
        kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
        kasan_save_free_info+0x4e/0x60 mm/kasan/generic.c:640
        poison_slab_object+0xa6/0xe0 mm/kasan/common.c:241
        __kasan_slab_free+0x34/0x70 mm/kasan/common.c:257
        kasan_slab_free include/linux/kasan.h:184 [inline]
        slab_free_hook mm/slub.c:2121 [inline]
        slab_free mm/slub.c:4299 [inline]
        kfree+0x14a/0x380 mm/slub.c:4409
        rcu_do_batch kernel/rcu/tree.c:2190 [inline]
        rcu_core+0xd76/0x1810 kernel/rcu/tree.c:2465
        __do_softirq+0x2bb/0x942 kernel/softirq.c:553
      
      Last potentially related work creation:
        kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47
        __kasan_record_aux_stack+0xae/0x100 mm/kasan/generic.c:586
        __call_rcu_common kernel/rcu/tree.c:2715 [inline]
        call_rcu+0x167/0xa80 kernel/rcu/tree.c:2829
        fib6_info_release include/net/ip6_fib.h:341 [inline]
        ip6_route_multipath_add net/ipv6/route.c:5344 [inline]
        inet6_rtm_newroute+0x114d/0x2300 net/ipv6/route.c:5517
        rtnetlink_rcv_msg+0x885/0x1040 net/core/rtnetlink.c:6597
        netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2543
        netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline]
        netlink_unicast+0x7ea/0x980 net/netlink/af_netlink.c:1367
        netlink_sendmsg+0xa3b/0xd70 net/netlink/af_netlink.c:1908
        sock_sendmsg_nosec net/socket.c:730 [inline]
        __sock_sendmsg+0x221/0x270 net/socket.c:745
        ____sys_sendmsg+0x525/0x7d0 net/socket.c:2584
        ___sys_sendmsg net/socket.c:2638 [inline]
        __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2667
       do_syscall_64+0xf9/0x240
       entry_SYSCALL_64_after_hwframe+0x6f/0x77
      
      The buggy address belongs to the object at ffff88809a07fc00
       which belongs to the cache kmalloc-512 of size 512
      The buggy address is located 100 bytes inside of
       freed 512-byte region [ffff88809a07fc00, ffff88809a07fe00)
      
      The buggy address belongs to the physical page:
      page:ffffea0002681f00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x9a07c
      head:ffffea0002681f00 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0
      flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
      page_type: 0xffffffff()
      raw: 00fff00000000840 ffff888014c41c80 dead000000000122 0000000000000000
      raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
      page dumped because: kasan: bad access detected
      page_owner tracks the page as allocated
      page last allocated via order 2, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 23028, tgid 23027 (syz-executor.4), ts 2340253595219, free_ts 2339107097036
        set_page_owner include/linux/page_owner.h:31 [inline]
        post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1533
        prep_new_page mm/page_alloc.c:1540 [inline]
        get_page_from_freelist+0x33ea/0x3580 mm/page_alloc.c:3311
        __alloc_pages+0x255/0x680 mm/page_alloc.c:4567
        __alloc_pages_node include/linux/gfp.h:238 [inline]
        alloc_pages_node include/linux/gfp.h:261 [inline]
        alloc_slab_page+0x5f/0x160 mm/slub.c:2190
        allocate_slab mm/slub.c:2354 [inline]
        new_slab+0x84/0x2f0 mm/slub.c:2407
        ___slab_alloc+0xd17/0x13e0 mm/slub.c:3540
        __slab_alloc mm/slub.c:3625 [inline]
        __slab_alloc_node mm/slub.c:3678 [inline]
        slab_alloc_node mm/slub.c:3850 [inline]
        __do_kmalloc_node mm/slub.c:3980 [inline]
        __kmalloc+0x2e0/0x490 mm/slub.c:3994
        kmalloc include/linux/slab.h:594 [inline]
        kzalloc include/linux/slab.h:711 [inline]
        new_dir fs/proc/proc_sysctl.c:956 [inline]
        get_subdir fs/proc/proc_sysctl.c:1000 [inline]
        sysctl_mkdir_p fs/proc/proc_sysctl.c:1295 [inline]
        __register_sysctl_table+0xb30/0x1440 fs/proc/proc_sysctl.c:1376
        neigh_sysctl_register+0x416/0x500 net/core/neighbour.c:3859
        devinet_sysctl_register+0xaf/0x1f0 net/ipv4/devinet.c:2644
        inetdev_init+0x296/0x4d0 net/ipv4/devinet.c:286
        inetdev_event+0x338/0x15c0 net/ipv4/devinet.c:1555
        notifier_call_chain+0x18f/0x3b0 kernel/notifier.c:93
        call_netdevice_notifiers_extack net/core/dev.c:1987 [inline]
        call_netdevice_notifiers net/core/dev.c:2001 [inline]
        register_netdevice+0x15b2/0x1a20 net/core/dev.c:10340
        br_dev_newlink+0x27/0x100 net/bridge/br_netlink.c:1563
        rtnl_newlink_create net/core/rtnetlink.c:3497 [inline]
        __rtnl_newlink net/core/rtnetlink.c:3717 [inline]
        rtnl_newlink+0x158f/0x20a0 net/core/rtnetlink.c:3730
      page last free pid 11583 tgid 11583 stack trace:
        reset_page_owner include/linux/page_owner.h:24 [inline]
        free_pages_prepare mm/page_alloc.c:1140 [inline]
        free_unref_page_prepare+0x968/0xa90 mm/page_alloc.c:2346
        free_unref_page+0x37/0x3f0 mm/page_alloc.c:2486
        kasan_depopulate_vmalloc_pte+0x74/0x90 mm/kasan/shadow.c:415
        apply_to_pte_range mm/memory.c:2619 [inline]
        apply_to_pmd_range mm/memory.c:2663 [inline]
        apply_to_pud_range mm/memory.c:2699 [inline]
        apply_to_p4d_range mm/memory.c:2735 [inline]
        __apply_to_page_range+0x8ec/0xe40 mm/memory.c:2769
        kasan_release_vmalloc+0x9a/0xb0 mm/kasan/shadow.c:532
        __purge_vmap_area_lazy+0x163f/0x1a10 mm/vmalloc.c:1770
        drain_vmap_area_work+0x40/0xd0 mm/vmalloc.c:1804
        process_one_work kernel/workqueue.c:2633 [inline]
        process_scheduled_works+0x913/0x1420 kernel/workqueue.c:2706
        worker_thread+0xa5f/0x1000 kernel/workqueue.c:2787
        kthread+0x2ef/0x390 kernel/kthread.c:388
        ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
        ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:242
      
      Memory state around the buggy address:
       ffff88809a07fb00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
       ffff88809a07fb80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      >ffff88809a07fc00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
       ffff88809a07fc80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
       ffff88809a07fd00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      
      Fixes: 3b1137fe ("net: ipv6: Change notifications for multipath add to RTA_MULTIPATH")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20240303144801.702646-1-edumazet@google.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      79ce2e54
    • Rand Deeb's avatar
      net: ice: Fix potential NULL pointer dereference in ice_bridge_setlink() · 37fe9901
      Rand Deeb authored
      
      [ Upstream commit 06e456a0 ]
      
      The function ice_bridge_setlink() may encounter a NULL pointer dereference
      if nlmsg_find_attr() returns NULL and br_spec is dereferenced subsequently
      in nla_for_each_nested(). To address this issue, add a check to ensure that
      br_spec is not NULL before proceeding with the nested attribute iteration.
      
      Fixes: b1edc14a ("ice: Implement ice_bridge_getlink and ice_bridge_setlink")
      Signed-off-by: default avatarRand Deeb <rand.sec96@gmail.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      37fe9901
    • Eric Dumazet's avatar
      geneve: make sure to pull inner header in geneve_rx() · c7137900
      Eric Dumazet authored
      
      [ Upstream commit 1ca1ba46 ]
      
      syzbot triggered a bug in geneve_rx() [1]
      
      Issue is similar to the one I fixed in commit 8d975c15
      ("ip6_tunnel: make sure to pull inner header in __ip6_tnl_rcv()")
      
      We have to save skb->network_header in a temporary variable
      in order to be able to recompute the network_header pointer
      after a pskb_inet_may_pull() call.
      
      pskb_inet_may_pull() makes sure the needed headers are in skb->head.
      
      [1]
      BUG: KMSAN: uninit-value in IP_ECN_decapsulate include/net/inet_ecn.h:302 [inline]
       BUG: KMSAN: uninit-value in geneve_rx drivers/net/geneve.c:279 [inline]
       BUG: KMSAN: uninit-value in geneve_udp_encap_recv+0x36f9/0x3c10 drivers/net/geneve.c:391
        IP_ECN_decapsulate include/net/inet_ecn.h:302 [inline]
        geneve_rx drivers/net/geneve.c:279 [inline]
        geneve_udp_encap_recv+0x36f9/0x3c10 drivers/net/geneve.c:391
        udp_queue_rcv_one_skb+0x1d39/0x1f20 net/ipv4/udp.c:2108
        udp_queue_rcv_skb+0x6ae/0x6e0 net/ipv4/udp.c:2186
        udp_unicast_rcv_skb+0x184/0x4b0 net/ipv4/udp.c:2346
        __udp4_lib_rcv+0x1c6b/0x3010 net/ipv4/udp.c:2422
        udp_rcv+0x7d/0xa0 net/ipv4/udp.c:2604
        ip_protocol_deliver_rcu+0x264/0x1300 net/ipv4/ip_input.c:205
        ip_local_deliver_finish+0x2b8/0x440 net/ipv4/ip_input.c:233
        NF_HOOK include/linux/netfilter.h:314 [inline]
        ip_local_deliver+0x21f/0x490 net/ipv4/ip_input.c:254
        dst_input include/net/dst.h:461 [inline]
        ip_rcv_finish net/ipv4/ip_input.c:449 [inline]
        NF_HOOK include/linux/netfilter.h:314 [inline]
        ip_rcv+0x46f/0x760 net/ipv4/ip_input.c:569
        __netif_receive_skb_one_core net/core/dev.c:5534 [inline]
        __netif_receive_skb+0x1a6/0x5a0 net/core/dev.c:5648
        process_backlog+0x480/0x8b0 net/core/dev.c:5976
        __napi_poll+0xe3/0x980 net/core/dev.c:6576
        napi_poll net/core/dev.c:6645 [inline]
        net_rx_action+0x8b8/0x1870 net/core/dev.c:6778
        __do_softirq+0x1b7/0x7c5 kernel/softirq.c:553
        do_softirq+0x9a/0xf0 kernel/softirq.c:454
        __local_bh_enable_ip+0x9b/0xa0 kernel/softirq.c:381
        local_bh_enable include/linux/bottom_half.h:33 [inline]
        rcu_read_unlock_bh include/linux/rcupdate.h:820 [inline]
        __dev_queue_xmit+0x2768/0x51c0 net/core/dev.c:4378
        dev_queue_xmit include/linux/netdevice.h:3171 [inline]
        packet_xmit+0x9c/0x6b0 net/packet/af_packet.c:276
        packet_snd net/packet/af_packet.c:3081 [inline]
        packet_sendmsg+0x8aef/0x9f10 net/packet/af_packet.c:3113
        sock_sendmsg_nosec net/socket.c:730 [inline]
        __sock_sendmsg net/socket.c:745 [inline]
        __sys_sendto+0x735/0xa10 net/socket.c:2191
        __do_sys_sendto net/socket.c:2203 [inline]
        __se_sys_sendto net/socket.c:2199 [inline]
        __x64_sys_sendto+0x125/0x1c0 net/socket.c:2199
        do_syscall_x64 arch/x86/entry/common.c:52 [inline]
        do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x63/0x6b
      
      Uninit was created at:
        slab_post_alloc_hook mm/slub.c:3819 [inline]
        slab_alloc_node mm/slub.c:3860 [inline]
        kmem_cache_alloc_node+0x5cb/0xbc0 mm/slub.c:3903
        kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:560
        __alloc_skb+0x352/0x790 net/core/skbuff.c:651
        alloc_skb include/linux/skbuff.h:1296 [inline]
        alloc_skb_with_frags+0xc8/0xbd0 net/core/skbuff.c:6394
        sock_alloc_send_pskb+0xa80/0xbf0 net/core/sock.c:2783
        packet_alloc_skb net/packet/af_packet.c:2930 [inline]
        packet_snd net/packet/af_packet.c:3024 [inline]
        packet_sendmsg+0x70c2/0x9f10 net/packet/af_packet.c:3113
        sock_sendmsg_nosec net/socket.c:730 [inline]
        __sock_sendmsg net/socket.c:745 [inline]
        __sys_sendto+0x735/0xa10 net/socket.c:2191
        __do_sys_sendto net/socket.c:2203 [inline]
        __se_sys_sendto net/socket.c:2199 [inline]
        __x64_sys_sendto+0x125/0x1c0 net/socket.c:2199
        do_syscall_x64 arch/x86/entry/common.c:52 [inline]
        do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x63/0x6b
      
      Fixes: 2d07dc79 ("geneve: add initial netdev driver for GENEVE tunnels")
      Reported-and-tested-by: default avatar <syzbot+6a1423ff3f97159aae64@syzkaller.appspotmail.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c7137900
    • Steven Rostedt (Google)'s avatar
      tracing/net_sched: Fix tracepoints that save qdisc_dev() as a string · fdb63c17
      Steven Rostedt (Google) authored
      
      [ Upstream commit 51270d57 ]
      
      I'm updating __assign_str() and will be removing the second parameter. To
      make sure that it does not break anything, I make sure that it matches the
      __string() field, as that is where the string is actually going to be
      saved in. To make sure there's nothing that breaks, I added a WARN_ON() to
      make sure that what was used in __string() is the same that is used in
      __assign_str().
      
      In doing this change, an error was triggered as __assign_str() now expects
      the string passed in to be a char * value. I instead had the following
      warning:
      
      include/trace/events/qdisc.h: In function ‘trace_event_raw_event_qdisc_reset’:
      include/trace/events/qdisc.h:91:35: error: passing argument 1 of 'strcmp' from incompatible pointer type [-Werror=incompatible-pointer-types]
         91 |                 __assign_str(dev, qdisc_dev(q));
      
      That's because the qdisc_enqueue() and qdisc_reset() pass in qdisc_dev(q)
      to __assign_str() and to __string(). But that function returns a pointer
      to struct net_device and not a string.
      
      It appears that these events are just saving the pointer as a string and
      then reading it as a string as well.
      
      Use qdisc_dev(q)->name to save the device instead.
      
      Fixes: a34dac0b ("net_sched: add tracepoints for qdisc_reset() and qdisc_destroy()")
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Reviewed-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fdb63c17
    • Maciej Fijalkowski's avatar
      i40e: disable NAPI right after disabling irqs when handling xsk_pool · 71e21eb1
      Maciej Fijalkowski authored
      
      [ Upstream commit d562b11c ]
      
      Disable NAPI before shutting down queues that this particular NAPI
      contains so that the order of actions in i40e_queue_pair_disable()
      mirrors what we do in i40e_queue_pair_enable().
      
      Fixes: 123cecd4 ("i40e: added queue pair disable/enable functions")
      Signed-off-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Tested-by: Chandan Kumar Rout <chandanx.rout@intel.com> (A Contingent Worker at Intel)
      Acked-by: default avatarMagnus Karlsson <magnus.karlsson@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      71e21eb1
    • Maciej Fijalkowski's avatar
      ixgbe: {dis, en}able irqs in ixgbe_txrx_ring_{dis, en}able · ad91d5d1
      Maciej Fijalkowski authored
      
      [ Upstream commit cbf996f5 ]
      
      Currently routines that are supposed to toggle state of ring pair do not
      take care of associated interrupt with queue vector that these rings
      belong to. This causes funky issues such as dead interface due to irq
      misconfiguration, as per Pavel's report from Closes: tag.
      
      Add a function responsible for disabling single IRQ in EIMC register and
      call this as a very first thing when disabling ring pair during xsk_pool
      setup. For enable let's reuse ixgbe_irq_enable_queues(). Besides this,
      disable/enable NAPI as first/last thing when dealing with closing or
      opening ring pair that xsk_pool is being configured on.
      
      Reported-by: default avatarPavel Vazharov <pavel@x3me.net>
      Closes: https://lore.kernel.org/netdev/CAJEV1ijxNyPTwASJER1bcZzS9nMoZJqfR86nu_3jFFVXzZQ4NA@mail.gmail.com/
      
      
      Fixes: 024aa580 ("ixgbe: added Rx/Tx ring disable/enable functions")
      Signed-off-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Acked-by: default avatarMagnus Karlsson <magnus.karlsson@intel.com>
      Tested-by: Chandan Kumar Rout <chandanx.rout@intel.com> (A Contingent Worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ad91d5d1
    • Oleksij Rempel's avatar
      net: lan78xx: fix runtime PM count underflow on link stop · 336261af
      Oleksij Rempel authored
      
      [ Upstream commit 1eecc7ab ]
      
      Current driver has some asymmetry in the runtime PM calls. On lan78xx_open()
      it will call usb_autopm_get() and unconditionally usb_autopm_put(). And
      on lan78xx_stop() it will call only usb_autopm_put(). So far, it was
      working only because this driver do not activate autosuspend by default,
      so it was visible only by warning "Runtime PM usage count underflow!".
      
      Since, with current driver, we can't use runtime PM with active link,
      execute lan78xx_open()->usb_autopm_put() only in error case. Otherwise,
      keep ref counting high as long as interface is open.
      
      Fixes: 55d7de9d ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      336261af
    • John Efstathiades's avatar
      lan78xx: Fix race conditions in suspend/resume handling · 11a3c9f4
      John Efstathiades authored
      
      [ Upstream commit 5f4cc6e2 ]
      
      If the interface is given an IP address while the device is
      suspended (as a result of an auto-suspend event) there is a race
      between lan78xx_resume() and lan78xx_open() that can result in an
      exception or failure to handle incoming packets. The following
      changes fix this problem.
      
      Introduce a mutex to serialise operations in the network interface
      open and stop entry points with respect to the USB driver suspend
      and resume entry points.
      
      Move Tx and Rx data path start/stop to lan78xx_start() and
      lan78xx_stop() respectively and flush the packet FIFOs before
      starting the Tx and Rx data paths. This prevents the MAC and FIFOs
      getting out of step and delivery of malformed packets to the network
      stack.
      
      Stop processing of received packets before disconnecting the
      PHY from the MAC to prevent a kernel exception caused by handling
      packets after the PHY device has been removed.
      
      Refactor device auto-suspend code to make it consistent with the
      the system suspend code and make the suspend handler easier to read.
      
      Add new code to stop wake-on-lan packets or PHY events resuming the
      host or device from suspend if the device has not been opened
      (typically after an IP address is assigned).
      
      This patch is dependent on changes to lan78xx_suspend() and
      lan78xx_resume() introduced in the previous patch of this patch set.
      
      Signed-off-by: default avatarJohn Efstathiades <john.efstathiades@pebblebay.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Stable-dep-of: 1eecc7ab ("net: lan78xx: fix runtime PM count underflow on link stop")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      11a3c9f4
    • John Efstathiades's avatar
      lan78xx: Fix partial packet errors on suspend/resume · 69215f8e
      John Efstathiades authored
      
      [ Upstream commit e1210fe6 ]
      
      The MAC can get out of step with the internal packet FIFOs if the
      system goes to sleep when the link is active, especially at high
      data rates. This can result in partial frames in the packet FIFOs
      that in result in malformed frames being delivered to the host.
      This occurs because the driver does not enable/disable the internal
      packet FIFOs in step with the corresponding MAC data path. The
      following changes fix this problem.
      
      Update code that enables/disables the MAC receiver and transmitter
      to the more general Rx and Tx data path, where the data path in each
      direction consists of both the MAC function (Tx or Rx) and the
      corresponding packet FIFO.
      
      In the receive path the packet FIFO must be enabled before the MAC
      receiver but disabled after the MAC receiver.
      
      In the transmit path the opposite is true: the packet FIFO must be
      enabled after the MAC transmitter but disabled before the MAC
      transmitter.
      
      The packet FIFOs can be flushed safely once the corresponding data
      path is stopped.
      
      Signed-off-by: default avatarJohn Efstathiades <john.efstathiades@pebblebay.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Stable-dep-of: 1eecc7ab ("net: lan78xx: fix runtime PM count underflow on link stop")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      69215f8e
    • John Efstathiades's avatar
      lan78xx: Add missing return code checks · e5d7f43c
      John Efstathiades authored
      
      [ Upstream commit 3415f6ba ]
      
      There are many places in the driver where the return code from a
      function call is captured but without a subsequent test of the
      return code and appropriate action taken.
      
      This patch adds the missing return code tests and action. In most
      cases the action is an early exit from the calling function.
      
      The function lan78xx_set_suspend() was also updated to make it
      consistent with lan78xx_suspend().
      
      Signed-off-by: default avatarJohn Efstathiades <john.efstathiades@pebblebay.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Stable-dep-of: 1eecc7ab ("net: lan78xx: fix runtime PM count underflow on link stop")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e5d7f43c
    • John Efstathiades's avatar
      lan78xx: Fix white space and style issues · 06133626
      John Efstathiades authored
      
      [ Upstream commit 9ceec7d3 ]
      
      Fix white space and code style issues identified by checkpatch.
      
      Signed-off-by: default avatarJohn Efstathiades <john.efstathiades@pebblebay.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Stable-dep-of: 1eecc7ab ("net: lan78xx: fix runtime PM count underflow on link stop")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      06133626
    • Christophe Kerello's avatar
      mmc: mmci: stm32: fix DMA API overlapping mappings warning · 0224cbc5
      Christophe Kerello authored
      
      [ Upstream commit 6b1ba3f9 ]
      
      Turning on CONFIG_DMA_API_DEBUG_SG results in the following warning:
      
      DMA-API: mmci-pl18x 48220000.mmc: cacheline tracking EEXIST,
      overlapping mappings aren't supported
      WARNING: CPU: 1 PID: 51 at kernel/dma/debug.c:568
      add_dma_entry+0x234/0x2f4
      Modules linked in:
      CPU: 1 PID: 51 Comm: kworker/1:2 Not tainted 6.1.28 #1
      Hardware name: STMicroelectronics STM32MP257F-EV1 Evaluation Board (DT)
      Workqueue: events_freezable mmc_rescan
      Call trace:
      add_dma_entry+0x234/0x2f4
      debug_dma_map_sg+0x198/0x350
      __dma_map_sg_attrs+0xa0/0x110
      dma_map_sg_attrs+0x10/0x2c
      sdmmc_idma_prep_data+0x80/0xc0
      mmci_prep_data+0x38/0x84
      mmci_start_data+0x108/0x2dc
      mmci_request+0xe4/0x190
      __mmc_start_request+0x68/0x140
      mmc_start_request+0x94/0xc0
      mmc_wait_for_req+0x70/0x100
      mmc_send_tuning+0x108/0x1ac
      sdmmc_execute_tuning+0x14c/0x210
      mmc_execute_tuning+0x48/0xec
      mmc_sd_init_uhs_card.part.0+0x208/0x464
      mmc_sd_init_card+0x318/0x89c
      mmc_attach_sd+0xe4/0x180
      mmc_rescan+0x244/0x320
      
      DMA API debug brings to light leaking dma-mappings as dma_map_sg and
      dma_unmap_sg are not correctly balanced.
      
      If an error occurs in mmci_cmd_irq function, only mmci_dma_error
      function is called and as this API is not managed on stm32 variant,
      dma_unmap_sg is never called in this error path.
      
      Signed-off-by: default avatarChristophe Kerello <christophe.kerello@foss.st.com>
      Fixes: 46b723dd ("mmc: mmci: add stm32 sdmmc variant")
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20240207143951.938144-1-christophe.kerello@foss.st.com
      
      
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0224cbc5
    • Yann Gautier's avatar
      mmc: mmci: stm32: use a buffer for unaligned DMA requests · abda366e
      Yann Gautier authored
      
      [ Upstream commit 970dc9c1 ]
      
      In SDIO mode, the sg list for requests can be unaligned with what the
      STM32 SDMMC internal DMA can support. In that case, instead of failing,
      use a temporary bounce buffer to copy from/to the sg list.
      This buffer is limited to 1MB. But for that we need to also limit
      max_req_size to 1MB. It has not shown any throughput penalties for
      SD-cards or eMMC.
      
      Signed-off-by: default avatarYann Gautier <yann.gautier@foss.st.com>
      Link: https://lore.kernel.org/r/20220328145114.334577-1-yann.gautier@foss.st.com
      
      
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Stable-dep-of: 6b1ba3f9 ("mmc: mmci: stm32: fix DMA API overlapping mappings warning")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      abda366e
  2. Mar 06, 2024
Loading