Skip to content

Commit e83b171

Browse files
ffainellidavem330
authored andcommitted
net: systemport: Guard against unmapped TX ring
Because SYSTEMPORT is a (semi) normal network device, the stack may attempt to queue packets on it oustide of the DSA slave transmit path. When that happens, the DSA layer has not had a chance to tag packets with the appropriate per-port and per-queue information, and if that happens and we don't have a port 0 queue 0 available (e.g: on boards where this does not exist), we will hit a NULL pointer de-reference in bcm_sysport_select_queue(). Guard against such cases by testing for the TX ring validity. Fixes: 84ff33eeb23d ("net: systemport: Establish DSA network device queue mapping") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent fbd15f4 commit e83b171

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/net/ethernet/broadcom/bcmsysport.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,6 +2040,9 @@ static u16 bcm_sysport_select_queue(struct net_device *dev, struct sk_buff *skb,
20402040
port = BRCM_TAG_GET_PORT(queue);
20412041
tx_ring = priv->ring_map[q + port * priv->per_port_num_tx_queues];
20422042

2043+
if (unlikely(!tx_ring))
2044+
return fallback(dev, skb);
2045+
20432046
return tx_ring->index;
20442047
}
20452048

0 commit comments

Comments
 (0)