[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190610063821.27007-1-jian.w.wen@oracle.com>
Date: Mon, 10 Jun 2019 14:38:21 +0800
From: Jacob Wen <jian.w.wen@...cle.com>
To: netdev@...r.kernel.org
Cc: john.r.fastabend@...el.com
Subject: [PATCH net] net_sched: sch_mqprio: handle return value of mqprio_queue_get
It may return NULL thus we can't ignore it.
---
net/sched/sch_mqprio.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c
index d05086dc3866..d926056f72ac 100644
--- a/net/sched/sch_mqprio.c
+++ b/net/sched/sch_mqprio.c
@@ -491,9 +491,12 @@ static int mqprio_dump_class(struct Qdisc *sch, unsigned long cl,
struct sk_buff *skb, struct tcmsg *tcm)
{
if (cl < TC_H_MIN_PRIORITY) {
- struct netdev_queue *dev_queue = mqprio_queue_get(sch, cl);
struct net_device *dev = qdisc_dev(sch);
int tc = netdev_txq_to_tc(dev, cl - 1);
+ struct netdev_queue *dev_queue = mqprio_queue_get(sch, cl);
+
+ if (!dev_queue)
+ return -EINVAL;
tcm->tcm_parent = (tc < 0) ? 0 :
TC_H_MAKE(TC_H_MAJ(sch->handle),
@@ -558,6 +561,8 @@ static int mqprio_dump_class_stats(struct Qdisc *sch, unsigned long cl,
return -1;
} else {
struct netdev_queue *dev_queue = mqprio_queue_get(sch, cl);
+ if (!dev_queue)
+ return -1;
sch = dev_queue->qdisc_sleeping;
if (gnet_stats_copy_basic(qdisc_root_sleeping_running(sch),
--
2.17.1
Powered by blists - more mailing lists