10 May, 2019

1 commit

  • With NET_ADMIN enabled in container, a normal user could be mapped to
    root and is able to change the real device's rx filter via ioctl on
    vlan, which would affect the other ptp process on host. Fix it by
    disabling SIOCSHWTSTAMP in container.

    Fixes: a6111d3c93d0 ("vlan: Pass SIOC[SG]HWTSTAMP ioctls to real device")
    Signed-off-by: Hangbin Liu
    Acked-by: Richard Cochran
    Signed-off-by: David S. Miller

    Hangbin Liu
     

28 Apr, 2019

2 commits

  • We currently have two levels of strict validation:

    1) liberal (default)
    - undefined (type >= max) & NLA_UNSPEC attributes accepted
    - attribute length >= expected accepted
    - garbage at end of message accepted
    2) strict (opt-in)
    - NLA_UNSPEC attributes accepted
    - attribute length >= expected accepted

    Split out parsing strictness into four different options:
    * TRAILING - check that there's no trailing data after parsing
    attributes (in message or nested)
    * MAXTYPE - reject attrs > max known type
    * UNSPEC - reject attributes with NLA_UNSPEC policy entries
    * STRICT_ATTRS - strictly validate attribute size

    The default for future things should be *everything*.
    The current *_strict() is a combination of TRAILING and MAXTYPE,
    and is renamed to _deprecated_strict().
    The current regular parsing has none of this, and is renamed to
    *_parse_deprecated().

    Additionally it allows us to selectively set one of the new flags
    even on old policies. Notably, the UNSPEC flag could be useful in
    this case, since it can be arranged (by filling in the policy) to
    not be an incompatible userspace ABI change, but would then going
    forward prevent forgetting attribute entries. Similar can apply
    to the POLICY flag.

    We end up with the following renames:
    * nla_parse -> nla_parse_deprecated
    * nla_parse_strict -> nla_parse_deprecated_strict
    * nlmsg_parse -> nlmsg_parse_deprecated
    * nlmsg_parse_strict -> nlmsg_parse_deprecated_strict
    * nla_parse_nested -> nla_parse_nested_deprecated
    * nla_validate_nested -> nla_validate_nested_deprecated

    Using spatch, of course:
    @@
    expression TB, MAX, HEAD, LEN, POL, EXT;
    @@
    -nla_parse(TB, MAX, HEAD, LEN, POL, EXT)
    +nla_parse_deprecated(TB, MAX, HEAD, LEN, POL, EXT)

    @@
    expression NLH, HDRLEN, TB, MAX, POL, EXT;
    @@
    -nlmsg_parse(NLH, HDRLEN, TB, MAX, POL, EXT)
    +nlmsg_parse_deprecated(NLH, HDRLEN, TB, MAX, POL, EXT)

    @@
    expression NLH, HDRLEN, TB, MAX, POL, EXT;
    @@
    -nlmsg_parse_strict(NLH, HDRLEN, TB, MAX, POL, EXT)
    +nlmsg_parse_deprecated_strict(NLH, HDRLEN, TB, MAX, POL, EXT)

    @@
    expression TB, MAX, NLA, POL, EXT;
    @@
    -nla_parse_nested(TB, MAX, NLA, POL, EXT)
    +nla_parse_nested_deprecated(TB, MAX, NLA, POL, EXT)

    @@
    expression START, MAX, POL, EXT;
    @@
    -nla_validate_nested(START, MAX, POL, EXT)
    +nla_validate_nested_deprecated(START, MAX, POL, EXT)

    @@
    expression NLH, HDRLEN, MAX, POL, EXT;
    @@
    -nlmsg_validate(NLH, HDRLEN, MAX, POL, EXT)
    +nlmsg_validate_deprecated(NLH, HDRLEN, MAX, POL, EXT)

    For this patch, don't actually add the strict, non-renamed versions
    yet so that it breaks compile if I get it wrong.

    Also, while at it, make nla_validate and nla_parse go down to a
    common __nla_validate_parse() function to avoid code duplication.

    Ultimately, this allows us to have very strict validation for every
    new caller of nla_parse()/nlmsg_parse() etc as re-introduced in the
    next patch, while existing things will continue to work as is.

    In effect then, this adds fully strict validation for any new command.

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     
  • Even if the NLA_F_NESTED flag was introduced more than 11 years ago, most
    netlink based interfaces (including recently added ones) are still not
    setting it in kernel generated messages. Without the flag, message parsers
    not aware of attribute semantics (e.g. wireshark dissector or libmnl's
    mnl_nlmsg_fprintf()) cannot recognize nested attributes and won't display
    the structure of their contents.

    Unfortunately we cannot just add the flag everywhere as there may be
    userspace applications which check nlattr::nla_type directly rather than
    through a helper masking out the flags. Therefore the patch renames
    nla_nest_start() to nla_nest_start_noflag() and introduces nla_nest_start()
    as a wrapper adding NLA_F_NESTED. The calls which add NLA_F_NESTED manually
    are rewritten to use nla_nest_start().

    Except for changes in include/net/netlink.h, the patch was generated using
    this semantic patch:

    @@ expression E1, E2; @@
    -nla_nest_start(E1, E2)
    +nla_nest_start_noflag(E1, E2)

    @@ expression E1, E2; @@
    -nla_nest_start_noflag(E1, E2 | NLA_F_NESTED)
    +nla_nest_start(E1, E2)

    Signed-off-by: Michal Kubecek
    Acked-by: Jiri Pirko
    Acked-by: David Ahern
    Signed-off-by: David S. Miller

    Michal Kubecek
     

20 Apr, 2019

2 commits

  • In vlan bridge binding mode, the link state is no longer transferred
    from the lower device. Instead it is set by the bridge module according
    to the state of bridge ports that are members of the vlan.

    Signed-off-by: Mike Manning
    Acked-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Mike Manning
     
  • In the case of vlan filtering on bridges, the bridge may also have the
    corresponding vlan devices as upper devices. Currently the link state
    of vlan devices is transferred from the lower device. So this is up if
    the bridge is in admin up state and there is at least one bridge port
    that is up, regardless of the vlan that the port is a member of.

    The link state of the vlan device may need to track only the state of
    the subset of ports that are also members of the corresponding vlan,
    rather than that of all ports.

    Add a flag to specify a vlan bridge binding mode, by which the link
    state is no longer automatically transferred from the lower device,
    but is instead determined by the bridge ports that are members of the
    vlan.

    Signed-off-by: Mike Manning
    Acked-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Mike Manning
     

05 Apr, 2019

1 commit

  • Way back in 3c9c36bcedd426f2be2826da43e5163de61735f7 the
    ndo_fcoe_get_wwn pointer was switched from depending on CONFIG_FCOE to
    CONFIG_LIBFCOE in order to allow building FCoE support into the bnx2x
    driver and used by bnx2fc without including the generic software fcoe
    module.

    But, FCoE is generally used over an 802.1q VLAN, and the implementation
    of ndo_fcoe_get_wwn in the 8021q module was not similarly changed. The
    result is that if CONFIG_FCOE is disabled, then bnz2fc cannot make a
    call to ndo_fcoe_get_wwn through the 8021q interface to the underlying
    bnx2x interface. The bnx2fc driver then falls back to a potentially
    different mapping of Ethernet MAC to Fibre Channel WWN, creating an
    incompatibility with the fabric and target configurations when compared
    to the WWNs used by pre-boot firmware and differently-configured
    kernels.

    So make the conditional inclusion of FCoE code in 8021q match the
    conditional inclusion in netdevice.h

    Signed-off-by: Chris Leech
    Signed-off-by: David S. Miller

    Chris Leech
     

25 Feb, 2019

1 commit


07 Dec, 2018

1 commit

  • In order to pass extack together with NETDEV_PRE_UP notifications, it's
    necessary to route the extack to __dev_open() from diverse (possibly
    indirect) callers. One prominent API through which the notification is
    invoked is dev_change_flags().

    Therefore extend dev_change_flags() with and extra extack argument and
    update all users. Most of the calls end up just encoding NULL, but
    several sites (VLAN, ipvlan, VRF, rtnetlink) do have extack available.

    Since the function declaration line is changed anyway, name the other
    function arguments to placate checkpatch.

    Signed-off-by: Petr Machata
    Acked-by: Jiri Pirko
    Reviewed-by: Ido Schimmel
    Reviewed-by: David Ahern
    Signed-off-by: David S. Miller

    Petr Machata
     

17 Nov, 2018

1 commit

  • Currently, the vlan packet offloads are registered only upon 8021q module
    load. However, even without this module loaded, the offloads could be
    utilized, for example by openvswitch datapath. As reported by Michael,
    that causes 2x to 5x performance improvement, depending on a testcase.

    So move the vlan offload registrations into vlan_core and make this
    available even without 8021q module loaded.

    Reported-by: Michael Shteinbok
    Signed-off-by: Jiri Pirko
    Tested-by: Michael Shteinbok
    Reviewed-by: David Ahern
    Signed-off-by: David S. Miller

    Jiri Pirko
     

09 Nov, 2018

2 commits

  • Signed-off-by: Michał Mirosław
    Signed-off-by: David S. Miller

    Michał Mirosław
     
  • It's redundancy for the drivers to hold the list of vlans when
    absolutely the same list exists in vlan core. In most cases it's
    needed only to traverse the vlan devices, their vids and sync some
    settings with h/w, so add API to simplify this.

    At least some of these drivers also can benefit:
    grep "for_each.*vid" -r drivers/net/ethernet/

    drivers/net/ethernet/hisilicon/hns3/hns3_enet.c:
    drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c:
    drivers/net/ethernet/qlogic/qlge/qlge_main.c:
    drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c:
    drivers/net/ethernet/via/via-rhine.c:
    drivers/net/ethernet/via/via-velocity.c:
    drivers/net/ethernet/intel/igb/igb_main.c:
    drivers/net/ethernet/intel/ice/ice_main.c:
    drivers/net/ethernet/intel/e1000/e1000_main.c:
    drivers/net/ethernet/intel/i40e/i40e_main.c:
    drivers/net/ethernet/intel/e1000e/netdev.c:
    drivers/net/ethernet/intel/igbvf/netdev.c:
    drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c:
    drivers/net/ethernet/intel/ixgb/ixgb_main.c:
    drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:
    drivers/net/ethernet/amd/xgbe/xgbe-dev.c:
    drivers/net/ethernet/emulex/benet/be_main.c:
    drivers/net/ethernet/neterion/vxge/vxge-main.c:
    drivers/net/ethernet/adaptec/starfire.c:
    drivers/net/ethernet/brocade/bna/bnad.c:

    Reviewed-by: Grygorii Strashko
    Signed-off-by: Ivan Khoronzhuk
    Signed-off-by: David S. Miller

    Ivan Khoronzhuk
     

08 Nov, 2018

1 commit

  • GSO tunneled packets are always segmented in software before they are
    transmitted by a VLAN, even when the lower device can offload tunnel
    encapsulation and VLAN together (i.e., some bits in NETIF_F_GSO_ENCAP_ALL
    mask are set in the lower device 'vlan_features'). If we let VLANs have
    the same tunnel offload capabilities as their lower device, throughput
    can improve significantly when CPU is limited on the transmitter side.

    - set NETIF_F_GSO_ENCAP_ALL bits in the VLAN 'hw_features', to ensure
    that 'features' will have those bits zeroed only when the lower device
    has no hardware support for tunnel encapsulation.
    - for the same reason, copy GSO-related bits of 'hw_enc_features' from
    lower device to VLAN, and ensure to update that value when the lower
    device changes its features.
    - set NETIF_F_HW_CSUM bit in the VLAN 'hw_enc_features' if 'real_dev'
    is able to compute checksums at least for a kind of packets, like done
    with commit 8403debeead8 ("vlan: Keep NETIF_F_HW_CSUM similar to other
    software devices"). This avoids software segmentation due to mismatching
    checksum capabilities between VLAN's 'features' and 'hw_enc_features'.

    Reported-by: Flavio Leitner
    Signed-off-by: Davide Caratti
    Signed-off-by: David S. Miller

    Davide Caratti
     

20 Oct, 2018

1 commit

  • This fixes a problem introduced by:
    commit 2cde6acd49da ("netpoll: Fix __netpoll_rcu_free so that it can hold the rtnl lock")

    When using netconsole on a bond, __netpoll_cleanup can asynchronously
    recurse multiple times, each __netpoll_free_async call can result in
    more __netpoll_free_async's. This means there is now a race between
    cleanup_work queues on multiple netpoll_info's on multiple devices and
    the configuration of a new netpoll. For example if a netconsole is set
    to enable 0, reconfigured, and enable 1 immediately, this netconsole
    will likely not work.

    Given the reason for __netpoll_free_async is it can be called when rtnl
    is not locked, if it is locked, we should be able to execute
    synchronously. It appears to be locked everywhere it's called from.

    Generalize the design pattern from the teaming driver for current
    callers of __netpoll_free_async.

    CC: Neil Horman
    CC: "David S. Miller"
    Signed-off-by: Debabrata Banerjee
    Signed-off-by: David S. Miller

    Debabrata Banerjee
     

25 Jul, 2018

1 commit


03 Jul, 2018

1 commit


02 Jul, 2018

1 commit

  • Since the addition of GRO for ESP, gro_receive can consume the skb and
    return -EINPROGRESS. In that case, the lower layer GRO handler cannot
    touch the skb anymore.

    Commit 5f114163f2f5 ("net: Add a skb_gro_flush_final helper.") converted
    some of the gro_receive handlers that can lead to ESP's gro_receive so
    that they wouldn't access the skb when -EINPROGRESS is returned, but
    missed other spots, mainly in tunneling protocols.

    This patch finishes the conversion to using skb_gro_flush_final(), and
    adds a new helper, skb_gro_flush_final_remcsum(), used in VXLAN and
    GUE.

    Fixes: 5f114163f2f5 ("net: Add a skb_gro_flush_final helper.")
    Signed-off-by: Sabrina Dubroca
    Reviewed-by: Stefano Brivio
    Signed-off-by: David S. Miller

    Sabrina Dubroca
     

26 Jun, 2018

1 commit

  • Manage pending per-NAPI GRO packets via list_head.

    Return an SKB pointer from the GRO receive handlers. When GRO receive
    handlers return non-NULL, it means that this SKB needs to be completed
    at this time and removed from the NAPI queue.

    Several operations are greatly simplified by this transformation,
    especially timing out the oldest SKB in the list when gro_count
    exceeds MAX_GRO_SKBS, and napi_gro_flush() which walks the queue
    in reverse order.

    Signed-off-by: David S. Miller

    David Miller
     

07 Jun, 2018

1 commit

  • Pull networking updates from David Miller:

    1) Add Maglev hashing scheduler to IPVS, from Inju Song.

    2) Lots of new TC subsystem tests from Roman Mashak.

    3) Add TCP zero copy receive and fix delayed acks and autotuning with
    SO_RCVLOWAT, from Eric Dumazet.

    4) Add XDP_REDIRECT support to mlx5 driver, from Jesper Dangaard
    Brouer.

    5) Add ttl inherit support to vxlan, from Hangbin Liu.

    6) Properly separate ipv6 routes into their logically independant
    components. fib6_info for the routing table, and fib6_nh for sets of
    nexthops, which thus can be shared. From David Ahern.

    7) Add bpf_xdp_adjust_tail helper, which can be used to generate ICMP
    messages from XDP programs. From Nikita V. Shirokov.

    8) Lots of long overdue cleanups to the r8169 driver, from Heiner
    Kallweit.

    9) Add BTF ("BPF Type Format"), from Martin KaFai Lau.

    10) Add traffic condition monitoring to iwlwifi, from Luca Coelho.

    11) Plumb extack down into fib_rules, from Roopa Prabhu.

    12) Add Flower classifier offload support to igb, from Vinicius Costa
    Gomes.

    13) Add UDP GSO support, from Willem de Bruijn.

    14) Add documentation for eBPF helpers, from Quentin Monnet.

    15) Add TLS tx offload to mlx5, from Ilya Lesokhin.

    16) Allow applications to be given the number of bytes available to read
    on a socket via a control message returned from recvmsg(), from
    Soheil Hassas Yeganeh.

    17) Add x86_32 eBPF JIT compiler, from Wang YanQing.

    18) Add AF_XDP sockets, with zerocopy support infrastructure as well.
    From Björn Töpel.

    19) Remove indirect load support from all of the BPF JITs and handle
    these operations in the verifier by translating them into native BPF
    instead. From Daniel Borkmann.

    20) Add GRO support to ipv6 gre tunnels, from Eran Ben Elisha.

    21) Allow XDP programs to do lookups in the main kernel routing tables
    for forwarding. From David Ahern.

    22) Allow drivers to store hardware state into an ELF section of kernel
    dump vmcore files, and use it in cxgb4. From Rahul Lakkireddy.

    23) Various RACK and loss detection improvements in TCP, from Yuchung
    Cheng.

    24) Add TCP SACK compression, from Eric Dumazet.

    25) Add User Mode Helper support and basic bpfilter infrastructure, from
    Alexei Starovoitov.

    26) Support ports and protocol values in RTM_GETROUTE, from Roopa
    Prabhu.

    27) Support bulking in ->ndo_xdp_xmit() API, from Jesper Dangaard
    Brouer.

    28) Add lots of forwarding selftests, from Petr Machata.

    29) Add generic network device failover driver, from Sridhar Samudrala.

    * ra.kernel.org:/pub/scm/linux/kernel/git/davem/net-next: (1959 commits)
    strparser: Add __strp_unpause and use it in ktls.
    rxrpc: Fix terminal retransmission connection ID to include the channel
    net: hns3: Optimize PF CMDQ interrupt switching process
    net: hns3: Fix for VF mailbox receiving unknown message
    net: hns3: Fix for VF mailbox cannot receiving PF response
    bnx2x: use the right constant
    Revert "net: sched: cls: Fix offloading when ingress dev is vxlan"
    net: dsa: b53: Fix for brcm tag issue in Cygnus SoC
    enic: fix UDP rss bits
    netdev-FAQ: clarify DaveM's position for stable backports
    rtnetlink: validate attributes in do_setlink()
    mlxsw: Add extack messages for port_{un, }split failures
    netdevsim: Add extack error message for devlink reload
    devlink: Add extack to reload and port_{un, }split operations
    net: metrics: add proper netlink validation
    ipmr: fix error path when ipmr_new_table fails
    ip6mr: only set ip6mr_table from setsockopt when ip6mr_new_table succeeds
    net: hns3: remove unused hclgevf_cfg_func_mta_filter
    netfilter: provide udp*_lib_lookup for nf_tproxy
    qed*: Utilize FW 8.37.2.0
    ...

    Linus Torvalds
     

18 May, 2018

1 commit


16 May, 2018

2 commits


08 May, 2018

1 commit


02 Apr, 2018

1 commit


01 Apr, 2018

1 commit


30 Mar, 2018

1 commit

  • NETIF_F_HW_VLAN_[CS]TAG_FILTER features require more than just a bit
    flip in dev->features in order to keep the driver in a consistent state.
    These features notify the driver of each added/removed vlan, but toggling
    of vlan-filter does not notify the driver accordingly for each of the
    existing vlans.

    This patch implements a similar solution to NETIF_F_RX_UDP_TUNNEL_PORT
    behavior (which notifies the driver about UDP ports in the same manner
    that vids are reported).

    Each toggling of the features propagates to the 8021q module, which
    iterates over the vlans and call add/kill ndo accordingly.

    Signed-off-by: Gal Pressman
    Reviewed-by: Tariq Toukan
    Signed-off-by: David S. Miller

    Gal Pressman
     

28 Mar, 2018

1 commit


27 Mar, 2018

1 commit

  • Prefer the direct use of octal for permissions.

    Done with checkpatch -f --types=SYMBOLIC_PERMS --fix-inplace
    and some typing.

    Miscellanea:

    o Whitespace neatening around these conversions.

    Signed-off-by: Joe Perches
    Signed-off-by: David S. Miller

    Joe Perches
     

23 Mar, 2018

1 commit

  • Fun set of conflict resolutions here...

    For the mac80211 stuff, these were fortunately just parallel
    adds. Trivially resolved.

    In drivers/net/phy/phy.c we had a bug fix in 'net' that moved the
    function phy_disable_interrupts() earlier in the file, whilst in
    'net-next' the phy_error() call from this function was removed.

    In net/ipv4/xfrm4_policy.c, David Ahern's changes to remove the
    'rt_table_id' member of rtable collided with a bug fix in 'net' that
    added a new struct member "rt_mtu_locked" which needs to be copied
    over here.

    The mlxsw driver conflict consisted of net-next separating
    the span code and definitions into separate files, whilst
    a 'net' bug fix made some changes to that moved code.

    The mlx5 infiniband conflict resolution was quite non-trivial,
    the RDMA tree's merge commit was used as a guide here, and
    here are their notes:

    ====================

    Due to bug fixes found by the syzkaller bot and taken into the for-rc
    branch after development for the 4.17 merge window had already started
    being taken into the for-next branch, there were fairly non-trivial
    merge issues that would need to be resolved between the for-rc branch
    and the for-next branch. This merge resolves those conflicts and
    provides a unified base upon which ongoing development for 4.17 can
    be based.

    Conflicts:
    drivers/infiniband/hw/mlx5/main.c - Commit 42cea83f9524
    (IB/mlx5: Fix cleanup order on unload) added to for-rc and
    commit b5ca15ad7e61 (IB/mlx5: Add proper representors support)
    add as part of the devel cycle both needed to modify the
    init/de-init functions used by mlx5. To support the new
    representors, the new functions added by the cleanup patch
    needed to be made non-static, and the init/de-init list
    added by the representors patch needed to be modified to
    match the init/de-init list changes made by the cleanup
    patch.
    Updates:
    drivers/infiniband/hw/mlx5/mlx5_ib.h - Update function
    prototypes added by representors patch to reflect new function
    names as changed by cleanup patch
    drivers/infiniband/hw/mlx5/ib_rep.c - Update init/de-init
    stage list to match new order from cleanup patch
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

16 Mar, 2018

1 commit

  • With reorder header off, received packets are untagged in skb_vlan_untag()
    called from within __netif_receive_skb_core(), and later the tag will be
    inserted back in vlan_do_receive().

    This caused out of order vlan headers when we create a vlan device on top
    of another vlan device, because vlan_do_receive() inserts a tag as the
    outermost vlan tag. E.g. the outer tag is first removed in skb_vlan_untag()
    and inserted back in vlan_do_receive(), then the inner tag is next removed
    and inserted back as the outermost tag.

    This patch fixes the behaviour by inserting the inner tag at the right
    position.

    Signed-off-by: Toshiaki Makita
    Signed-off-by: David S. Miller

    Toshiaki Makita
     

28 Feb, 2018

1 commit


17 Jan, 2018

1 commit

  • /proc has been ignoring struct file_operations::owner field for 10 years.
    Specifically, it started with commit 786d7e1612f0b0adb6046f19b906609e4fe8b1ba
    ("Fix rmmod/read/write races in /proc entries"). Notice the chunk where
    inode->i_fop is initialized with proxy struct file_operations for
    regular files:

    - if (de->proc_fops)
    - inode->i_fop = de->proc_fops;
    + if (de->proc_fops) {
    + if (S_ISREG(inode->i_mode))
    + inode->i_fop = &proc_reg_file_ops;
    + else
    + inode->i_fop = de->proc_fops;
    + }

    VFS stopped pinning module at this point.

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: David S. Miller

    Alexey Dobriyan
     

11 Jan, 2018

1 commit

  • A vlan device with vid 0 is allow to creat by not able to be fully
    cleaned up by unregister_vlan_dev() which checks for vlan_id!=0.

    Also, VLAN 0 is probably not a valid number and it is kinda
    "reserved" for HW accelerating devices, but it is probably too
    late to reject it from creation even if makes sense. Instead,
    just remove the check in unregister_vlan_dev().

    Reported-by: Dmitry Vyukov
    Fixes: ad1afb003939 ("vlan_dev: VLAN 0 should be treated as "no vlan tag" (802.1p packet)")
    Cc: Vlad Yasevich
    Cc: Ben Hutchings
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     

12 Nov, 2017

1 commit


11 Nov, 2017

1 commit

  • After refcnt reaches zero, vlan_vid_del() could free
    dev->vlan_info via RCU:

    RCU_INIT_POINTER(dev->vlan_info, NULL);
    call_rcu(&vlan_info->rcu, vlan_info_rcu_free);

    However, the pointer 'grp' still points to that memory
    since it is set before vlan_vid_del():

    vlan_info = rtnl_dereference(dev->vlan_info);
    if (!vlan_info)
    goto out;
    grp = &vlan_info->grp;

    Depends on when that RCU callback is scheduled, we could
    trigger a use-after-free in vlan_group_for_each_dev()
    right following this vlan_vid_del().

    Fix it by moving vlan_vid_del() before setting grp. This
    is also symmetric to the vlan_vid_add() we call in
    vlan_device_event().

    Reported-by: Fengguang Wu
    Fixes: efc73f4bbc23 ("net: Fix memory leak - vlan_info struct")
    Cc: Alexander Duyck
    Cc: Linus Torvalds
    Cc: Girish Moodalbail
    Signed-off-by: Cong Wang
    Reviewed-by: Girish Moodalbail
    Tested-by: Fengguang Wu
    Signed-off-by: David S. Miller

    Cong Wang
     

04 Nov, 2017

2 commits

  • Some time ago Eric Dumazet suggested a "hack the IFF_XMIT_DST_RELEASE
    flag on the vlan netdev". But the last comment was "does not support
    properly bonding/team.(If the real_dev->privflags IFF_XMIT_DST_RELEASE
    bit changes, we want to update all the vlans at the same time )"

    I've extended that patch to support changes of IFF_XMIT_DST_RELEASE in
    bonding/team.
    Both bonding and team call netdev_change_features() after recalculation
    of features including priv_flags IFF_XMIT_DST_RELEASE bit. So the only
    thing needed to support is to recheck this bit in
    vlan_transfer_features().

    Suggested-by: Eric Dumazet
    Signed-off-by: Vadim Fedorenko
    Reviewed-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Vadim Fedorenko
     
  • Files removed in 'net-next' had their license header updated
    in 'net'. We take the remove from 'net-next'.

    Signed-off-by: David S. Miller

    David S. Miller
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

06 Oct, 2017

1 commit


05 Oct, 2017

2 commits

  • Add extack arg to netdev_upper_dev_link and netdev_master_upper_dev_link

    Signed-off-by: David Ahern
    Signed-off-by: David S. Miller

    David Ahern
     
  • If the vlan is down, free the packet instead of proceeding with other
    processing, or counting it as received. If vlan interfaces are used
    as slaves for bonding, with arp monitoring for connectivity, if the rx
    counter is seen to be incrementing, then the bond device will not
    observe that the interface is down.

    CC: David S. Miller
    Signed-off-by: Vishakha Narvekar
    Signed-off-by: David S. Miller

    Vishakha Narvekar