]> git.baikalelectronics.ru Git - kernel.git/commit
net: mvpp2: fix port list indexing
authorYan Markman <ymarkman@marvell.com>
Mon, 25 Sep 2017 12:59:47 +0000 (14:59 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 28 Sep 2017 16:33:51 +0000 (09:33 -0700)
commit3e5cddca8e91d729a7c8669ec7341ffebb766ff6
tree581254768cf0eaf49676b15eda140e38a3cb1600
parent4041f2c5d6d69c9c90ca97b7fc588a46aa5aab95
net: mvpp2: fix port list indexing

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: decc8a74c68c ("ethernet: Add new driver for Marvell Armada 375 network unit")
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Yan Markman <ymarkman@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/mvpp2.c