1. 19 Nov, 2021 4 commits
    • Zekun Shen's avatar
      atlantic: fix double-free in aq_ring_tx_clean · 6a405f6c
      Zekun Shen authored
      We found this bug while fuzzing the device driver. Using and freeing
      the dangling pointer buff->skb would cause use-after-free and
      double-free.
      
      This bug is triggerable with compromised/malfunctioning devices. We
      found the bug with QEMU emulation and tested the patch by emulation.
      We did NOT test on a real device.
      
      Attached is the bug report.
      
      BUG: KASAN: double-free or invalid-free in consume_skb+0x6c/0x1c0
      
      Call Trace:
       dump_stack+0x76/0xa0
       print_address_description.constprop.0+0x16/0x200
       ? consume_skb+0x6c/0x1c0
       kasan_report_invalid_free+0x61/0xa0
       ? consume_skb+0x6c/0x1c0
       __kasan_slab_free+0x15e/0x170
       ? consume_skb+0x6c/0x1c0
       kfree+0x8c/0x230
       consume_skb+0x6c/0x1c0
       aq_ring_tx_clean+0x5c2/0xa80 [atlantic]
       aq_vec_poll+0x309/0x5d0 [atlantic]
       ? _sub_I_65535_1+0x20/0x20 [atlantic]
       ? __next_timer_interrupt+0xba/0xf0
       net_rx_action+0x363/0xbd0
       ? call_timer_fn+0x240/0x240
       ? __switch_to_asm+0x34/0x70
       ? napi_busy_loop+0x520/0x520
       ? net_tx_action+0x379/0x720
       __do_softirq+0x18c/0x634
       ? takeover_tasklets+0x5f0/0x5f0
       run_ksoftirqd+0x15/0x20
       smpboot_thread_fn+0x2f1/0x6b0
       ? smpboot_unregister_percpu_thread+0x160/0x160
       ? __kthread_parkme+0x80/0x100
       ? smpboot_unregister_percpu_thread+0x160/0x160
       kthread+0x2b5/0x3b0
       ? kthread_create_on_node+0xd0/0xd0
       ret_from_fork+0x22/0x40
      Reported-by: default avatarBrendan Dolan-Gavitt <brendandg@nyu.edu>
      Signed-off-by: default avatarZekun Shen <bruceshenzk@gmail.com>
      Reviewed-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6a405f6c
    • Volodymyr Mytnyk's avatar
      net: marvell: prestera: fix double free issue on err path · e8d03250
      Volodymyr Mytnyk authored
      fix error path handling in prestera_bridge_port_join() that
      cases prestera driver to crash (see below).
      
       Trace:
         Internal error: Oops: 96000044 [#1] SMP
         Modules linked in: prestera_pci prestera uio_pdrv_genirq
         CPU: 1 PID: 881 Comm: ip Not tainted 5.15.0 #1
         pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
         pc : prestera_bridge_destroy+0x2c/0xb0 [prestera]
         lr : prestera_bridge_port_join+0x2cc/0x350 [prestera]
         sp : ffff800011a1b0f0
         ...
         x2 : ffff000109ca6c80 x1 : dead000000000100 x0 : dead000000000122
          Call trace:
         prestera_bridge_destroy+0x2c/0xb0 [prestera]
         prestera_bridge_port_join+0x2cc/0x350 [prestera]
         prestera_netdev_port_event.constprop.0+0x3c4/0x450 [prestera]
         prestera_netdev_event_handler+0xf4/0x110 [prestera]
         raw_notifier_call_chain+0x54/0x80
         call_netdevice_notifiers_info+0x54/0xa0
         __netdev_upper_dev_link+0x19c/0x380
      
      Fixes: e1189d9a ("net: marvell: prestera: Add Switchdev driver implementation")
      Signed-off-by: default avatarVolodymyr Mytnyk <vmytnyk@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e8d03250
    • Volodymyr Mytnyk's avatar
      net: marvell: prestera: fix brige port operation · 253e9b4d
      Volodymyr Mytnyk authored
      Return NOTIFY_DONE (dont't care) for switchdev notifications
      that prestera driver don't know how to handle them.
      
      With introduction of SWITCHDEV_BRPORT_[UN]OFFLOADED switchdev
      events, the driver rejects adding swport to bridge operation
      which is handled by prestera_bridge_port_join() func. The root
      cause of this is that prestera driver returns error (EOPNOTSUPP)
      in prestera_switchdev_blk_event() handler for unknown swdev
      events. This causes switchdev_bridge_port_offload() to fail
      when adding port to bridge in prestera_bridge_port_join().
      
      Fixes: 957e2235 ("net: make switchdev_bridge_port_{,unoffload} loosely coupled with the bridge")
      Signed-off-by: default avatarVolodymyr Mytnyk <vmytnyk@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      253e9b4d
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf · d6821c5b
      David S. Miller authored
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter fixes for net
      
      The following patchset contains Netfilter/IPVS fixes for net:
      
      1) Add selftest for vrf+conntrack, from Florian Westphal.
      
      2) Extend nfqueue selftest to cover nfqueue, also from Florian.
      
      3) Remove duplicated include in nft_payload, from Wan Jiabing.
      
      4) Several improvements to the nat port shadowing selftest,
         from Phil Sutter.
      
      5) Fix filtering of reply tuple in ctnetlink, from Florent Fourcot.
      
      6) Do not override error with -EINVAL in filter setup path, also
         from Florent.
      
      7) Honor sysctl_expire_nodest_conn regardless conn_reuse_mode for
         reused connections, from yangxingwu.
      
      8) Replace snprintf() by sysfs_emit() in xt_IDLETIMER as reported
         by Coccinelle, from Jing Yao.
      
      9) Incorrect IPv6 tunnel match in flowtable offload, from Will
         Mortensen.
      
      10) Switch port shadow selftest to use socat, from Florian Westphal.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d6821c5b
  2. 18 Nov, 2021 36 commits