03 Oct, 2020

1 commit


23 Sep, 2020

1 commit

  • Two minor conflicts:

    1) net/ipv4/route.c, adding a new local variable while
    moving another local variable and removing it's
    initial assignment.

    2) drivers/net/dsa/microchip/ksz9477.c, overlapping changes.
    One pretty prints the port mode differently, whilst another
    changes the driver to try and obtain the port mode from
    the port node rather than the switch node.

    Signed-off-by: David S. Miller

    David S. Miller
     

18 Sep, 2020

1 commit


10 Sep, 2020

1 commit

  • clean follow coccicheck warning:
    net//hsr/hsr_netlink.c:94:8-42: WARNING avoid newline at end of message
    in NL_SET_ERR_MSG_MOD
    net//hsr/hsr_netlink.c:87:30-57: WARNING avoid newline at end of message
    in NL_SET_ERR_MSG_MOD
    net//hsr/hsr_netlink.c:79:29-53: WARNING avoid newline at end of message
    in NL_SET_ERR_MSG_MOD

    Signed-off-by: Ye Bin
    Signed-off-by: David S. Miller

    Ye Bin
     

01 Aug, 2020

1 commit


28 Jul, 2020

7 commits

  • Print PRP specific information from node table as part of debugfs
    node table display. Also display the node as DAN-H or DAN-P depending
    on the info from node table.

    Signed-off-by: Murali Karicheri
    Signed-off-by: David S. Miller

    Murali Karicheri
     
  • DAN-P (Dual Attached Nodes PRP) nodes are expected to receive
    traditional IP packets as well as PRP (Parallel Redundancy
    Protocol) tagged (trailer) packets. PRP trailer is 6 bytes
    of PRP protocol unit called RCT, Redundancy Control Trailer
    (RCT) similar to HSR tag. PRP network can have traditional
    devices such as bridges/switches or PC attached to it and
    should be able to communicate. Regular Ethernet devices treat
    the RCT as pads. This patch adds logic to format L2 frames
    from network stack to add a trailer (RCT) and send it as
    duplicates over the slave interfaces when the protocol is
    PRP as per IEC 62439-3. At the ingress, it strips the trailer,
    do duplicate detection and rejection and forward a stripped
    frame up the network stack. PRP device should accept frames
    from Singly Attached Nodes (SAN) and thus the driver mark
    the link where the frame came from in the node table.

    Signed-off-by: Murali Karicheri
    Signed-off-by: David S. Miller

    Murali Karicheri
     
  • As a preparatory patch to introduce PRP, refactor the code specific to
    handling HSR frames into separate functions and call them through
    proto_ops function pointers.

    Signed-off-by: Murali Karicheri
    Signed-off-by: David S. Miller

    Murali Karicheri
     
  • Add support for generation of PRP supervision frames. For PRP,
    supervision frame format is similar to HSR version 0, but have
    a PRP Redundancy Control Trailer (RCT) added and uses a different
    message type, PRP_TLV_LIFE_CHECK_DD. Also update
    is_supervision_frame() to include the new message type used for
    PRP supervision frame.

    Signed-off-by: Murali Karicheri
    Signed-off-by: David S. Miller

    Murali Karicheri
     
  • As a preparatory patch to introduce support for PRP protocol, add a
    protocol ops ptr in the private hsr structure to hold function
    pointers as some of the functions at protocol level packet
    handling is different for HSR vs PRP. It is expected that PRP will
    add its of set of functions for protocol handling. Modify existing
    hsr_announce() function to call proto_ops->send_sv_frame() to send
    supervision frame for HSR. This is expected to be different for PRP.
    So introduce a ops function ptr, send_sv_frame() for the same and
    initialize it to send_hsr_supervsion_frame(). Modify hsr_announce()
    to call proto_ops->send_sv_frame().

    Signed-off-by: Murali Karicheri
    Signed-off-by: David S. Miller

    Murali Karicheri
     
  • As a preparatory patch to introduce PRP protocol support in the
    driver, refactor the skb init code to a separate function.

    Signed-off-by: Murali Karicheri
    Signed-off-by: David S. Miller

    Murali Karicheri
     
  • Parallel Redundancy Protocol (PRP) is another redundancy protocol
    introduced by IEC 63439 standard. It is similar to HSR in many
    aspects:-

    - Use a pair of Ethernet interfaces to created the PRP device
    - Use a 6 byte redundancy protocol part (RCT, Redundancy Check
    Trailer) similar to HSR Tag.
    - Has Link Redundancy Entity (LRE) that works with RCT to implement
    redundancy.

    Key difference is that the protocol unit is a trailer instead of a
    prefix as in HSR. That makes it inter-operable with tradition network
    components such as bridges/switches which treat it as pad bytes,
    whereas HSR nodes requires some kind of translators (Called redbox) to
    talk to regular network devices. This features allows regular linux box
    to be converted to a DAN-P box. DAN-P stands for Dual Attached Node - PRP
    similar to DAN-H (Dual Attached Node - HSR).

    Add a comment at the header/source code to explicitly state that the
    driver files also handles PRP protocol as well.

    Signed-off-by: Murali Karicheri
    Signed-off-by: David S. Miller

    Murali Karicheri
     

26 Jul, 2020

1 commit

  • The UDP reuseport conflict was a little bit tricky.

    The net-next code, via bpf-next, extracted the reuseport handling
    into a helper so that the BPF sk lookup code could invoke it.

    At the same time, the logic for reuseport handling of unconnected
    sockets changed via commit efc6b6f6c3113e8b203b9debfb72d81e0f3dcace
    which changed the logic to carry on the reuseport result into the
    rest of the lookup loop if we do not return immediately.

    This requires moving the reuseport_has_conns() logic into the callers.

    While we are here, get rid of inline directives as they do not belong
    in foo.c files.

    The other changes were cases of more straightforward overlapping
    modifications.

    Signed-off-by: David S. Miller

    David S. Miller
     

21 Jul, 2020

2 commits


18 Jul, 2020

2 commits

  • Validate MAC address before copying the same to outgoing frame
    skb destination address. Since a node can have zero mac
    address for Link B until a valid frame is received over
    that link, this fix address the issue of a zero MAC address
    being in the packet.

    Signed-off-by: Murali Karicheri
    Signed-off-by: David S. Miller

    Murali Karicheri
     
  • For small Ethernet frames with size less than minimum size 66 for HSR
    vs 60 for regular Ethernet frames, hsr driver currently doesn't pad the
    frame to make it minimum size. This results in incorrect LSDU size being
    populated in the HSR tag for these frames. Fix this by padding the frame
    to the minimum size applicable for HSR.

    Signed-off-by: Murali Karicheri
    Signed-off-by: David S. Miller

    Murali Karicheri
     

11 Jul, 2020

1 commit


05 Jul, 2020

1 commit

  • To release hsr(upper) interface, it should release
    its own lower interfaces first.
    Then, hsr(upper) interface can be released safely.
    In the current code of error path of hsr_dev_finalize(), it releases hsr
    interface before releasing a lower interface.
    So, a warning occurs, which warns about the leak of lower interfaces.
    In order to fix this problem, changing the ordering of the error path of
    hsr_dev_finalize() is needed.

    Test commands:
    ip link add dummy0 type dummy
    ip link add dummy1 type dummy
    ip link add dummy2 type dummy
    ip link add hsr0 type hsr slave1 dummy0 slave2 dummy1
    ip link add hsr1 type hsr slave1 dummy2 slave2 dummy0

    Splat looks like:
    [ 214.923127][ C2] WARNING: CPU: 2 PID: 1093 at net/core/dev.c:8992 rollback_registered_many+0x986/0xcf0
    [ 214.923129][ C2] Modules linked in: hsr dummy openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipx
    [ 214.923154][ C2] CPU: 2 PID: 1093 Comm: ip Not tainted 5.8.0-rc2+ #623
    [ 214.923156][ C2] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
    [ 214.923157][ C2] RIP: 0010:rollback_registered_many+0x986/0xcf0
    [ 214.923160][ C2] Code: 41 8b 4e cc 45 31 c0 31 d2 4c 89 ee 48 89 df e8 e0 47 ff ff 85 c0 0f 84 cd fc ff ff 5
    [ 214.923162][ C2] RSP: 0018:ffff8880c5156f28 EFLAGS: 00010287
    [ 214.923165][ C2] RAX: ffff8880d1dad458 RBX: ffff8880bd1b9000 RCX: ffffffffb929d243
    [ 214.923167][ C2] RDX: 1ffffffff77e63f0 RSI: 0000000000000008 RDI: ffffffffbbf31f80
    [ 214.923168][ C2] RBP: dffffc0000000000 R08: fffffbfff77e63f1 R09: fffffbfff77e63f1
    [ 214.923170][ C2] R10: ffffffffbbf31f87 R11: 0000000000000001 R12: ffff8880c51570a0
    [ 214.923172][ C2] R13: ffff8880bd1b90b8 R14: ffff8880c5157048 R15: ffff8880d1dacc40
    [ 214.923174][ C2] FS: 00007fdd257a20c0(0000) GS:ffff8880da200000(0000) knlGS:0000000000000000
    [ 214.923175][ C2] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 214.923177][ C2] CR2: 00007ffd78beb038 CR3: 00000000be544005 CR4: 00000000000606e0
    [ 214.923179][ C2] Call Trace:
    [ 214.923180][ C2] ? netif_set_real_num_tx_queues+0x780/0x780
    [ 214.923182][ C2] ? dev_validate_mtu+0x140/0x140
    [ 214.923183][ C2] ? synchronize_rcu.part.79+0x85/0xd0
    [ 214.923185][ C2] ? synchronize_rcu_expedited+0xbb0/0xbb0
    [ 214.923187][ C2] rollback_registered+0xc8/0x170
    [ 214.923188][ C2] ? rollback_registered_many+0xcf0/0xcf0
    [ 214.923190][ C2] unregister_netdevice_queue+0x18b/0x240
    [ 214.923191][ C2] hsr_dev_finalize+0x56e/0x6e0 [hsr]
    [ 214.923192][ C2] hsr_newlink+0x36b/0x450 [hsr]
    [ 214.923194][ C2] ? hsr_dellink+0x70/0x70 [hsr]
    [ 214.923195][ C2] ? rtnl_create_link+0x2e4/0xb00
    [ 214.923197][ C2] ? __netlink_ns_capable+0xc3/0xf0
    [ 214.923198][ C2] __rtnl_newlink+0xbdb/0x1270
    [ ... ]

    Fixes: e0a4b99773d3 ("hsr: use upper/lower device infrastructure")
    Reported-by: syzbot+7f1c020f68dab95aab59@syzkaller.appspotmail.com
    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     

29 Jun, 2020

1 commit

  • The method ndo_start_xmit() is defined as returning an 'netdev_tx_t',
    which is a typedef for an enum type, but the implementation in this
    driver returns an 'int'.

    Fix this by returning 'netdev_tx_t' in this driver too.

    Signed-off-by: Luc Van Oostenryck
    Signed-off-by: David S. Miller

    Luc Van Oostenryck
     

23 Jun, 2020

1 commit

  • When an interface is being deleted, "/proc/net/dev_snmp6/"
    is deleted.
    The function for this is addrconf_ifdown() in the addrconf_notify() and
    it is called by notification, which is NETDEV_UNREGISTER.
    But, if NETDEV_CHANGEMTU is triggered after NETDEV_UNREGISTER,
    this proc file will be created again.
    This recreated proc file will be deleted by netdev_wati_allrefs().
    Before netdev_wait_allrefs() is called, creating a new HSR interface
    routine can be executed and It tries to create a proc file but it will
    find an un-deleted proc file.
    At this point, it warns about it.

    To avoid this situation, it can use ->dellink() instead of
    ->ndo_uninit() to release resources because ->dellink() is called
    before NETDEV_UNREGISTER.
    So, a proc file will not be recreated.

    Test commands
    ip link add dummy0 type dummy
    ip link add dummy1 type dummy
    ip link set dummy0 mtu 1300

    #SHELL1
    while :
    do
    ip link add hsr0 type hsr slave1 dummy0 slave2 dummy1
    done

    #SHELL2
    while :
    do
    ip link del hsr0
    done

    Splat looks like:
    [ 9888.980852][ T2752] proc_dir_entry 'dev_snmp6/hsr0' already registered
    [ 9888.981797][ C2] WARNING: CPU: 2 PID: 2752 at fs/proc/generic.c:372 proc_register+0x2d5/0x430
    [ 9888.981798][ C2] Modules linked in: hsr dummy veth openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipv6x
    [ 9888.981814][ C2] CPU: 2 PID: 2752 Comm: ip Tainted: G W 5.8.0-rc1+ #616
    [ 9888.981815][ C2] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
    [ 9888.981816][ C2] RIP: 0010:proc_register+0x2d5/0x430
    [ 9888.981818][ C2] Code: fc ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 65 01 00 00 49 8b b5 e0 00 00 00 48 89 ea 40
    [ 9888.981819][ C2] RSP: 0018:ffff8880628dedf0 EFLAGS: 00010286
    [ 9888.981821][ C2] RAX: dffffc0000000008 RBX: ffff888028c69170 RCX: ffffffffaae09a62
    [ 9888.981822][ C2] RDX: 0000000000000001 RSI: 0000000000000008 RDI: ffff88806c9f75ac
    [ 9888.981823][ C2] RBP: ffff888028c693f4 R08: ffffed100d9401bd R09: ffffed100d9401bd
    [ 9888.981824][ C2] R10: ffffffffaddf406f R11: 0000000000000001 R12: ffff888028c69308
    [ 9888.981825][ C2] R13: ffff8880663584c8 R14: dffffc0000000000 R15: ffffed100518d27e
    [ 9888.981827][ C2] FS: 00007f3876b3b0c0(0000) GS:ffff88806c800000(0000) knlGS:0000000000000000
    [ 9888.981828][ C2] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 9888.981829][ C2] CR2: 00007f387601a8c0 CR3: 000000004101a002 CR4: 00000000000606e0
    [ 9888.981830][ C2] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [ 9888.981831][ C2] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    [ 9888.981832][ C2] Call Trace:
    [ 9888.981833][ C2] ? snmp6_seq_show+0x180/0x180
    [ 9888.981834][ C2] proc_create_single_data+0x7c/0xa0
    [ 9888.981835][ C2] snmp6_register_dev+0xb0/0x130
    [ 9888.981836][ C2] ipv6_add_dev+0x4b7/0xf60
    [ 9888.981837][ C2] addrconf_notify+0x684/0x1ca0
    [ 9888.981838][ C2] ? __mutex_unlock_slowpath+0xd0/0x670
    [ 9888.981839][ C2] ? kasan_unpoison_shadow+0x30/0x40
    [ 9888.981840][ C2] ? wait_for_completion+0x250/0x250
    [ 9888.981841][ C2] ? inet6_ifinfo_notify+0x100/0x100
    [ 9888.981842][ C2] ? dropmon_net_event+0x227/0x410
    [ 9888.981843][ C2] ? notifier_call_chain+0x90/0x160
    [ 9888.981844][ C2] ? inet6_ifinfo_notify+0x100/0x100
    [ 9888.981845][ C2] notifier_call_chain+0x90/0x160
    [ 9888.981846][ C2] register_netdevice+0xbe5/0x1070
    [ ... ]

    Reported-by: syzbot+1d51c8b74efa4c44adeb@syzkaller.appspotmail.com
    Fixes: e0a4b99773d3 ("hsr: use upper/lower device infrastructure")
    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     

14 Jun, 2020

1 commit

  • Since commit 84af7a6194e4 ("checkpatch: kconfig: prefer 'help' over
    '---help---'"), the number of '---help---' has been gradually
    decreasing, but there are still more than 2400 instances.

    This commit finishes the conversion. While I touched the lines,
    I also fixed the indentation.

    There are a variety of indentation styles found.

    a) 4 spaces + '---help---'
    b) 7 spaces + '---help---'
    c) 8 spaces + '---help---'
    d) 1 space + 1 tab + '---help---'
    e) 1 tab + '---help---' (correct indentation)
    f) 1 tab + 1 space + '---help---'
    g) 1 tab + 2 spaces + '---help---'

    In order to convert all of them to 1 tab + 'help', I ran the
    following commend:

    $ find . -name 'Kconfig*' | xargs sed -i 's/^[[:space:]]*---help---/\thelp/'

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

08 May, 2020

1 commit


07 May, 2020

2 commits


01 May, 2020

1 commit


30 Apr, 2020

1 commit


26 Apr, 2020

1 commit


08 Apr, 2020

1 commit

  • In the current hsr code, only 0 and 1 protocol versions are valid.
    But current hsr code doesn't check the version, which is received by
    userspace.

    Test commands:
    ip link add dummy0 type dummy
    ip link add dummy1 type dummy
    ip link add hsr0 type hsr slave1 dummy0 slave2 dummy1 version 4

    In the test commands, version 4 is invalid.
    So, the command should be failed.

    After this patch, following error will occur.
    "Error: hsr: Only versions 0..1 are supported."

    Fixes: ee1c27977284 ("net/hsr: Added support for HSR v1")
    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     

26 Mar, 2020

1 commit


22 Mar, 2020

1 commit

  • The port->hsr is used in the hsr_handle_frame(), which is a
    callback of rx_handler.
    hsr master and slaves are initialized in hsr_add_port().
    This function initializes several pointers, which includes port->hsr after
    registering rx_handler.
    So, in the rx_handler routine, un-initialized pointer would be used.
    In order to fix this, pointers should be initialized before
    registering rx_handler.

    Test commands:
    ip netns del left
    ip netns del right
    modprobe -rv veth
    modprobe -rv hsr
    killall ping
    modprobe hsr
    ip netns add left
    ip netns add right
    ip link add veth0 type veth peer name veth1
    ip link add veth2 type veth peer name veth3
    ip link add veth4 type veth peer name veth5
    ip link set veth1 netns left
    ip link set veth3 netns right
    ip link set veth4 netns left
    ip link set veth5 netns right
    ip link set veth0 up
    ip link set veth2 up
    ip link set veth0 address fc:00:00:00:00:01
    ip link set veth2 address fc:00:00:00:00:02
    ip netns exec left ip link set veth1 up
    ip netns exec left ip link set veth4 up
    ip netns exec right ip link set veth3 up
    ip netns exec right ip link set veth5 up
    ip link add hsr0 type hsr slave1 veth0 slave2 veth2
    ip a a 192.168.100.1/24 dev hsr0
    ip link set hsr0 up
    ip netns exec left ip link add hsr1 type hsr slave1 veth1 slave2 veth4
    ip netns exec left ip a a 192.168.100.2/24 dev hsr1
    ip netns exec left ip link set hsr1 up
    ip netns exec left ip n a 192.168.100.1 dev hsr1 lladdr \
    fc:00:00:00:00:01 nud permanent
    ip netns exec left ip n r 192.168.100.1 dev hsr1 lladdr \
    fc:00:00:00:00:01 nud permanent
    for i in {1..100}
    do
    ip netns exec left ping 192.168.100.1 &
    done
    ip netns exec left hping3 192.168.100.1 -2 --flood &
    ip netns exec right ip link add hsr2 type hsr slave1 veth3 slave2 veth5
    ip netns exec right ip a a 192.168.100.3/24 dev hsr2
    ip netns exec right ip link set hsr2 up
    ip netns exec right ip n a 192.168.100.1 dev hsr2 lladdr \
    fc:00:00:00:00:02 nud permanent
    ip netns exec right ip n r 192.168.100.1 dev hsr2 lladdr \
    fc:00:00:00:00:02 nud permanent
    for i in {1..100}
    do
    ip netns exec right ping 192.168.100.1 &
    done
    ip netns exec right hping3 192.168.100.1 -2 --flood &
    while :
    do
    ip link add hsr0 type hsr slave1 veth0 slave2 veth2
    ip a a 192.168.100.1/24 dev hsr0
    ip link set hsr0 up
    ip link del hsr0
    done

    Splat looks like:
    [ 120.954938][ C0] general protection fault, probably for non-canonical address 0xdffffc0000000006: 0000 [#1]I
    [ 120.957761][ C0] KASAN: null-ptr-deref in range [0x0000000000000030-0x0000000000000037]
    [ 120.959064][ C0] CPU: 0 PID: 1511 Comm: hping3 Not tainted 5.6.0-rc5+ #460
    [ 120.960054][ C0] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
    [ 120.962261][ C0] RIP: 0010:hsr_addr_is_self+0x65/0x2a0 [hsr]
    [ 120.963149][ C0] Code: 44 24 18 70 73 2f c0 48 c1 eb 03 48 8d 04 13 c7 00 f1 f1 f1 f1 c7 40 04 00 f2 f2 f2 4
    [ 120.966277][ C0] RSP: 0018:ffff8880d9c09af0 EFLAGS: 00010206
    [ 120.967293][ C0] RAX: 0000000000000006 RBX: 1ffff1101b38135f RCX: 0000000000000000
    [ 120.968516][ C0] RDX: dffffc0000000000 RSI: ffff8880d17cb208 RDI: 0000000000000000
    [ 120.969718][ C0] RBP: 0000000000000030 R08: ffffed101b3c0e3c R09: 0000000000000001
    [ 120.972203][ C0] R10: 0000000000000001 R11: ffffed101b3c0e3b R12: 0000000000000000
    [ 120.973379][ C0] R13: ffff8880aaf80100 R14: ffff8880aaf800f2 R15: ffff8880aaf80040
    [ 120.974410][ C0] FS: 00007f58e693f740(0000) GS:ffff8880d9c00000(0000) knlGS:0000000000000000
    [ 120.979794][ C0] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 120.980773][ C0] CR2: 00007ffcb8b38f29 CR3: 00000000afe8e001 CR4: 00000000000606f0
    [ 120.981945][ C0] Call Trace:
    [ 120.982411][ C0]
    [ 120.982848][ C0] ? hsr_add_node+0x8c0/0x8c0 [hsr]
    [ 120.983522][ C0] ? rcu_read_lock_held+0x90/0xa0
    [ 120.984159][ C0] ? rcu_read_lock_sched_held+0xc0/0xc0
    [ 120.984944][ C0] hsr_handle_frame+0x1db/0x4e0 [hsr]
    [ 120.985597][ C0] ? hsr_nl_nodedown+0x2b0/0x2b0 [hsr]
    [ 120.986289][ C0] __netif_receive_skb_core+0x6bf/0x3170
    [ 120.992513][ C0] ? check_chain_key+0x236/0x5d0
    [ 120.993223][ C0] ? do_xdp_generic+0x1460/0x1460
    [ 120.993875][ C0] ? register_lock_class+0x14d0/0x14d0
    [ 120.994609][ C0] ? __netif_receive_skb_one_core+0x8d/0x160
    [ 120.995377][ C0] __netif_receive_skb_one_core+0x8d/0x160
    [ 120.996204][ C0] ? __netif_receive_skb_core+0x3170/0x3170
    [ ... ]

    Reported-by: syzbot+fcf5dd39282ceb27108d@syzkaller.appspotmail.com
    Fixes: c5a759117210 ("net/hsr: Use list_head (and rcu) instead of array for slave devices.")
    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     

16 Mar, 2020

3 commits

  • The hsr module has been supporting the list and status command.
    (HSR_C_GET_NODE_LIST and HSR_C_GET_NODE_STATUS)
    These commands send node information to the user-space via generic netlink.
    But, in the non-init_net namespace, these commands are not allowed
    because .netnsok flag is false.
    So, there is no way to get node information in the non-init_net namespace.

    Fixes: f421436a591d ("net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)")
    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     
  • The hsr_get_node_list() is to send node addresses to the userspace.
    If there are so many nodes, it could fail because of buffer size.
    In order to avoid this failure, the restart routine is added.

    Fixes: f421436a591d ("net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)")
    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     
  • hsr_get_node_{list/status}() are not under rtnl_lock() because
    they are callback functions of generic netlink.
    But they use __dev_get_by_index() without rtnl_lock().
    So, it would use unsafe data.
    In order to fix it, rcu_read_lock() and dev_get_by_index_rcu()
    are used instead of __dev_get_by_index().

    Fixes: f421436a591d ("net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)")
    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     

06 Mar, 2020

1 commit

  • In the commit e0a4b99773d3 ("hsr: use upper/lower device infrastructure"),
    dev_get() was removed but dev_put() in the error path wasn't removed.
    So, if creating hsr interface command is failed, the reference counter leak
    of lower interface would occur.

    Test commands:
    ip link add dummy0 type dummy
    ip link add ipvlan0 link dummy0 type ipvlan mode l2
    ip link add ipvlan1 link dummy0 type ipvlan mode l2
    ip link add hsr0 type hsr slave1 ipvlan0 slave2 ipvlan1
    ip link del ipvlan0

    Result:
    [ 633.271992][ T1280] unregister_netdevice: waiting for ipvlan0 to become free. Usage count = -1

    Fixes: e0a4b99773d3 ("hsr: use upper/lower device infrastructure")
    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     

01 Mar, 2020

5 commits

  • netdev_upper_dev_link() is useful to manage lower/upper interfaces.
    And this function internally validates looping, maximum depth.
    All or most virtual interfaces that could have a real interface
    (e.g. macsec, macvlan, ipvlan etc.) use lower/upper infrastructure.

    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     
  • In order to access the port list, the hsr_port_get_hsr() is used.
    And this is protected by RTNL and RCU.
    The hsr_fill_info(), hsr_check_carrier(), hsr_dev_open() and
    hsr_get_max_mtu() are protected by RTNL.
    So, rcu_read_lock() in these functions are not necessary.
    The hsr_handle_frame() also uses rcu_read_lock() but this function
    is called by packet path.
    It's already protected by RCU.
    So, the rcu_read_lock() in hsr_handle_frame() can be removed.

    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     
  • When HSR interface is sending a frame, it finds a node with
    the destination ethernet address from the list.
    If there is no node, it calls WARN_ONCE().
    But, using WARN_ONCE() for this situation is a little bit overdoing.
    So, in this patch, the netdev_err() is used instead.

    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     
  • If HSR uses the extack instead of netdev_info(), users can get
    error messages immediately without any checking the kernel message.

    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     
  • If it uses debugfs_remove_recursive() instead of debugfs_remove(),
    hsr_priv() doesn't need to have "node_tbl_file" pointer variable.

    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo