Skip to content
  1. Jun 03, 2022
    • Eric Dumazet's avatar
      net/af_packet: make sure to pull mac header · e9d3f809
      Eric Dumazet authored
      GSO assumes skb->head contains link layer headers.
      
      tun device in some case can provide base 14 bytes,
      regardless of VLAN being used or not.
      
      After blamed commit, we can end up setting a network
      header offset of 18+, we better pull the missing
      bytes to avoid a posible crash in GSO.
      
      syzbot report was:
      kernel BUG at include/linux/skbuff.h:2699!
      invalid opcode: 0000 [#1] PREEMPT SMP KASAN
      CPU: 1 PID: 3601 Comm: syz-executor210 Not tainted 5.18.0-syzkaller-11338-g2c5ca23f7414 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      RIP: 0010:__skb_pull include/linux/skbuff.h:2699 [inline]
      RIP: 0010:skb_mac_gso_segment+0x48f/0x530 net/core/gro.c:136
      Code: 00 48 c7 c7 00 96 d4 8a c6 05 cb d3 45 06 01 e8 26 bb d0 01 e9 2f fd ff ff 49 c7 c4 ea ff ff ff e9 f1 fe ff ff e8 91 84 19 fa <0f> 0b 48 89 df e8 97 44 66 fa e9 7f fd ff ff e8 ad 44 66 fa e9 48
      RSP: 0018:ffffc90002e2f4b8 EFLAGS: 00010293
      RAX: 0000000000000000 RBX: 0000000000000012 RCX: 0000000000000000
      RDX: ffff88805bb58000 RSI: ffffffff8760ed0f RDI: 0000000000000004
      RBP: 0000000000005dbc R08: 0000000000000004 R09: 0000000000000fe0
      R10: 0000000000000fe4 R11: 0000000000000000 R12: 0000000000000fe0
      R13: ffff88807194d780 R14: 1ffff920005c5e9b R15: 0000000000000012
      FS:  000055555730f300(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00000000200015c0 CR3: 0000000071ff8000 CR4: 0000000000350ee0
      Call Trace:
       <TASK>
       __skb_gso_segment+0x327/0x6e0 net/core/dev.c:3411
       skb_gso_segment include/linux/netdevice.h:4749 [inline]
       validate_xmit_skb+0x6bc/0xf10 net/core/dev.c:3669
       validate_xmit_skb_list+0xbc/0x120 net/core/dev.c:3719
       sch_direct_xmit+0x3d1/0xbe0 net/sched/sch_generic.c:327
       __dev_xmit_skb net/core/dev.c:3815 [inline]
       __dev_queue_xmit+0x14a1/0x3a00 net/core/dev.c:4219
       packet_snd net/packet/af_packet.c:3071 [inline]
       packet_sendmsg+0x21cb/0x5550 net/packet/af_packet.c:3102
       sock_sendmsg_nosec net/socket.c:714 [inline]
       sock_sendmsg+0xcf/0x120 net/socket.c:734
       ____sys_sendmsg+0x6eb/0x810 net/socket.c:2492
       ___sys_sendmsg+0xf3/0x170 net/socket.c:2546
       __sys_sendmsg net/socket.c:2575 [inline]
       __do_sys_sendmsg net/socket.c:2584 [inline]
       __se_sys_sendmsg net/socket.c:2582 [inline]
       __x64_sys_sendmsg+0x132/0x220 net/socket.c:2582
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x46/0xb0
      RIP: 0033:0x7f4b95da06c9
      Code: 28 c3 e8 4a 15 00 00 66 2e 0f 1f 84 00 00 00 00 00 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 c0 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007ffd7defc4c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 00007ffd7defc4f0 RCX: 00007f4b95da06c9
      RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000000000003
      RBP: 0000000000000003 R08: bb1414ac00000050 R09: bb1414ac00000050
      R10: 0000000000000004 R11: 0000000000000246 R12: 0000000000000000
      R13: 00007ffd7defc4e0 R14: 00007ffd7defc4d8 R15: 00007ffd7defc4d4
       </TASK>
      
      Fixes: dfed913e
      
       ("net/af_packet: add VLAN support for AF_PACKET SOCK_RAW GSO")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Acked-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Acked-by: default avatarWillem de Bruijn <willemb@google.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e9d3f809
    • Eric Dumazet's avatar
      net: add debug info to __skb_pull() · 22296a5c
      Eric Dumazet authored
      
      
      While analyzing yet another syzbot report, I found the following
      patch very useful. It allows to better understand what went wrong.
      
      This debug info is only enabled if CONFIG_DEBUG_NET=y,
      which is the case for syzbot builds.
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      22296a5c
    • Eric Dumazet's avatar
      net: CONFIG_DEBUG_NET depends on CONFIG_NET · eb0b39ef
      Eric Dumazet authored
      
      
      It makes little sense to debug networking stacks
      if networking is not compiled in.
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      eb0b39ef
    • Michael Sit Wei Hong's avatar
      stmmac: intel: Add RPL-P PCI ID · 83450bba
      Michael Sit Wei Hong authored
      
      
      Add PCI ID for Ethernet TSN Controller on RPL-P.
      
      Signed-off-by: default avatarMichael Sit Wei Hong <michael.wei.hong.sit@intel.com>
      Link: https://lore.kernel.org/r/20220602073507.3955721-1-michael.wei.hong.sit@intel.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      83450bba
    • Rasmus Villemoes's avatar
      net: stmmac: use dev_err_probe() for reporting mdio bus registration failure · 839612d2
      Rasmus Villemoes authored
      
      
      I have a board where these two lines are always printed during boot:
      
         imx-dwmac 30bf0000.ethernet: Cannot register the MDIO bus
         imx-dwmac 30bf0000.ethernet: stmmac_dvr_probe: MDIO bus (id: 1) registration failed
      
      It's perfectly fine, and the device is successfully (and silently, as
      far as the console goes) probed later.
      
      Use dev_err_probe() instead, which will demote these messages to debug
      level (thus removing the alarming messages from the console) when the
      error is -EPROBE_DEFER, and also has the advantage of including the
      error code if/when it happens to be something other than -EPROBE_DEFER.
      
      While here, add the missing \n to one of the format strings.
      
      Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
      Link: https://lore.kernel.org/r/20220602074840.1143360-1-linux@rasmusvillemoes.dk
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      839612d2
    • Hoang Le's avatar
      tipc: check attribute length for bearer name · 7f36f798
      Hoang Le authored
      
      
      syzbot reported uninit-value:
      =====================================================
      BUG: KMSAN: uninit-value in string_nocheck lib/vsprintf.c:644 [inline]
      BUG: KMSAN: uninit-value in string+0x4f9/0x6f0 lib/vsprintf.c:725
       string_nocheck lib/vsprintf.c:644 [inline]
       string+0x4f9/0x6f0 lib/vsprintf.c:725
       vsnprintf+0x2222/0x3650 lib/vsprintf.c:2806
       vprintk_store+0x537/0x2150 kernel/printk/printk.c:2158
       vprintk_emit+0x28b/0xab0 kernel/printk/printk.c:2256
       vprintk_default+0x86/0xa0 kernel/printk/printk.c:2283
       vprintk+0x15f/0x180 kernel/printk/printk_safe.c:50
       _printk+0x18d/0x1cf kernel/printk/printk.c:2293
       tipc_enable_bearer net/tipc/bearer.c:371 [inline]
       __tipc_nl_bearer_enable+0x2022/0x22a0 net/tipc/bearer.c:1033
       tipc_nl_bearer_enable+0x6c/0xb0 net/tipc/bearer.c:1042
       genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline]
      
      - Do sanity check the attribute length for TIPC_NLA_BEARER_NAME.
      - Do not use 'illegal name' in printing message.
      
      Reported-by: default avatar <syzbot+e820fdc8ce362f2dea51@syzkaller.appspotmail.com>
      Fixes: cb30a633
      
       ("tipc: refactor function tipc_enable_bearer()")
      Acked-by: default avatarJon Maloy <jmaloy@redhat.com>
      Signed-off-by: default avatarHoang Le <hoang.h.le@dektech.com.au>
      Link: https://lore.kernel.org/r/20220602063053.5892-1-hoang.h.le@dektech.com.au
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7f36f798
  2. Jun 02, 2022
    • Alexander Lobakin's avatar
      ice: fix access-beyond-end in the switch code · 6e1ff618
      Alexander Lobakin authored
      Global `-Warray-bounds` enablement revealed some problems, one of
      which is the way we define and use AQC rules messages.
      In fact, they have a shared header, followed by the actual message,
      which can be of one of several different formats. So it is
      straightforward enough to define that header as a separate struct
      and then embed it into message structures as needed, but currently
      all the formats reside in one union coupled with the header. Then,
      the code allocates only the memory needed for a particular message
      format, leaving the union potentially incomplete.
      There are no actual reads or writes beyond the end of an allocated
      chunk, but at the same time, the whole implementation is fragile and
      backed by an equilibrium rather than strong type and memory checks.
      
      Define the structures the other way around: one for the common
      header and the rest for the actual formats with the header embedded.
      There are no places where several union members would be used at the
      same time anyway. This allows to use proper struct_size() and let
      the compiler know what is going to be done.
      Finally, unsilence `-Warray-bounds` back for ice_switch.c.
      
      Other little things worth mentioning:
      * &ice_sw_rule_vsi_list_query is not used anywhere, remove it. It's
        weird anyway to talk to hardware with purely kernel types
        (bitmaps);
      * expand the ICE_SW_RULE_*_SIZE() macros to pass a structure
        variable name to struct_size() to let it do strict typechecking;
      * rename ice_sw_rule_lkup_rx_tx::hdr to ::hdr_data to keep ::hdr
        for the header structure to have the same name for it constistenly
        everywhere;
      * drop the duplicate of %ICE_SW_RULE_RX_TX_NO_HDR_SIZE residing in
        ice_switch.h.
      
      Fixes: 9daf8208 ("ice: Add support for switch filter programming")
      Fixes: 66486d89
      
       ("ice: replace single-element array used for C struct hack")
      Signed-off-by: default avatarAlexander Lobakin <alexandr.lobakin@intel.com>
      Reviewed-by: default avatarMarcin Szycik <marcin.szycik@linux.intel.com>
      Acked-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Link: https://lore.kernel.org/r/20220601105924.2841410-1-alexandr.lobakin@intel.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      6e1ff618
    • Fei Qin's avatar
      nfp: remove padding in nfp_nfdk_tx_desc · c6fbbf1e
      Fei Qin authored
      NFDK firmware supports 48-bit dma addressing and
      parses 16 high bits of dma addresses.
      
      In nfp_nfdk_tx_desc, dma related structure and tso
      related structure are union. When "mss" be filled
      with nonzero value due to enable tso, the memory used
      by "padding" may be also filled. Then, firmware may
      parse wrong dma addresses which causes TX watchdog
      timeout problem.
      
      This patch removes padding and unifies the dma_addr_hi
      bits with the one in firmware. nfp_nfdk_tx_desc_set_dma_addr
      is also added to match this change.
      
      Fixes: c10d12e3
      
       ("nfp: add support for NFDK data path")
      Signed-off-by: default avatarFei Qin <fei.qin@corigine.com>
      Signed-off-by: default avatarYinjun Zhang <yinjun.zhang@corigine.com>
      Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
      Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
      Link: https://lore.kernel.org/r/20220601083449.50556-1-simon.horman@corigine.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      c6fbbf1e
    • Duoming Zhou's avatar
      ax25: Fix ax25 session cleanup problems · 7d8a3a47
      Duoming Zhou authored
      There are session cleanup problems in ax25_release() and
      ax25_disconnect(). If we setup a session and then disconnect,
      the disconnected session is still in "LISTENING" state that
      is shown below.
      
      Active AX.25 sockets
      Dest       Source     Device  State        Vr/Vs    Send-Q  Recv-Q
      DL9SAU-4   DL9SAU-3   ???     LISTENING    000/000  0       0
      DL9SAU-3   DL9SAU-4   ???     LISTENING    000/000  0       0
      
      The first reason is caused by del_timer_sync() in ax25_release().
      The timers of ax25 are used for correct session cleanup. If we use
      ax25_release() to close ax25 sessions and ax25_dev is not null,
      the del_timer_sync() functions in ax25_release() will execute.
      As a result, the sessions could not be cleaned up correctly,
      because the timers have stopped.
      
      In order to solve this problem, this patch adds a device_up flag
      in ax25_dev in order to judge whether the device is up. If there
      are sessions to be cleaned up, the del_timer_sync() in
      ax25_release() will not execute. What's more, we add ax25_cb_del()
      in ax25_kill_by_device(), because the timers have been stopped
      and there are no functions that could delete ax25_cb if we do not
      call ax25_release(). Finally, we reorder the position of
      ax25_list_lock in ax25_cb_del() in order to synchronize among
      different functions that call ax25_cb_del().
      
      The second reason is caused by improper check in ax25_disconnect().
      The incoming ax25 sessions which ax25->sk is null will close
      heartbeat timer, because the check "if(!ax25->sk || ..)" is
      satisfied. As a result, the session could not be cleaned up properly.
      
      In order to solve this problem, this patch changes the improper
      check to "if(ax25->sk && ..)" in ax25_disconnect().
      
      What`s more, the ax25_disconnect() may be called twice, which is
      not necessary. For example, ax25_kill_by_device() calls
      ax25_disconnect() and sets ax25->state to AX25_STATE_0, but
      ax25_release() calls ax25_disconnect() again.
      
      In order to solve this problem, this patch add a check in
      ax25_release(). If the flag of ax25->sk equals to SOCK_DEAD,
      the ax25_disconnect() in ax25_release() should not be executed.
      
      Fixes: 82e31755 ("ax25: Fix UAF bugs in ax25 timers")
      Fixes: 8a367e74
      
       ("ax25: Fix segfault after sock connection timeout")
      Reported-and-tested-by: default avatarThomas Osterried <thomas@osterried.de>
      Signed-off-by: default avatarDuoming Zhou <duoming@zju.edu.cn>
      Link: https://lore.kernel.org/r/20220530152158.108619-1-duoming@zju.edu.cn
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      7d8a3a47
    • Slark Xiao's avatar
      net: usb: qmi_wwan: Add support for Cinterion MV31 with new baseline · 9f4fc18b
      Slark Xiao authored
      
      
      Adding support for Cinterion device MV31 with Qualcomm
      new baseline. Use different PIDs to separate it from
      previous base line products.
      All interfaces settings keep same as previous.
      
      T:  Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  7 Spd=480 MxCh= 0
      D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=1e2d ProdID=00b9 Rev=04.14
      S:  Manufacturer=Cinterion
      S:  Product=Cinterion PID 0x00B9 USB Mobile Broadband
      S:  SerialNumber=90418e79
      C:  #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:  If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
      I:  If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
      I:  If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      
      Signed-off-by: default avatarSlark Xiao <slark_xiao@163.com>
      Acked-by: default avatarBjørn Mork <bjorn@mork.no>
      Link: https://lore.kernel.org/r/20220601040531.6016-1-slark_xiao@163.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9f4fc18b
    • Jakub Kicinski's avatar
      Merge tag 'mlx5-fixes-2022-05-31' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux · c034ff2b
      Jakub Kicinski authored
      
      
      Saeed Mahameed says:
      
      ====================
      mlx5 fixes 2022-05-31
      
      This series provides bug fixes to mlx5 driver.
      Please pull and let me know if there is any problem.
      
      * tag 'mlx5-fixes-2022-05-31' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux:
        net/mlx5: Fix mlx5_get_next_dev() peer device matching
        net/mlx5e: Update netdev features after changing XDP state
        net/mlx5: correct ECE offset in query qp output
        net/mlx5e: Disable softirq in mlx5e_activate_rq to avoid race condition
        net/mlx5: CT: Fix header-rewrite re-use for tupels
        net/mlx5e: TC NIC mode, fix tc chains miss table
        net/mlx5: Don't use already freed action pointer
      ====================
      
      Link: https://lore.kernel.org/r/20220531205447.99236-1-saeed@kernel.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c034ff2b
    • Jakub Kicinski's avatar
      Merge branch 'sfc-siena-fix-some-efx_separate_tx_channels-errors' · 11049c9e
      Jakub Kicinski authored
      
      
      Íñigo Huguet says:
      
      ====================
      sfc/siena: fix some efx_separate_tx_channels errors
      
      Trying to load sfc driver with modparam efx_separate_tx_channels=1
      resulted in errors during initialization and not being able to use the
      NIC. This patches fix a few bugs and make it work again.
      
      This has been already done for sfc, do it also for sfc_siena.
      ====================
      
      Link: https://lore.kernel.org/r/20220601063603.15362-1-ihuguet@redhat.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      11049c9e
    • Íñigo Huguet's avatar
      sfc/siena: fix wrong tx channel offset with efx_separate_tx_channels · 25bde571
      Íñigo Huguet authored
      tx_channel_offset is calculated in efx_allocate_msix_channels, but it is
      also calculated again in efx_set_channels because it was originally done
      there, and when efx_allocate_msix_channels was introduced it was
      forgotten to be removed from efx_set_channels.
      
      Moreover, the old calculation is wrong when using
      efx_separate_tx_channels because now we can have XDP channels after the
      TX channels, so n_channels - n_tx_channels doesn't point to the first TX
      channel.
      
      Remove the old calculation from efx_set_channels, and add the
      initialization of this variable if MSI or legacy interrupts are used,
      next to the initialization of the rest of the related variables, where
      it was missing.
      
      This has been already done for sfc, do it also for sfc_siena.
      
      Fixes: 3990a8ff
      
       ("sfc: allocate channels for XDP tx queues")
      Reported-by: default avatarTianhao Zhao <tizhao@redhat.com>
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Acked-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      25bde571
    • Martin Habets's avatar
      sfc/siena: fix considering that all channels have TX queues · 183614bf
      Martin Habets authored
      Normally, all channels have RX and TX queues, but this is not true if
      modparam efx_separate_tx_channels=1 is used. In that cases, some
      channels only have RX queues and others only TX queues (or more
      preciselly, they have them allocated, but not initialized).
      
      Fix efx_channel_has_tx_queues to return the correct value for this case
      too.
      
      This has been already done for sfc, do it also for sfc_siena.
      
      Messages shown at probe time before the fix:
       sfc 0000:03:00.0 ens6f0np0: MC command 0x82 inlen 544 failed rc=-22 (raw=0) arg=0
       ------------[ cut here ]------------
       netdevice: ens6f0np0: failed to initialise TXQ -1
       WARNING: CPU: 1 PID: 626 at drivers/net/ethernet/sfc/ef10.c:2393 efx_ef10_tx_init+0x201/0x300 [sfc]
       [...] stripped
       RIP: 0010:efx_ef10_tx_init+0x201/0x300 [sfc]
       [...] stripped
       Call Trace:
        efx_init_tx_queue+0xaa/0xf0 [sfc]
        efx_start_channels+0x49/0x120 [sfc]
        efx_start_all+0x1f8/0x430 [sfc]
        efx_net_open+0x5a/0xe0 [sfc]
        __dev_open+0xd0/0x190
        __dev_change_flags+0x1b3/0x220
        dev_change_flags+0x21/0x60
       [...] stripped
      
      Messages shown at remove time before the fix:
       sfc 0000:03:00.0 ens6f0np0: failed to flush 10 queues
       sfc 0000:03:00.0 ens6f0np0: failed to flush queues
      
      Fixes: 8700aff0
      
       ("sfc: fix channel allocation with brute force")
      Reported-by: default avatarTianhao Zhao <tizhao@redhat.com>
      Signed-off-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Tested-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      183614bf
    • Jakub Kicinski's avatar
      Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec · 2440d206
      Jakub Kicinski authored
      
      
      Steffen Klassert says:
      
      ====================
      ipsec 2022-06-01
      
      1) Revert "net: af_key: add check for pfkey_broadcast in function pfkey_process"
         From Michal Kubecek.
      
      2) Don't set IPv4 DF bit when encapsulating IPv6 frames below 1280 bytes.
         From Maciej Żenczykowski.
      
      * 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec:
        xfrm: do not set IPv4 DF flag when encapsulating IPv6 frames <= 1280 bytes.
        Revert "net: af_key: add check for pfkey_broadcast in function pfkey_process"
      ====================
      
      Link: https://lore.kernel.org/r/20220601103349.2297361-1-steffen.klassert@secunet.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2440d206
    • Jakub Kicinski's avatar
      Merge tag 'wireless-2022-06-01' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless · 38a4762e
      Jakub Kicinski authored
      
      
      Kalle Valo says:
      
      ====================
      wireless fixes for v5.19
      
      First set of fixes for v5.19. Build fixes for iwlwifi and libertas, a
      scheduling while atomic fix for rtw88 and use-after-free fix for
      mac80211.
      
      * tag 'wireless-2022-06-01' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless:
        wifi: mac80211: fix use-after-free in chanctx code
        wifi: rtw88: add a work to correct atomic scheduling warning of ::set_tim
        wifi: iwlwifi: pcie: rename CAUSE macro
        wifi: libertas: use variable-size data in assoc req/resp cmd
      ====================
      
      Link: https://lore.kernel.org/r/20220601110741.90B28C385A5@smtp.kernel.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      38a4762e
    • Tobias Klauser's avatar
      socket: Don't use u8 type in uapi socket.h · 8d3398ba
      Tobias Klauser authored
      Use plain 255 instead, which also avoid introducing an additional header
      dependency on <linux/types.h>
      
      Fixes: 26859240
      
       ("txhash: Add socket option to control TX hash rethink behavior")
      Signed-off-by: default avatarTobias Klauser <tklauser@distanz.ch>
      Link: https://lore.kernel.org/r/20220531094345.13801-1-tklauser@distanz.ch
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8d3398ba
  3. Jun 01, 2022
    • Dan Carpenter's avatar
      net/sched: act_api: fix error code in tcf_ct_flow_table_fill_tuple_ipv6() · 86360030
      Dan Carpenter authored
      The tcf_ct_flow_table_fill_tuple_ipv6() function is supposed to return
      false on failure.  It should not return negatives because that means
      succes/true.
      
      Fixes: fcb6aa86
      
       ("act_ct: Support GRE offload")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarToshiaki Makita <toshiaki.makita1@gmail.com>
      Link: https://lore.kernel.org/r/YpYFnbDxFl6tQ3Bn@kili
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      86360030
    • Aya Levin's avatar
      net: ping6: Fix ping -6 with interface name · e6652a8e
      Aya Levin authored
      When passing interface parameter to ping -6:
      $ ping -6 ::11:141:84:9 -I eth2
      Results in:
      PING ::11:141:84:10(::11:141:84:10) from ::11:141:84:9 eth2: 56 data bytes
      ping: sendmsg: Invalid argument
      ping: sendmsg: Invalid argument
      
      Initialize the fl6's outgoing interface (OIF) before triggering
      ip6_datagram_send_ctl. Don't wipe fl6 after ip6_datagram_send_ctl() as
      changes in fl6 that may happen in the function are overwritten explicitly.
      Update comment accordingly.
      
      Fixes: 13651224
      
       ("net: ping6: support setting basic SOL_IPV6 options via cmsg")
      Signed-off-by: default avatarAya Levin <ayal@nvidia.com>
      Reviewed-by: default avatarGal Pressman <gal@nvidia.com>
      Reviewed-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20220531084544.15126-1-tariqt@nvidia.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      e6652a8e
    • Ziyang Xuan's avatar
      macsec: fix UAF bug for real_dev · 196a888c
      Ziyang Xuan authored
      Create a new macsec device but not get reference to real_dev. That can
      not ensure that real_dev is freed after macsec. That will trigger the
      UAF bug for real_dev as following:
      
      ==================================================================
      BUG: KASAN: use-after-free in macsec_get_iflink+0x5f/0x70 drivers/net/macsec.c:3662
      Call Trace:
       ...
       macsec_get_iflink+0x5f/0x70 drivers/net/macsec.c:3662
       dev_get_iflink+0x73/0xe0 net/core/dev.c:637
       default_operstate net/core/link_watch.c:42 [inline]
       rfc2863_policy+0x233/0x2d0 net/core/link_watch.c:54
       linkwatch_do_dev+0x2a/0x150 net/core/link_watch.c:161
      
      Allocated by task 22209:
       ...
       alloc_netdev_mqs+0x98/0x1100 net/core/dev.c:10549
       rtnl_create_link+0x9d7/0xc00 net/core/rtnetlink.c:3235
       veth_newlink+0x20e/0xa90 drivers/net/veth.c:1748
      
      Freed by task 8:
       ...
       kfree+0xd6/0x4d0 mm/slub.c:4552
       kvfree+0x42/0x50 mm/util.c:615
       device_release+0x9f/0x240 drivers/base/core.c:2229
       kobject_cleanup lib/kobject.c:673 [inline]
       kobject_release lib/kobject.c:704 [inline]
       kref_put include/linux/kref.h:65 [inline]
       kobject_put+0x1c8/0x540 lib/kobject.c:721
       netdev_run_todo+0x72e/0x10b0 net/core/dev.c:10327
      
      After commit faab39f6 ("net: allow out-of-order netdev unregistration")
      and commit e5f80fcf ("ipv6: give an IPv6 dev to blackhole_netdev"), we
      can add dev_hold_track() in macsec_dev_init() and dev_put_track() in
      macsec_free_netdev() to fix the problem.
      
      Fixes: 2bce1ebe
      
       ("macsec: fix refcnt leak in module exit routine")
      Reported-by: default avatar <syzbot+d0e94b65ac259c29ce7a@syzkaller.appspotmail.com>
      Signed-off-by: default avatarZiyang Xuan <william.xuanziyang@huawei.com>
      Link: https://lore.kernel.org/r/20220531074500.1272846-1-william.xuanziyang@huawei.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      196a888c
    • Dan Carpenter's avatar
      octeontx2-af: fix error code in is_valid_offset() · f3d671c7
      Dan Carpenter authored
      The is_valid_offset() function returns success/true if the call to
      validate_and_get_cpt_blkaddr() fails.
      
      Fixes: ecad2ce8
      
       ("octeontx2-af: cn10k: Add mailbox to configure reassembly timeout")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Link: https://lore.kernel.org/r/YpXDrTPb8qV01JSP@kili
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      f3d671c7
    • Johannes Berg's avatar
      wifi: mac80211: fix use-after-free in chanctx code · 2965c4cd
      Johannes Berg authored
      In ieee80211_vif_use_reserved_context(), when we have an
      old context and the new context's replace_state is set to
      IEEE80211_CHANCTX_REPLACE_NONE, we free the old context
      in ieee80211_vif_use_reserved_reassign(). Therefore, we
      cannot check the old_ctx anymore, so we should set it to
      NULL after this point.
      
      However, since the new_ctx replace state is clearly not
      IEEE80211_CHANCTX_REPLACES_OTHER, we're not going to do
      anything else in this function and can just return to
      avoid accessing the freed old_ctx.
      
      Cc: stable@vger.kernel.org
      Fixes: 5bcae31d
      
       ("mac80211: implement multi-vif in-place reservations")
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
      Link: https://lore.kernel.org/r/20220601091926.df419d91b165.I17a9b3894ff0b8323ce2afdb153b101124c821e5@changeid
      2965c4cd
    • Hangbin Liu's avatar
      bonding: guard ns_targets by CONFIG_IPV6 · c4caa500
      Hangbin Liu authored
      Guard ns_targets in struct bond_params by CONFIG_IPV6, which could save
      256 bytes if IPv6 not configed. Also add this protection for function
      bond_is_ip6_target_ok() and bond_get_targets_ip6().
      
      Remove the IS_ENABLED() check for bond_opts[] as this will make
      BOND_OPT_NS_TARGETS uninitialized if CONFIG_IPV6 not enabled. Add
      a dummy bond_option_ns_ip6_targets_set() for this situation.
      
      Fixes: 4e24be01
      
       ("bonding: add new parameter ns_targets")
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Acked-by: default avatarJonathan Toppins <jtoppins@redhat.com>
      Link: https://lore.kernel.org/r/20220531063727.224043-1-liuhangbin@gmail.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      c4caa500
    • Eric Dumazet's avatar
      tcp: tcp_rtx_synack() can be called from process context · 0a375c82
      Eric Dumazet authored
      Laurent reported the enclosed report [1]
      
      This bug triggers with following coditions:
      
      0) Kernel built with CONFIG_DEBUG_PREEMPT=y
      
      1) A new passive FastOpen TCP socket is created.
         This FO socket waits for an ACK coming from client to be a complete
         ESTABLISHED one.
      2) A socket operation on this socket goes through lock_sock()
         release_sock() dance.
      3) While the socket is owned by the user in step 2),
         a retransmit of the SYN is received and stored in socket backlog.
      4) At release_sock() time, the socket backlog is processed while
         in process context.
      5) A SYNACK packet is cooked in response of the SYN retransmit.
      6) -> tcp_rtx_synack() is called in process context.
      
      Before blamed commit, tcp_rtx_synack() was always called from BH handler,
      from a timer handler.
      
      Fix this by using TCP_INC_STATS() & NET_INC_STATS()
      which do not assume caller is in non preemptible context.
      
      [1]
      BUG: using __this_cpu_add() in preemptible [00000000] code: epollpep/2180
      caller is tcp_rtx_synack.part.0+0x36/0xc0
      CPU: 10 PID: 2180 Comm: epollpep Tainted: G           OE     5.16.0-0.bpo.4-amd64 #1  Debian 5.16.12-1~bpo11+1
      Hardware name: Supermicro SYS-5039MC-H8TRF/X11SCD-F, BIOS 1.7 11/23/2021
      Call Trace:
       <TASK>
       dump_stack_lvl+0x48/0x5e
       check_preemption_disabled+0xde/0xe0
       tcp_rtx_synack.part.0+0x36/0xc0
       tcp_rtx_synack+0x8d/0xa0
       ? kmem_cache_alloc+0x2e0/0x3e0
       ? apparmor_file_alloc_security+0x3b/0x1f0
       inet_rtx_syn_ack+0x16/0x30
       tcp_check_req+0x367/0x610
       tcp_rcv_state_process+0x91/0xf60
       ? get_nohz_timer_target+0x18/0x1a0
       ? lock_timer_base+0x61/0x80
       ? preempt_count_add+0x68/0xa0
       tcp_v4_do_rcv+0xbd/0x270
       __release_sock+0x6d/0xb0
       release_sock+0x2b/0x90
       sock_setsockopt+0x138/0x1140
       ? __sys_getsockname+0x7e/0xc0
       ? aa_sk_perm+0x3e/0x1a0
       __sys_setsockopt+0x198/0x1e0
       __x64_sys_setsockopt+0x21/0x30
       do_syscall_64+0x38/0xc0
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Fixes: 168a8f58
      
       ("tcp: TCP Fast Open Server - main code path")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarLaurent Fasnacht <laurent.fasnacht@proton.ch>
      Acked-by: default avatarNeal Cardwell <ncardwell@google.com>
      Link: https://lore.kernel.org/r/20220530213713.601888-1-eric.dumazet@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      0a375c82
    • Jakub Kicinski's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf · b3c0a9ef
      Jakub Kicinski authored
      
      
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter fixes for net
      
      1) Missing proper sanitization for nft_set_desc_concat_parse().
      
      2) Missing mutex in nf_tables pre_exit path.
      
      3) Possible double hook unregistration from clean_net path.
      
      4) Missing FLOWI_FLAG_ANYSRC flag in flowtable route lookup.
         Fix incorrect source and destination address in case of NAT.
         Patch from wenxu.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf:
        netfilter: flowtable: fix nft_flow_route source address for nat case
        netfilter: flowtable: fix missing FLOWI_FLAG_ANYSRC flag
        netfilter: nf_tables: double hook unregistration in netns path
        netfilter: nf_tables: hold mutex on netns pre_exit path
        netfilter: nf_tables: sanitize nft_set_desc_concat_parse()
      ====================
      
      Link: https://lore.kernel.org/r/20220531215839.84765-1-pablo@netfilter.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b3c0a9ef
    • Guoju Fang's avatar
      net: sched: add barrier to fix packet stuck problem for lockless qdisc · 2e8728c9
      Guoju Fang authored
      In qdisc_run_end(), the spin_unlock() only has store-release semantic,
      which guarantees all earlier memory access are visible before it. But
      the subsequent test_bit() has no barrier semantics so may be reordered
      ahead of the spin_unlock(). The store-load reordering may cause a packet
      stuck problem.
      
      The concurrent operations can be described as below,
               CPU 0                      |          CPU 1
         qdisc_run_end()                  |     qdisc_run_begin()
                .                         |           .
       ----> /* may be reorderd here */   |           .
      |         .                         |           .
      |     spin_unlock()                 |         set_bit()
      |         .                         |         smp_mb__after_atomic()
       ---- test_bit()                    |         spin_trylock()
                .                         |          .
      
      Consider the following sequence of events:
          CPU 0 reorder test_bit() ahead and see MISSED = 0
          CPU 1 calls set_bit()
          CPU 1 calls spin_trylock() and return fail
          CPU 0 executes spin_unlock()
      
      At the end of the sequence, CPU 0 calls spin_unlock() and does nothing
      because it see MISSED = 0. The skb on CPU 1 has beed enqueued but no one
      take it, until the next cpu pushing to the qdisc (if ever ...) will
      notice and dequeue it.
      
      This patch fix this by adding one explicit barrier. As spin_unlock() and
      test_bit() ordering is a store-load ordering, a full memory barrier
      smp_mb() is needed here.
      
      Fixes: a90c57f2
      
       ("net: sched: fix packet stuck problem for lockless qdisc")
      Signed-off-by: default avatarGuoju Fang <gjfang@linux.alibaba.com>
      Link: https://lore.kernel.org/r/20220528101628.120193-1-gjfang@linux.alibaba.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2e8728c9
    • wenxu's avatar
      netfilter: flowtable: fix nft_flow_route source address for nat case · 97629b23
      wenxu authored
      For snat and dnat cases, the saddr should be taken from reverse tuple.
      
      Fixes: 3412e164
      
       (netfilter: flowtable: nft_flow_route use more data for reverse route)
      Signed-off-by: default avatarwenxu <wenxu@chinatelecom.cn>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      97629b23
    • wenxu's avatar
      netfilter: flowtable: fix missing FLOWI_FLAG_ANYSRC flag · f1896d45
      wenxu authored
      The nf_flow_table gets route through ip_route_output_key. If the saddr
      is not local one, then FLOWI_FLAG_ANYSRC flag should be set. Without
      this flag, the route lookup for other_dst will fail.
      
      Fixes: 3412e164
      
       (netfilter: flowtable: nft_flow_route use more data for reverse route)
      Signed-off-by: default avatarwenxu <wenxu@chinatelecom.cn>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      f1896d45
    • Pablo Neira Ayuso's avatar
      netfilter: nf_tables: double hook unregistration in netns path · f9a43007
      Pablo Neira Ayuso authored
      __nft_release_hooks() is called from pre_netns exit path which
      unregisters the hooks, then the NETDEV_UNREGISTER event is triggered
      which unregisters the hooks again.
      
      [  565.221461] WARNING: CPU: 18 PID: 193 at net/netfilter/core.c:495 __nf_unregister_net_hook+0x247/0x270
      [...]
      [  565.246890] CPU: 18 PID: 193 Comm: kworker/u64:1 Tainted: G            E     5.18.0-rc7+ #27
      [  565.253682] Workqueue: netns cleanup_net
      [  565.257059] RIP: 0010:__nf_unregister_net_hook+0x247/0x270
      [...]
      [  565.297120] Call Trace:
      [  565.300900]  <TASK>
      [  565.304683]  nf_tables_flowtable_event+0x16a/0x220 [nf_tables]
      [  565.308518]  raw_notifier_call_chain+0x63/0x80
      [  565.312386]  unregister_netdevice_many+0x54f/0xb50
      
      Unregister and destroy netdev hook from netns pre_exit via kfree_rcu
      so the NETDEV_UNREGISTER path see unregistered hooks.
      
      Fixes: 767d1216
      
       ("netfilter: nftables: fix possible UAF over chains from packet path in netns")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      f9a43007
    • Pablo Neira Ayuso's avatar
      netfilter: nf_tables: hold mutex on netns pre_exit path · 3923b1e4
      Pablo Neira Ayuso authored
      clean_net() runs in workqueue while walking over the lists, grab mutex.
      
      Fixes: 767d1216
      
       ("netfilter: nftables: fix possible UAF over chains from packet path in netns")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      3923b1e4
    • Pablo Neira Ayuso's avatar
      netfilter: nf_tables: sanitize nft_set_desc_concat_parse() · fecf31ee
      Pablo Neira Ayuso authored
      Add several sanity checks for nft_set_desc_concat_parse():
      
      - validate desc->field_count not larger than desc->field_len array.
      - field length cannot be larger than desc->field_len (ie. U8_MAX)
      - total length of the concatenation cannot be larger than register array.
      
      Joint work with Florian Westphal.
      
      Fixes: f3a2181e
      
       ("netfilter: nf_tables: Support for sets with multiple ranged fields")
      Reported-by: default avatar <zhangziming.zzm@antgroup.com>
      Reviewed-by: default avatarStefano Brivio <sbrivio@redhat.com>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      fecf31ee
    • Saeed Mahameed's avatar
      net/mlx5: Fix mlx5_get_next_dev() peer device matching · 1c5de097
      Saeed Mahameed authored
      In some use-cases, mlx5 instances will need to search for their peer
      device (the other port on the same HCA). For that, mlx5 device matching
      mechanism relied on auxiliary_find_device() to search, and used a bad matching
      callback function.
      
      This approach has two issues:
      
      1) next_phys_dev() the matching function, assumed all devices are
         of the type mlx5_adev (mlx5 auxiliary device) which is wrong and
         could lead to crashes, this worked for a while, since only lately
         other drivers started registering auxiliary devices.
      
      2) using the auxiliary class bus (auxiliary_find_device) to search for
         mlx5_core_dev devices, who are actually PCIe device instances, is wrong.
         This works since mlx5_core always has at least one mlx5_adev instance
         hanging around in the aux bus.
      
      As suggested by others we can fix 1. by comparing device names prefixes
      if they have the string "mlx5_core" in them, which is not a best practice !
      but even with that fixed, still 2. needs fixing, we are trying to
      match pcie device peers so we should look in the right bus (pci bus),
      hence this fix.
      
      The fix:
      1) search the pci bus for mlx5 peer devices, instead of the aux bus
      2) to validated devices are the same type "mlx5_core_dev" compare if
         they have the same driver, which is bulletproof.
      
         This wouldn't have worked with the aux bus since the various mlx5 aux
         device types don't share the same driver, even if they share the same device
         wrapper struct (mlx5_adev) "which helped to find the parent device"
      
      Fixes: a925b5e3
      
       ("net/mlx5: Register mlx5 devices to auxiliary virtual bus")
      Reported-by: default avatarAlexander Lobakin <alexandr.lobakin@intel.com>
      Reported-by: default avatarMaher Sanalla <msanalla@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Reviewed-by: default avatarMark Bloch <mbloch@nvidia.com>
      Reviewed-by: default avatarMaher Sanalla <msanalla@nvidia.com>
      1c5de097
    • Maxim Mikityanskiy's avatar
      net/mlx5e: Update netdev features after changing XDP state · f6279f11
      Maxim Mikityanskiy authored
      Some features (LRO, HW GRO) conflict with XDP. If there is an attempt to
      enable such features while XDP is active, they will be set to `off
      [requested on]`. In order to activate these features after XDP is turned
      off, the driver needs to call netdev_update_features(). This commit adds
      this missing call after XDP state changes.
      
      Fixes: cf6e34c8 ("net/mlx5e: Properly block LRO when XDP is enabled")
      Fixes: b0617e7b
      
       ("net/mlx5e: Properly block HW GRO when XDP is enabled")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      f6279f11
    • Changcheng Liu's avatar
      net/mlx5: correct ECE offset in query qp output · 3fc2a9e8
      Changcheng Liu authored
      ECE field should be after opt_param_mask in query qp output.
      
      Fixes: 6b646a7e
      
       ("net/mlx5: Add ability to read and write ECE options")
      Signed-off-by: default avatarChangcheng Liu <jerrliu@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      3fc2a9e8
    • Maxim Mikityanskiy's avatar
      net/mlx5e: Disable softirq in mlx5e_activate_rq to avoid race condition · 2e642afb
      Maxim Mikityanskiy authored
      When the driver activates the channels, it assumes NAPI isn't running
      yet. mlx5e_activate_rq posts a NOP WQE to ICOSQ to trigger a hardware
      interrupt and start NAPI, which will run mlx5e_alloc_rx_mpwqe and post
      UMR WQEs to ICOSQ to be able to receive packets with striding RQ.
      
      Unfortunately, a race condition is possible if NAPI is triggered by
      something else (for example, TX) at a bad timing, before
      mlx5e_activate_rq finishes. In this case, mlx5e_alloc_rx_mpwqe may post
      UMR WQEs to ICOSQ, and with the bad timing, the wqe_info of the first
      UMR may be overwritten by the wqe_info of the NOP posted by
      mlx5e_activate_rq.
      
      The consequence is that icosq->db.wqe_info[0].num_wqebbs will be changed
      from MLX5E_UMR_WQEBBS to 1, disrupting the integrity of the array-based
      linked list in wqe_info[]. mlx5e_poll_ico_cq will hang in an infinite
      loop after processing wqe_info[0], because after the corruption, the
      next item to be processed will be wqe_info[1], which is filled with
      zeros, and `sqcc += wi->num_wqebbs` will never move further.
      
      This commit fixes this race condition by using async_icosq to post the
      NOP and trigger the interrupt. async_icosq is always protected with a
      spinlock, eliminating the race condition.
      
      Fixes: bc77b240
      
       ("net/mlx5e: Add fragmented memory support for RX multi packet WQE")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
      Reported-by: default avatarKarsten Nielsen <karsten@foo-bar.dk>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Reviewed-by: default avatarGal Pressman <gal@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      2e642afb
    • Paul Blakey's avatar
      net/mlx5: CT: Fix header-rewrite re-use for tupels · 1f2856cd
      Paul Blakey authored
      Tuple entries that don't have nat configured for them
      which are added to the ct nat table will always create
      a new modify header, as we don't check for possible
      re-use on them. The same for tuples that have nat configured
      for them but are added to ct table.
      
      Fix the above by only avoiding wasteful re-use lookup
      for actually natted entries in ct nat table.
      
      Fixes: 7fac5c2e
      
       ("net/mlx5: CT: Avoid reusing modify header context for natted entries")
      Signed-off-by: default avatarPaul Blakey <paulb@nvidia.com>
      Reviewed-by: default avatarAriel Levkovich <lariel@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      1f2856cd
    • Maor Dickman's avatar
      net/mlx5e: TC NIC mode, fix tc chains miss table · 66cb64e2
      Maor Dickman authored
      The cited commit changed promisc table to be created on demand with the
      highest priority in the NIC table replacing the vlan table, this caused
      tc NIC tables miss flow to skip the prmoisc table because it use vlan
      table as miss table.
      
      OVS offload in NIC mode use promisc by default so any unicast packet
      which will be handled by tc NIC tables miss flow will skip the promisc
      rule and will be dropped.
      
      Fix this by adding new empty table in new tc level with low priority and
      point the nic tc chain miss to it, the new table is managed so it will
      point to vlan table if promisc is disabled and to promisc table if enabled.
      
      Fixes: 1c46d740
      
       ("net/mlx5e: Optimize promiscuous mode")
      Signed-off-by: default avatarMaor Dickman <maord@nvidia.com>
      Reviewed-by: default avatarPaul Blakey <paulb@nvidia.com>
      Reviewed-by: default avatarAriel Levkovich <lariel@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      66cb64e2
    • Leon Romanovsky's avatar
      net/mlx5: Don't use already freed action pointer · 80b2bd73
      Leon Romanovsky authored
      The call to mlx5dr_action_destroy() releases "action" memory. That
      pointer is set to miss_action later and generates the following smatch
      error:
      
       drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c:53 set_miss_action()
       warn: 'action' was already freed.
      
      Make sure that the pointer is always valid by setting NULL after destroy.
      
      Fixes: 6a48faee
      
       ("net/mlx5: Add direct rule fs_cmd implementation")
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      80b2bd73
  4. May 31, 2022