1. 01 Jun, 2018 4 commits
    • Vlad Buslov's avatar
      net: sched: split tc_ctl_tfilter into three handlers · c431f89b
      Vlad Buslov authored
      tc_ctl_tfilter handles three netlink message types: RTM_NEWTFILTER,
      RTM_DELTFILTER, RTM_GETTFILTER. However, implementation of this function
      involves a lot of branching on specific message type because most of the
      code is message-specific. This significantly complicates adding new
      functionality and doesn't provide much benefit of code reuse.
      
      Split tc_ctl_tfilter to three standalone functions that handle filter new,
      delete and get requests.
      
      The only truly protocol independent part of tc_ctl_tfilter is code that
      looks up queue, class, and block. Refactor this code to standalone
      tcf_block_find function that is used by all three new handlers.
      Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c431f89b
    • Prashant Bhole's avatar
      rtnetlink: Fix null-ptr-deref in rtnl_newlink · af066ed3
      Prashant Bhole authored
      In rtnl_newlink(), NULL check is performed on m_ops however member of
      ops is accessed. Fixed by accessing member of m_ops instead of ops.
      
      [  345.432629] BUG: KASAN: null-ptr-deref in rtnl_newlink+0x400/0x1110
      [  345.432629] Read of size 4 at addr 0000000000000088 by task ip/986
      [  345.432629]
      [  345.432629] CPU: 1 PID: 986 Comm: ip Not tainted 4.17.0-rc6+ #9
      [  345.432629] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
      [  345.432629] Call Trace:
      [  345.432629]  dump_stack+0xc6/0x150
      [  345.432629]  ? dump_stack_print_info.cold.0+0x1b/0x1b
      [  345.432629]  ? kasan_report+0xb4/0x410
      [  345.432629]  kasan_report.cold.4+0x8f/0x91
      [  345.432629]  ? rtnl_newlink+0x400/0x1110
      [  345.432629]  rtnl_newlink+0x400/0x1110
      [...]
      
      Fixes: ccf8dbcd ("rtnetlink: Remove VLA usage")
      Signed-off-by: default avatarPrashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
      Tested-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      af066ed3
    • Wei Yongjun's avatar
      virtio_net: fix error return code in virtnet_probe() · 4b8e6ac4
      Wei Yongjun authored
      Fix to return a negative error code from the failover create fail error
      handling case instead of 0, as done elsewhere in this function.
      
      Fixes: ba5e4426 ("virtio_net: Extend virtio to use VF datapath when available")
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Acked-by: default avatarJason Wang <jasowang@redhat.com>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4b8e6ac4
    • Kees Cook's avatar
      rtnetlink: Remove VLA usage · ccf8dbcd
      Kees Cook authored
      In the quest to remove all stack VLA usage from the kernel[1], this
      allocates the maximum size expected for all possible types and adds
      sanity-checks at both registration and usage to make sure nothing gets
      out of sync. This matches the proposed VLA solution for nfnetlink[2]. The
      values chosen here were based on finding assignments for .maxtype and
      .slave_maxtype and manually counting the enums:
      
      slave_maxtype (max 33):
      	IFLA_BRPORT_MAX     33
      	IFLA_BOND_SLAVE_MAX  9
      
      maxtype (max 45):
      	IFLA_BOND_MAX       28
      	IFLA_BR_MAX         45
      	__IFLA_CAIF_HSI_MAX  8
      	IFLA_CAIF_MAX        4
      	IFLA_CAN_MAX        16
      	IFLA_GENEVE_MAX     12
      	IFLA_GRE_MAX        25
      	IFLA_GTP_MAX         5
      	IFLA_HSR_MAX         7
      	IFLA_IPOIB_MAX       4
      	IFLA_IPTUN_MAX      21
      	IFLA_IPVLAN_MAX      3
      	IFLA_MACSEC_MAX     15
      	IFLA_MACVLAN_MAX     7
      	IFLA_PPP_MAX         2
      	__IFLA_RMNET_MAX     4
      	IFLA_VLAN_MAX        6
      	IFLA_VRF_MAX         2
      	IFLA_VTI_MAX         7
      	IFLA_VXLAN_MAX      28
      	VETH_INFO_MAX        2
      	VXCAN_INFO_MAX       2
      
      This additionally changes maxtype and slave_maxtype fields to unsigned,
      since they're only ever using positive values.
      
      [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com
      [2] https://patchwork.kernel.org/patch/10439647/Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ccf8dbcd
  2. 31 May, 2018 20 commits
  3. 30 May, 2018 11 commits
  4. 29 May, 2018 5 commits