• Yan Markman's avatar
    net: mvpp2: fix port list indexing · 6bf69a1d
    Yan Markman authored
    The private port_list array has a list of pointers to mvpp2_port
    instances. This list is allocated given the number of ports enabled in
    the device tree, but the pointers are set using the port-id property. If
    on a single port is enabled, the port_list array will be of size 1, but
    when registering the port, if its id is not 0 the driver will crash.
    Other crashes were encountered in various situations.
    
    This fixes the issue by using an index not equal to the value of the
    port-id property.
    
    Fixes: 3f518509 ("ethernet: Add new driver for Marvell Armada 375 network unit")
    Signed-off-by: default avatarAntoine Tenart <antoine.tenart@free-electrons.com>
    Signed-off-by: default avatarYan Markman <ymarkman@marvell.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    6bf69a1d
mvpp2.c 223 KB