6c41d0f7af5453efaec7c87e80ac4e9b5065c5a6
[openwrt/staging/ldir.git] /
1 From cfda91fdd3396b97f2c08f0d8ed7749fbd87bb7b Mon Sep 17 00:00:00 2001
2 From: Camelia Groza <camelia.groza@nxp.com>
3 Date: Tue, 30 Oct 2018 17:34:31 +0200
4 Subject: [PATCH] sdk_dpaa: ceetm: guard against an out of bounds queue index
5
6 Make sure the queue mapping recorded in the skb is not larger than our
7 egress queue count.
8
9 Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
10 ---
11 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c | 5 ++++-
12 1 file changed, 4 insertions(+), 1 deletion(-)
13
14 --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
15 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
16 @@ -1982,7 +1982,7 @@ static struct ceetm_class *ceetm_classif
17
18 int __hot ceetm_tx(struct sk_buff *skb, struct net_device *net_dev)
19 {
20 - const int queue_mapping = dpa_get_queue_mapping(skb);
21 + int queue_mapping = dpa_get_queue_mapping(skb);
22 struct Qdisc *sch = net_dev->qdisc;
23 struct ceetm_class_stats *cstats;
24 struct ceetm_qdisc_stats *qstats;
25 @@ -2016,6 +2016,9 @@ int __hot ceetm_tx(struct sk_buff *skb,
26 goto drop;
27 }
28
29 + if (unlikely(queue_mapping >= DPAA_ETH_TX_QUEUES))
30 + queue_mapping = queue_mapping % DPAA_ETH_TX_QUEUES;
31 +
32 priv_dpa = netdev_priv(net_dev);
33 conf_fq = priv_dpa->conf_fqs[queue_mapping];
34