Skip to content
  1. Mar 04, 2022
  2. Mar 03, 2022
    • Christophe JAILLET's avatar
      bnx2: Fix an error message · 8ccffe9a
      Christophe JAILLET authored
      
      
      Fix an error message and report the correct failing function.
      
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8ccffe9a
    • Niels Dossche's avatar
      sfc: extend the locking on mcdi->seqno · f1fb205e
      Niels Dossche authored
      
      
      seqno could be read as a stale value outside of the lock. The lock is
      already acquired to protect the modification of seqno against a possible
      race condition. Place the reading of this value also inside this locking
      to protect it against a possible race condition.
      
      Signed-off-by: default avatarNiels Dossche <dossche.niels@gmail.com>
      Acked-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f1fb205e
    • David S. Miller's avatar
      Merge branch 'smc-fix' · f8e9bd34
      David S. Miller authored
      
      
      D. Wythe says:
      
      ====================
      fix unexpected SMC_CLC_DECL_ERR_REGRMB error
      
      We can easily trigger the SMC_CLC_DECL_ERR_REGRMB exception within
      following script:
      
      server: smc_run nginx
      client: smc_run  ./wrk -c 2000 -t 8 -d 20 http://smc-server
      
      And we can clearly see that this error is also divided into two types:
      
      1. 0x09990003
      2. 0x05000000/0x09990003
      
      Which has the same root causes, but the immediate causes vary.
      
      The root cause of this issues is that remove connections from link group
      is not synchronous with add/delete rtoken entry,  which means that even
      the number of connections is less that SMC_RMBS_PER_LGR_MAX, it does not
      mean that the connection can register rtoken successfully later. In
      other words, the rtoken entry may released, This will cause an
      unexpected SMC_CLC_DECL_ERR_REGRMB to be reported, and then this SMC
      connections have to fallback to TCP.
      
      This patch set handles two types of SMC_CLC_DECL_ERR_REGRMB exceptions
      from different perspectives.
      
      Patch 1: fix the 0x05000000/0x09990003 error.
      Patch 2: fix the 0x09990003 error.
      
      After those patches, there is no SMC_CLC_DECL_ERR_REGRMB exceptions in
      my
      test case any more.
      
      v1 -> v2:
      - add bugfix patch for SMC_CLC_DECL_ERR_REGRMB cause by server side
      v2 -> v3:
      - fix incorrect mail thread
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f8e9bd34
    • D. Wythe's avatar
      net/smc: fix unexpected SMC_CLC_DECL_ERR_REGRMB error cause by server · 4940a1fd
      D. Wythe authored
      The problem of SMC_CLC_DECL_ERR_REGRMB on the server is very clear.
      Based on the fact that whether a new SMC connection can be accepted or
      not depends on not only the limit of conn nums, but also the available
      entries of rtoken. Since the rtoken release is trigger by peer, while
      the conn nums is decrease by local, tons of thing can happen in this
      time difference.
      
      This only thing that needs to be mentioned is that now all connection
      creations are completely protected by smc_server_lgr_pending lock, it's
      enough to check only the available entries in rtokens_used_mask.
      
      Fixes: cd6851f3
      
       ("smc: remote memory buffers (RMBs)")
      Signed-off-by: default avatarD. Wythe <alibuda@linux.alibaba.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4940a1fd
    • D. Wythe's avatar
      net/smc: fix unexpected SMC_CLC_DECL_ERR_REGRMB error generated by client · 0537f0a2
      D. Wythe authored
      The main reason for this unexpected SMC_CLC_DECL_ERR_REGRMB in client
      dues to following execution sequence:
      
      Server Conn A:           Server Conn B:			Client Conn B:
      
      smc_lgr_unregister_conn
                              smc_lgr_register_conn
                              smc_clc_send_accept     ->
                                                              smc_rtoken_add
      smcr_buf_unuse
      		->		Client Conn A:
      				smc_rtoken_delete
      
      smc_lgr_unregister_conn() makes current link available to assigned to new
      incoming connection, while smcr_buf_unuse() has not executed yet, which
      means that smc_rtoken_add may fail because of insufficient rtoken_entry,
      reversing their execution order will avoid this problem.
      
      Fixes: 3e034725
      
       ("net/smc: common functions for RMBs and send buffers")
      Signed-off-by: default avatarD. Wythe <alibuda@linux.alibaba.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0537f0a2
    • Zheyu Ma's avatar
      net: arcnet: com20020: Fix null-ptr-deref in com20020pci_probe() · bd6f1fd5
      Zheyu Ma authored
      During driver initialization, the pointer of card info, i.e. the
      variable 'ci' is required. However, the definition of
      'com20020pci_id_table' reveals that this field is empty for some
      devices, which will cause null pointer dereference when initializing
      these devices.
      
      The following log reveals it:
      
      [    3.973806] KASAN: null-ptr-deref in range [0x0000000000000028-0x000000000000002f]
      [    3.973819] RIP: 0010:com20020pci_probe+0x18d/0x13e0 [com20020_pci]
      [    3.975181] Call Trace:
      [    3.976208]  local_pci_probe+0x13f/0x210
      [    3.977248]  pci_device_probe+0x34c/0x6d0
      [    3.977255]  ? pci_uevent+0x470/0x470
      [    3.978265]  really_probe+0x24c/0x8d0
      [    3.978273]  __driver_probe_device+0x1b3/0x280
      [    3.979288]  driver_probe_device+0x50/0x370
      
      Fix this by checking whether the 'ci' is a null pointer first.
      
      Fixes: 8c14f9c7
      
       ("ARCNET: add com20020 PCI IDs with metadata")
      Signed-off-by: default avatarZheyu Ma <zheyuma97@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bd6f1fd5
    • Eric Dumazet's avatar
      tcp: make tcp_read_sock() more robust · e3d5ea2c
      Eric Dumazet authored
      
      
      If recv_actor() returns an incorrect value, tcp_read_sock()
      might loop forever.
      
      Instead, issue a one time warning and make sure to make progress.
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarJakub Sitnicki <jakub@cloudflare.com>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/r/20220302161723.3910001-2-eric.dumazet@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e3d5ea2c
    • Eric Dumazet's avatar
      bpf, sockmap: Do not ignore orig_len parameter · 60ce37b0
      Eric Dumazet authored
      Currently, sk_psock_verdict_recv() returns skb->len
      
      This is problematic because tcp_read_sock() might have
      passed orig_len < skb->len, due to the presence of TCP urgent data.
      
      This causes an infinite loop from tcp_read_sock()
      
      Followup patch will make tcp_read_sock() more robust vs bad actors.
      
      Fixes: ef565928
      
       ("bpf, sockmap: Allow skipping sk_skb parser program")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarJakub Sitnicki <jakub@cloudflare.com>
      Tested-by: default avatarJakub Sitnicki <jakub@cloudflare.com>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/r/20220302161723.3910001-1-eric.dumazet@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      60ce37b0
    • Alex Elder's avatar
      net: ipa: add an interconnect dependency · 1dba41c9
      Alex Elder authored
      
      
      In order to function, the IPA driver very clearly requires the
      interconnect framework to be enabled in the kernel configuration.
      State that dependency in the Kconfig file.
      
      This became a problem when CONFIG_COMPILE_TEST support was added.
      Non-Qualcomm platforms won't necessarily enable CONFIG_INTERCONNECT.
      
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Fixes: 38a4066f
      
       ("net: ipa: support COMPILE_TEST")
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Link: https://lore.kernel.org/r/20220301113440.257916-1-elder@linaro.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1dba41c9
    • lena wang's avatar
      net: fix up skbs delta_truesize in UDP GRO frag_list · 224102de
      lena wang authored
      The truesize for a UDP GRO packet is added by main skb and skbs in main
      skb's frag_list:
      skb_gro_receive_list
              p->truesize += skb->truesize;
      
      The commit 53475c5d ("net: fix use-after-free when UDP GRO with
      shared fraglist") introduced a truesize increase for frag_list skbs.
      When uncloning skb, it will call pskb_expand_head and trusesize for
      frag_list skbs may increase. This can occur when allocators uses
      __netdev_alloc_skb and not jump into __alloc_skb. This flow does not
      use ksize(len) to calculate truesize while pskb_expand_head uses.
      skb_segment_list
      err = skb_unclone(nskb, GFP_ATOMIC);
      pskb_expand_head
              if (!skb->sk || skb->destructor == sock_edemux)
                      skb->truesize += size - osize;
      
      If we uses increased truesize adding as delta_truesize, it will be
      larger than before and even larger than previous total truesize value
      if skbs in frag_list are abundant. The main skb truesize will become
      smaller and even a minus value or a huge value for an unsigned int
      parameter. Then the following memory check will drop this abnormal skb.
      
      To avoid this error we should use the original truesize to segment the
      main skb.
      
      Fixes: 53475c5d
      
       ("net: fix use-after-free when UDP GRO with shared fraglist")
      Signed-off-by: default avatarlena wang <lena.wang@mediatek.com>
      Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/1646133431-8948-1-git-send-email-lena.wang@mediatek.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      224102de
    • Jakub Kicinski's avatar
      Merge tag 'batadv-net-pullrequest-20220302' of git://git.open-mesh.org/linux-merge · ea97ab98
      Jakub Kicinski authored
      
      
      Simon Wunderlich says:
      
      ====================
      Here are some batman-adv bugfixes:
      
       - Remove redundant iflink requests, by Sven Eckelmann (2 patches)
      
       - Don't expect inter-netns unique iflink indices, by Sven Eckelmann
      
      * tag 'batadv-net-pullrequest-20220302' of git://git.open-mesh.org/linux-merge:
        batman-adv: Don't expect inter-netns unique iflink indices
        batman-adv: Request iflink once in batadv_get_real_netdevice
        batman-adv: Request iflink once in batadv-on-batadv check
      ====================
      
      Link: https://lore.kernel.org/r/20220302163049.101957-1-sw@simonwunderlich.de
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ea97ab98
    • Jakub Kicinski's avatar
      Merge tag 'wireless-for-net-2022-03-02' of... · 95749c10
      Jakub Kicinski authored
      
      Merge tag 'wireless-for-net-2022-03-02' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless
      
      Johannes Berg says:
      
      ====================
      Three more fixes:
       - fix build issue in iwlwifi, now that I understood
         what's going on there
       - propagate error in iwlwifi/mvm to userspace so it
         can figure out what's happening
       - fix channel switch related updates in P2P-client
         in cfg80211
      
      * tag 'wireless-for-net-2022-03-02' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless:
        iwlwifi: mvm: return value for request_ownership
        nl80211: Update bss channel on channel switch for P2P_CLIENT
        iwlwifi: fix build error for IWLMEI
      ====================
      
      Link: https://lore.kernel.org/r/20220302214444.100180-1-johannes@sipsolutions.net
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      95749c10
    • Emmanuel Grumbach's avatar
      iwlwifi: mvm: return value for request_ownership · e6e91ec9
      Emmanuel Grumbach authored
      Propagate the value to the user space so it can understand
      if the operation failed or not.
      
      Fixes: bfcfdb59
      
       ("iwlwifi: mvm: add vendor commands needed for iwlmei")
      Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Link: https://lore.kernel.org/r/20220302072715.4885-1-emmanuel.grumbach@intel.com
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      e6e91ec9
    • Sreeramya Soratkal's avatar
      nl80211: Update bss channel on channel switch for P2P_CLIENT · e50b88c4
      Sreeramya Soratkal authored
      
      
      The wdev channel information is updated post channel switch only for
      the station mode and not for the other modes. Due to this, the P2P client
      still points to the old value though it moved to the new channel
      when the channel change is induced from the P2P GO.
      
      Update the bss channel after CSA channel switch completion for P2P client
      interface as well.
      
      Signed-off-by: default avatarSreeramya Soratkal <quic_ssramya@quicinc.com>
      Link: https://lore.kernel.org/r/1646114600-31479-1-git-send-email-quic_ssramya@quicinc.com
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      e50b88c4
    • Randy Dunlap's avatar
      iwlwifi: fix build error for IWLMEI · 875ad060
      Randy Dunlap authored
      When CONFIG_IWLWIFI=m and CONFIG_IWLMEI=y, the kernel build system
      must be told to build the iwlwifi/ subdirectory for both IWLWIFI and
      IWLMEI so that builds for both =y and =m are done.
      
      This resolves an undefined reference build error:
      
      ERROR: modpost: "iwl_mei_is_connected" [drivers/net/wireless/intel/iwlwifi/iwlwifi.ko] undefined!
      
      Fixes: 977df8bd
      
       ("wlwifi: work around reverse dependency on MEI")
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Luca Coelho <luciano.coelho@intel.com>
      Cc: linux-wireless@vger.kernel.org
      Link: https://lore.kernel.org/r/20220227200051.7176-1-rdunlap@infradead.org
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      875ad060
    • Jonathan Lemon's avatar
      ptp: ocp: Add ptp_ocp_adjtime_coarse for large adjustments · 90f8f4c0
      Jonathan Lemon authored
      In ("ptp: ocp: Have FPGA fold in ns adjustment for adjtime."), the
      ns adjustment was written to the FPGA register, so the clock could
      accurately perform adjustments.
      
      However, the adjtime() call passes in a s64, while the clock adjustment
      registers use a s32.  When trying to perform adjustments with a large
      value (37 sec), things fail.
      
      Examine the incoming delta, and if larger than 1 sec, use the original
      (coarse) adjustment method.  If smaller than 1 sec, then allow the
      FPGA to fold in the changes over a 1 second window.
      
      Fixes: 6d59d4fa
      
       ("ptp: ocp: Have FPGA fold in ns adjustment for adjtime.")
      Signed-off-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
      Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
      Link: https://lore.kernel.org/r/20220228203957.367371-1-jonathan.lemon@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      90f8f4c0
  3. Mar 02, 2022
    • Sven Eckelmann's avatar
      batman-adv: Don't expect inter-netns unique iflink indices · 6c1f41af
      Sven Eckelmann authored
      The ifindex doesn't have to be unique for multiple network namespaces on
      the same machine.
      
        $ ip netns add test1
        $ ip -net test1 link add dummy1 type dummy
        $ ip netns add test2
        $ ip -net test2 link add dummy2 type dummy
      
        $ ip -net test1 link show dev dummy1
        6: dummy1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
            link/ether 96:81:55:1e:dd:85 brd ff:ff:ff:ff:ff:ff
        $ ip -net test2 link show dev dummy2
        6: dummy2: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
            link/ether 5a:3c:af:35:07:c3 brd ff:ff:ff:ff:ff:ff
      
      But the batman-adv code to walk through the various layers of virtual
      interfaces uses this assumption because dev_get_iflink handles it
      internally and doesn't return the actual netns of the iflink. And
      dev_get_iflink only documents the situation where ifindex == iflink for
      physical devices.
      
      But only checking for dev->netdev_ops->ndo_get_iflink is also not an option
      because ipoib_get_iflink implements it even when it sometimes returns an
      iflink != ifindex and sometimes iflink == ifindex. The caller must
      therefore make sure itself to check both netns and iflink + ifindex for
      equality. Only when they are equal, a "physical" interface was detected
      which should stop the traversal. On the other hand, vxcan_get_iflink can
      also return 0 in case there was currently no valid peer. In this case, it
      is still necessary to stop.
      
      Fixes: b7eddd0b ("batman-adv: prevent using any virtual device created on batman-adv as hard-interface")
      Fixes: 5ed4a460
      
       ("batman-adv: additional checks for virtual interfaces on top of WiFi")
      Reported-by: default avatarSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
      Signed-off-by: default avatarSimon Wunderlich <sw@simonwunderlich.de>
      6c1f41af
    • Sven Eckelmann's avatar
      batman-adv: Request iflink once in batadv_get_real_netdevice · 6116ba09
      Sven Eckelmann authored
      There is no need to call dev_get_iflink multiple times for the same
      net_device in batadv_get_real_netdevice. And since some of the
      ndo_get_iflink callbacks are dynamic (for example via RCUs like in
      vxcan_get_iflink), it could easily happen that the returned values are not
      stable. The pre-checks before __dev_get_by_index are then of course bogus.
      
      Fixes: 5ed4a460
      
       ("batman-adv: additional checks for virtual interfaces on top of WiFi")
      Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
      Signed-off-by: default avatarSimon Wunderlich <sw@simonwunderlich.de>
      6116ba09
    • Sven Eckelmann's avatar
      batman-adv: Request iflink once in batadv-on-batadv check · 690bb6fb
      Sven Eckelmann authored
      There is no need to call dev_get_iflink multiple times for the same
      net_device in batadv_is_on_batman_iface. And since some of the
      .ndo_get_iflink callbacks are dynamic (for example via RCUs like in
      vxcan_get_iflink), it could easily happen that the returned values are not
      stable. The pre-checks before __dev_get_by_index are then of course bogus.
      
      Fixes: b7eddd0b
      
       ("batman-adv: prevent using any virtual device created on batman-adv as hard-interface")
      Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
      Signed-off-by: default avatarSimon Wunderlich <sw@simonwunderlich.de>
      690bb6fb
    • Vladimir Oltean's avatar
      net: dsa: restore error path of dsa_tree_change_tag_proto · 0b0e2ff1
      Vladimir Oltean authored
      When the DSA_NOTIFIER_TAG_PROTO returns an error, the user space process
      which initiated the protocol change exits the kernel processing while
      still holding the rtnl_mutex. So any other process attempting to lock
      the rtnl_mutex would deadlock after such event.
      
      The error handling of DSA_NOTIFIER_TAG_PROTO was inadvertently changed
      by the blamed commit, introducing this regression. We must still call
      rtnl_unlock(), and we must still call DSA_NOTIFIER_TAG_PROTO for the old
      protocol. The latter is due to the limiting design of notifier chains
      for cross-chip operations, which don't have a built-in error recovery
      mechanism - we should look into using notifier_call_chain_robust for that.
      
      Fixes: dc452a47
      
       ("net: dsa: introduce tagger-owned storage for private and shared data")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Link: https://lore.kernel.org/r/20220228141715.146485-1-vladimir.oltean@nxp.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      0b0e2ff1
    • Jakub Kicinski's avatar
      Merge tag 'for-net-2022-03-01' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth · 2e77551c
      Jakub Kicinski authored
      
      
      Luiz Augusto von Dentz says:
      
      ====================
      bluetooth pull request for net:
      
       - Fix regression with scanning not working in some systems.
      
      * tag 'for-net-2022-03-01' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth:
        Bluetooth: Fix not checking MGMT cmd pending queue
      ====================
      
      Link: https://lore.kernel.org/r/20220302004330.125536-1-luiz.dentz@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2e77551c
    • Brian Gix's avatar
      Bluetooth: Fix not checking MGMT cmd pending queue · 275f3f64
      Brian Gix authored
      
      
      A number of places in the MGMT handlers we examine the command queue for
      other commands (in progress but not yet complete) that will interact
      with the process being performed. However, not all commands go into the
      queue if one of:
      
      1. There is no negative side effect of consecutive or redundent commands
      2. The command is entirely perform "inline".
      
      This change examines each "pending command" check, and if it is not
      needed, deletes the check. Of the remaining pending command checks, we
      make sure that the command is in the pending queue by using the
      mgmt_pending_add/mgmt_pending_remove pair rather than the
      mgmt_pending_new/mgmt_pending_free pair.
      
      Link: https://lore.kernel.org/linux-bluetooth/f648f2e11bb3c2974c32e605a85ac3a9fac944f1.camel@redhat.com/T/
      Tested-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
      Signed-off-by: default avatarBrian Gix <brian.gix@intel.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      275f3f64
    • Jakub Kicinski's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf · 4761df52
      Jakub Kicinski authored
      
      
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter fixes for net
      
      1) Use kfree_rcu(ptr, rcu) variant, using kfree_rcu(ptr) was not
         intentional. From Eric Dumazet.
      
      2) Use-after-free in netfilter hook core, from Eric Dumazet.
      
      3) Missing rcu read lock side for netfilter egress hook,
         from Florian Westphal.
      
      4) nf_queue assume state->sk is full socket while it might not be.
         Invoke sock_gen_put(), from Florian Westphal.
      
      5) Add selftest to exercise the reported KASAN splat in 4)
      
      6) Fix possible use-after-free in nf_queue in case sk_refcnt is 0.
         Also from Florian.
      
      7) Use input interface index only for hardware offload, not for
         the software plane. This breaks tc ct action. Patch from Paul Blakey.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf:
        net/sched: act_ct: Fix flow table lookup failure with no originating ifindex
        netfilter: nf_queue: handle socket prefetch
        netfilter: nf_queue: fix possible use-after-free
        selftests: netfilter: add nfqueue TCP_NEW_SYN_RECV socket race test
        netfilter: nf_queue: don't assume sk is full socket
        netfilter: egress: silence egress hook lockdep splats
        netfilter: fix use-after-free in __nf_register_net_hook()
        netfilter: nf_tables: prefer kfree_rcu(ptr, rcu) variant
      ====================
      
      Link: https://lore.kernel.org/r/20220301215337.378405-1-pablo@netfilter.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      4761df52
    • Paul Blakey's avatar
      net/sched: act_ct: Fix flow table lookup failure with no originating ifindex · db6140e5
      Paul Blakey authored
      After cited commit optimizted hw insertion, flow table entries are
      populated with ifindex information which was intended to only be used
      for HW offload. This tuple ifindex is hashed in the flow table key, so
      it must be filled for lookup to be successful. But tuple ifindex is only
      relevant for the netfilter flowtables (nft), so it's not filled in
      act_ct flow table lookup, resulting in lookup failure, and no SW
      offload and no offload teardown for TCP connection FIN/RST packets.
      
      To fix this, add new tc ifindex field to tuple, which will
      only be used for offloading, not for lookup, as it will not be
      part of the tuple hash.
      
      Fixes: 9795ded7
      
       ("net/sched: act_ct: Fill offloading tuple iifidx")
      Signed-off-by: default avatarPaul Blakey <paulb@nvidia.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      db6140e5
  4. Mar 01, 2022
    • David S. Miller's avatar
      Merge tag 'wireless-for-net-2022-03-01' of... · b8d06ce7
      David S. Miller authored
      
      Merge tag 'wireless-for-net-2022-03-01' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless
      
      johannes Berg says:
      
      ====================
      
      Some last-minute fixes:
       * rfkill
         - add missing rfill_soft_blocked() when disabled
      
       * cfg80211
         - handle a nla_memdup() failure correctly
         - fix CONFIG_CFG80211_EXTRA_REGDB_KEYDIR typo in
           Makefile
      
       * mac80211
         - fix EAPOL handling in 802.3 RX path
         - reject setting up aggregation sessions before
           connection is authorized to avoid timeouts or
           similar
         - handle some SAE authentication steps correctly
         - fix AC selection in mesh forwarding
      
       * iwlwifi
         - remove TWT support as it causes firmware crashes
           when the AP isn't behaving correctly
         - check debugfs pointer before dereferncing it
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b8d06ce7
    • Johannes Berg's avatar
      cfg80211: fix CONFIG_CFG80211_EXTRA_REGDB_KEYDIR typo · a12f7634
      Johannes Berg authored
      The kbuild change here accidentally removed not only the
      unquoting, but also the last character of the variable
      name. Fix that.
      
      Fixes: 129ab0d2
      
       ("kbuild: do not quote string values in include/config/auto.conf")
      Reviewed-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Link: https://lore.kernel.org/r/20220221155512.1d25895f7c5f.I50fa3d4189fcab90a2896fe8cae215035dae9508@changeid
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      a12f7634
    • Florian Westphal's avatar
      netfilter: nf_queue: handle socket prefetch · 3b836da4
      Florian Westphal authored
      In case someone combines bpf socket assign and nf_queue, then we will
      queue an skb who references a struct sock that did not have its
      reference count incremented.
      
      As we leave rcu protection, there is no guarantee that skb->sk is still
      valid.
      
      For refcount-less skb->sk case, try to increment the reference count
      and then override the destructor.
      
      In case of failure we have two choices: orphan the skb and 'delete'
      preselect or let nf_queue() drop the packet.
      
      Do the latter, it should not happen during normal operation.
      
      Fixes: cf7fbe66
      
       ("bpf: Add socket assign support")
      Acked-by: default avatarJoe Stringer <joe@cilium.io>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      3b836da4
    • Florian Westphal's avatar
      netfilter: nf_queue: fix possible use-after-free · c3873070
      Florian Westphal authored
      Eric Dumazet says:
        The sock_hold() side seems suspect, because there is no guarantee
        that sk_refcnt is not already 0.
      
      On failure, we cannot queue the packet and need to indicate an
      error.  The packet will be dropped by the caller.
      
      v2: split skb prefetch hunk into separate change
      
      Fixes: 271b72c7
      
       ("udp: RCU handling for Unicast packets.")
      Reported-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      c3873070
    • Florian Westphal's avatar
      selftests: netfilter: add nfqueue TCP_NEW_SYN_RECV socket race test · 2e78855d
      Florian Westphal authored
      
      
      causes:
      BUG: KASAN: slab-out-of-bounds in sk_free+0x25/0x80
      Write of size 4 at addr ffff888106df0284 by task nf-queue/1459
       sk_free+0x25/0x80
       nf_queue_entry_release_refs+0x143/0x1a0
       nf_reinject+0x233/0x770
      
      ... without 'netfilter: nf_queue: don't assume sk is full socket'.
      
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      2e78855d
    • Florian Westphal's avatar
      netfilter: nf_queue: don't assume sk is full socket · 747670fd
      Florian Westphal authored
      There is no guarantee that state->sk refers to a full socket.
      
      If refcount transitions to 0, sock_put calls sk_free which then ends up
      with garbage fields.
      
      I'd like to thank Oleksandr Natalenko and Jiri Benc for considerable
      debug work and pointing out state->sk oddities.
      
      Fixes: ca6fb065
      
       ("tcp: attach SYNACK messages to request sockets instead of listener")
      Tested-by: default avatarOleksandr Natalenko <oleksandr@redhat.com>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      747670fd
    • Johannes Berg's avatar
      mac80211: treat some SAE auth steps as final · 94d9864c
      Johannes Berg authored
      When we get anti-clogging token required (added by the commit
      mentioned below), or the other status codes added by the later
      commit 4e56cde1 ("mac80211: Handle special status codes in
      SAE commit") we currently just pretend (towards the internal
      state machine of authentication) that we didn't receive anything.
      
      This has the undesirable consequence of retransmitting the prior
      frame, which is not expected, because the timer is still armed.
      
      If we just disarm the timer at that point, it would result in
      the undesirable side effect of being in this state indefinitely
      if userspace crashes, or so.
      
      So to fix this, reset the timer and set a new auth_data->waiting
      in order to have no more retransmissions, but to have the data
      destroyed when the timer actually fires, which will only happen
      if userspace didn't continue (i.e. crashed or abandoned it.)
      
      Fixes: a4055e74
      
       ("mac80211: Don't destroy auth data in case of anti-clogging")
      Reported-by: default avatarJouni Malinen <j@w1.fi>
      Link: https://lore.kernel.org/r/20220224103932.75964e1d7932.Ia487f91556f29daae734bf61f8181404642e1eec@changeid
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      94d9864c
    • 蒋家盛's avatar
      nl80211: Handle nla_memdup failures in handle_nan_filter · 6ad27f52
      蒋家盛 authored
      As there's potential for failure of the nla_memdup(),
      check the return value.
      
      Fixes: a442b761
      
       ("cfg80211: add add_nan_func / del_nan_func")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Link: https://lore.kernel.org/r/20220301100020.3801187-1-jiasheng@iscas.ac.cn
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      6ad27f52
    • Randy Dunlap's avatar
      iwlwifi: mvm: check debugfs_dir ptr before use · 5a6248c0
      Randy Dunlap authored
      When "debugfs=off" is used on the kernel command line, iwiwifi's
      mvm module uses an invalid/unchecked debugfs_dir pointer and causes
      a BUG:
      
       BUG: kernel NULL pointer dereference, address: 000000000000004f
       #PF: supervisor read access in kernel mode
       #PF: error_code(0x0000) - not-present page
       PGD 0 P4D 0
       Oops: 0000 [#1] PREEMPT SMP
       CPU: 1 PID: 503 Comm: modprobe Tainted: G        W         5.17.0-rc5 #7
       Hardware name: Dell Inc. Inspiron 15 5510/076F7Y, BIOS 2.4.1 11/05/2021
       RIP: 0010:iwl_mvm_dbgfs_register+0x692/0x700 [iwlmvm]
       Code: 69 a0 be 80 01 00 00 48 c7 c7 50 73 6a a0 e8 95 cf ee e0 48 8b 83 b0 1e 00 00 48 c7 c2 54 73 6a a0 be 64 00 00 00 48 8d 7d 8c <48> 8b 48 50 e8 15 22 07 e1 48 8b 43 28 48 8d 55 8c 48 c7 c7 5f 73
       RSP: 0018:ffffc90000a0ba68 EFLAGS: 00010246
       RAX: ffffffffffffffff RBX: ffff88817d6e3328 RCX: ffff88817d6e3328
       RDX: ffffffffa06a7354 RSI: 0000000000000064 RDI: ffffc90000a0ba6c
       RBP: ffffc90000a0bae0 R08: ffffffff824e4880 R09: ffffffffa069d620
       R10: ffffc90000a0ba00 R11: ffffffffffffffff R12: 0000000000000000
       R13: ffffc90000a0bb28 R14: ffff88817d6e3328 R15: ffff88817d6e3320
       FS:  00007f64dd92d740(0000) GS:ffff88847f640000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 000000000000004f CR3: 000000016fc79001 CR4: 0000000000770ee0
       PKRU: 55555554
       Call Trace:
        <TASK>
        ? iwl_mvm_mac_setup_register+0xbdc/0xda0 [iwlmvm]
        iwl_mvm_start_post_nvm+0x71/0x100 [iwlmvm]
        iwl_op_mode_mvm_start+0xab8/0xb30 [iwlmvm]
        _iwl_op_mode_start+0x6f/0xd0 [iwlwifi]
        iwl_opmode_register+0x6a/0xe0 [iwlwifi]
        ? 0xffffffffa0231000
        iwl_mvm_init+0x35/0x1000 [iwlmvm]
        ? 0xffffffffa0231000
        do_one_initcall+0x5a/0x1b0
        ? kmem_cache_alloc+0x1e5/0x2f0
        ? do_init_module+0x1e/0x220
        do_init_module+0x48/0x220
        load_module+0x2602/0x2bc0
        ? __kernel_read+0x145/0x2e0
        ? kernel_read_file+0x229/0x290
        __do_sys_finit_module+0xc5/0x130
        ? __do_sys_finit_module+0xc5/0x130
        __x64_sys_finit_module+0x13/0x20
        do_syscall_64+0x38/0x90
        entry_SYSCALL_64_after_hwframe+0x44/0xae
       RIP: 0033:0x7f64dda564dd
       Code: 5b 41 5c c3 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 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 8b 0d 1b 29 0f 00 f7 d8 64 89 01 48
       RSP: 002b:00007ffdba393f88 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
       RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f64dda564dd
       RDX: 0000000000000000 RSI: 00005575399e2ab2 RDI: 0000000000000001
       RBP: 000055753a91c5e0 R08: 0000000000000000 R09: 0000000000000002
       R10: 0000000000000001 R11: 0000000000000246 R12: 00005575399e2ab2
       R13: 000055753a91ceb0 R14: 0000000000000000 R15: 000055753a923018
        </TASK>
       Modules linked in: btintel(+) btmtk bluetooth vfat snd_hda_codec_hdmi fat snd_hda_codec_realtek snd_hda_codec_generic iwlmvm(+) snd_sof_pci_intel_tgl mac80211 snd_sof_intel_hda_common soundwire_intel soundwire_generic_allocation soundwire_cadence soundwire_bus snd_sof_intel_hda snd_sof_pci snd_sof snd_sof_xtensa_dsp snd_soc_hdac_hda snd_hda_ext_core snd_soc_acpi_intel_match snd_soc_acpi snd_soc_core btrfs snd_compress snd_hda_intel snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec raid6_pq iwlwifi snd_hda_core snd_pcm snd_timer snd soundcore cfg80211 intel_ish_ipc(+) thunderbolt rfkill intel_ishtp ucsi_acpi wmi i2c_hid_acpi i2c_hid evdev
       CR2: 000000000000004f
       ---[ end trace 0000000000000000 ]---
      
      Check the debugfs_dir pointer for an error before using it.
      
      Fixes: 8c082a99
      
       ("iwlwifi: mvm: simplify iwl_mvm_dbgfs_register")
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Luca Coelho <luciano.coelho@intel.com>
      Cc: linux-wireless@vger.kernel.org
      Cc: Kalle Valo <kvalo@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
      Cc: stable <stable@vger.kernel.org>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Link: https://lore.kernel.org/r/20220223030630.23241-1-rdunlap@infradead.org
      [change to make both conditional]
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      5a6248c0
    • Golan Ben Ami's avatar
      iwlwifi: don't advertise TWT support · 1db5fcbb
      Golan Ben Ami authored
      
      
      Some APs misbehave when TWT is used and cause our firmware to crash.
      We don't know a reasonable way to detect and work around this problem
      in the FW yet.  To prevent these crashes, disable TWT in the driver by
      stopping to advertise TWT support.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=215523
      Signed-off-by: default avatarGolan Ben Ami <golan.ben.ami@intel.com>
      [reworded the commit message]
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Link: https://lore.kernel.org/r/20220301072926.153969-1-luca@coelho.fi
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      1db5fcbb