From: Vladimir Oltean Date: Fri, 13 Mar 2020 13:46:51 +0000 (+0200) Subject: net: mscc: ocelot: adjust maxlen on NPI port, not CPU X-Git-Tag: v5.7-rc1~146^2~162 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4a601f109614929aee45e58ca3514ec93da070bb;p=thirdparty%2Fkernel%2Flinux.git net: mscc: ocelot: adjust maxlen on NPI port, not CPU Being a non-physical port, the CPU port does not have an ocelot_port structure, so the ocelot_port_writel call inside the ocelot_port_set_maxlen() function would access data behind a NULL pointer. This is a patch for net-next only, the net tree boots fine, the bug was introduced during the net -> net-next merge. Fixes: 1d3435793123 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net") Fixes: a8015ded89ad ("net: mscc: ocelot: properly account for VLAN header length when setting MRU") Signed-off-by: Vladimir Oltean Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 18e9ffa21cd46..dc0e273286617 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -2341,7 +2341,7 @@ void ocelot_configure_cpu(struct ocelot *ocelot, int npi, else if (injection == OCELOT_TAG_PREFIX_LONG) sdu += OCELOT_LONG_PREFIX_LEN; - ocelot_port_set_maxlen(ocelot, cpu, sdu); + ocelot_port_set_maxlen(ocelot, npi, sdu); /* Enable NPI port */ ocelot_write_rix(ocelot,