Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net_sched: sch_mqprio: handle return value of mqprio_queue_get
@ 2019-06-10  6:38 Jacob Wen
  2019-06-10 16:05 ` David Miller
  2019-06-10 18:19 ` Cong Wang
  0 siblings, 2 replies; 5+ messages in thread
From: Jacob Wen @ 2019-06-10  6:38 UTC (permalink / raw)
  To: netdev; +Cc: john.r.fastabend

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-06-11  0:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-10  6:38 [PATCH net] net_sched: sch_mqprio: handle return value of mqprio_queue_get Jacob Wen
2019-06-10 16:05 ` David Miller
2019-06-10 16:06   ` David Miller
2019-06-10 18:19 ` Cong Wang
2019-06-11  0:27   ` Jacob Wen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox