From: Jacob Wen <jian.w.wen@oracle.com>
To: netdev@vger.kernel.org
Cc: john.r.fastabend@intel.com
Subject: [PATCH net] net_sched: sch_mqprio: handle return value of mqprio_queue_get
Date: Mon, 10 Jun 2019 14:38:21 +0800 [thread overview]
Message-ID: <20190610063821.27007-1-jian.w.wen@oracle.com> (raw)
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
next reply other threads:[~2019-06-10 6:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 6:38 Jacob Wen [this message]
2019-06-10 16:05 ` [PATCH net] net_sched: sch_mqprio: handle return value of mqprio_queue_get David Miller
2019-06-10 16:06 ` David Miller
2019-06-10 18:19 ` Cong Wang
2019-06-11 0:27 ` Jacob Wen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190610063821.27007-1-jian.w.wen@oracle.com \
--to=jian.w.wen@oracle.com \
--cc=john.r.fastabend@intel.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox