Skip to content
  1. Jul 13, 2022
  2. Jul 12, 2022
  3. Jul 11, 2022
  4. Jul 09, 2022
    • Pablo Neira Ayuso's avatar
      netfilter: nf_tables: replace BUG_ON by element length check · c39ba4de
      Pablo Neira Ayuso authored
      BUG_ON can be triggered from userspace with an element with a large
      userdata area. Replace it by length check and return EINVAL instead.
      Over time extensions have been growing in size.
      
      Pick a sufficiently old Fixes: tag to propagate this fix.
      
      Fixes: 7d740264
      
       ("netfilter: nf_tables: variable sized set element keys / data")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      c39ba4de
    • Eric Dumazet's avatar
      vlan: fix memory leak in vlan_newlink() · 72a0b329
      Eric Dumazet authored
      Blamed commit added back a bug I fixed in commit 9bbd917e
      ("vlan: fix memory leak in vlan_dev_set_egress_priority")
      
      If a memory allocation fails in vlan_changelink() after other allocations
      succeeded, we need to call vlan_dev_free_egress_priority()
      to free all allocated memory because after a failed ->newlink()
      we do not call any methods like ndo_uninit() or dev->priv_destructor().
      
      In following example, if the allocation for last element 2000:2001 fails,
      we need to free eight prior allocations:
      
      ip link add link dummy0 dummy0.100 type vlan id 100 \
      	egress-qos-map 1:2 2:3 3:4 4:5 5:6 6:7 7:8 8:9 2000:2001
      
      syzbot report was:
      
      BUG: memory leak
      unreferenced object 0xffff888117bd1060 (size 32):
      comm "syz-executor408", pid 3759, jiffies 4294956555 (age 34.090s)
      hex dump (first 32 bytes):
      09 00 00 00 00 a0 00 00 00 00 00 00 00 00 00 00 ................
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
      backtrace:
      [<ffffffff83fc60ad>] kmalloc include/linux/slab.h:600 [inline]
      [<ffffffff83fc60ad>] vlan_dev_set_egress_priority+0xed/0x170 net/8021q/vlan_dev.c:193
      [<ffffffff83fc6628>] vlan_changelink+0x178/0x1d0 net/8021q/vlan_netlink.c:128
      [<ffffffff83fc67c8>] vlan_newlink+0x148/0x260 net/8021q/vlan_netlink.c:185
      [<ffffffff838b1278>] rtnl_newlink_create net/core/rtnetlink.c:3363 [inline]
      [<ffffffff838b1278>] __rtnl_newlink+0xa58/0xdc0 net/core/rtnetlink.c:3580
      [<ffffffff838b1629>] rtnl_newlink+0x49/0x70 net/core/rtnetlink.c:3593
      [<ffffffff838ac66c>] rtnetlink_rcv_msg+0x21c/0x5c0 net/core/rtnetlink.c:6089
      [<ffffffff839f9c37>] netlink_rcv_skb+0x87/0x1d0 net/netlink/af_netlink.c:2501
      [<ffffffff839f8da7>] netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
      [<ffffffff839f8da7>] netlink_unicast+0x397/0x4c0 net/netlink/af_netlink.c:1345
      [<ffffffff839f9266>] netlink_sendmsg+0x396/0x710 net/netlink/af_netlink.c:1921
      [<ffffffff8384dbf6>] sock_sendmsg_nosec net/socket.c:714 [inline]
      [<ffffffff8384dbf6>] sock_sendmsg+0x56/0x80 net/socket.c:734
      [<ffffffff8384e15c>] ____sys_sendmsg+0x36c/0x390 net/socket.c:2488
      [<ffffffff838523cb>] ___sys_sendmsg+0x8b/0xd0 net/socket.c:2542
      [<ffffffff838525b8>] __sys_sendmsg net/socket.c:2571 [inline]
      [<ffffffff838525b8>] __do_sys_sendmsg net/socket.c:2580 [inline]
      [<ffffffff838525b8>] __se_sys_sendmsg net/socket.c:2578 [inline]
      [<ffffffff838525b8>] __x64_sys_sendmsg+0x78/0xf0 net/socket.c:2578
      [<ffffffff845ad8d5>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
      [<ffffffff845ad8d5>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
      [<ffffffff8460006a>] entry_SYSCALL_64_after_hwframe+0x46/0xb0
      
      Fixes: 37aa50c5
      
       ("vlan: introduce vlan_dev_free_egress_priority")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Xin Long <lucien.xin@gmail.com>
      Reviewed-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      72a0b329
    • Baowen Zheng's avatar
      nfp: fix issue of skb segments exceeds descriptor limitation · 9c840d5f
      Baowen Zheng authored
      TCP packets will be dropped if the segments number in the tx skb
      exceeds limitation when sending iperf3 traffic with --zerocopy option.
      
      we make the following changes:
      
      Get nr_frags in nfp_nfdk_tx_maybe_close_block instead of passing from
      outside because it will be changed after skb_linearize operation.
      
      Fill maximum dma_len in first tx descriptor to make sure the whole
      head is included in the first descriptor.
      
      Fixes: c10d12e3
      
       ("nfp: add support for NFDK data path")
      Signed-off-by: default avatarBaowen Zheng <baowen.zheng@corigine.com>
      Reviewed-by: default avatarLouis Peens <louis.peens@corigine.com>
      Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9c840d5f
    • Pablo Neira Ayuso's avatar
      netfilter: nf_log: incorrect offset to network header · 7a847c00
      Pablo Neira Ayuso authored
      NFPROTO_ARP is expecting to find the ARP header at the network offset.
      
      In the particular case of ARP, HTYPE= field shows the initial bytes of
      the ethernet header destination MAC address.
      
       netdev out: IN= OUT=bridge0 MACSRC=c2:76:e5:71:e1:de MACDST=36:b0:4a:e2:72:ea MACPROTO=0806 ARP HTYPE=14000 PTYPE=0x4ae2 OPCODE=49782
      
      NFPROTO_NETDEV egress hook is also expecting to find the IP headers at
      the network offset.
      
      Fixes: 35b93951
      
       ("netfilter: add generic ARP packet logger")
      Reported-by: default avatarTom Yan <tom.ty89@gmail.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      7a847c00
    • Jakub Kicinski's avatar
      Merge branch 'selftests-forwarding-install-two-missing-tests' · 6676d727
      Jakub Kicinski authored
      
      
      Martin Blumenstingl says:
      
      ====================
      selftests: forwarding: Install two missing tests
      
      For some distributions (e.g. OpenWrt) we don't want to rely on rsync
      to copy the tests to the target as some extra dependencies need to be
      installed. The Makefile in tools/testing/selftests/net/forwarding
      already installs most of the tests.
      
      This series adds the two missing tests to the list of installed tests.
      That way a downstream distribution can build a package using this
      Makefile (and add dependencies there as needed).
      ====================
      
      Link: https://lore.kernel.org/r/20220707135532.1783925-1-martin.blumenstingl@googlemail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      6676d727
    • Martin Blumenstingl's avatar
      selftests: forwarding: Install no_forwarding.sh · cfbba7b4
      Martin Blumenstingl authored
      When using the Makefile from tools/testing/selftests/net/forwarding/
      all tests should be installed. Add no_forwarding.sh to the list of
      "to be installed tests" where it has been missing so far.
      
      Fixes: 476a4f05
      
       ("selftests: forwarding: add a no_forwarding.sh test")
      Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      cfbba7b4
    • Martin Blumenstingl's avatar
      selftests: forwarding: Install local_termination.sh · 437ac259
      Martin Blumenstingl authored
      When using the Makefile from tools/testing/selftests/net/forwarding/
      all tests should be installed. Add local_termination.sh to the list of
      "to be installed tests" where it has been missing so far.
      
      Fixes: 90b9566a
      
       ("selftests: forwarding: add a test for local_termination.sh")
      Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      437ac259
    • Jakub Kicinski's avatar
      Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf · 7c895ef8
      Jakub Kicinski authored
      
      
      Daniel Borkmann says:
      
      ====================
      bpf 2022-07-08
      
      We've added 3 non-merge commits during the last 2 day(s) which contain
      a total of 7 files changed, 40 insertions(+), 24 deletions(-).
      
      The main changes are:
      
      1) Fix cBPF splat triggered by skb not having a mac header, from Eric Dumazet.
      
      2) Fix spurious packet loss in generic XDP when pushing packets out (note
         that native XDP is not affected by the issue), from Johan Almbladh.
      
      3) Fix bpf_dynptr_{read,write}() helper signatures with flag argument before
         its set in stone as UAPI, from Joanne Koong.
      
      * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf:
        bpf: Add flags arg to bpf_dynptr_read and bpf_dynptr_write APIs
        bpf: Make sure mac_header was set before using it
        xdp: Fix spurious packet loss in generic XDP TX path
      ====================
      
      Link: https://lore.kernel.org/r/20220708213418.19626-1-daniel@iogearbox.net
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7c895ef8
  5. Jul 08, 2022