* [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
* Re: [PATCH net] net_sched: sch_mqprio: handle return value of mqprio_queue_get
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
1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2019-06-10 16:05 UTC (permalink / raw)
To: jian.w.wen; +Cc: netdev, john.r.fastabend
From: Jacob Wen <jian.w.wen@oracle.com>
Date: Mon, 10 Jun 2019 14:38:21 +0800
> It may return NULL thus we can't ignore it.
Please repost with a proper signoff.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] net_sched: sch_mqprio: handle return value of mqprio_queue_get
2019-06-10 16:05 ` David Miller
@ 2019-06-10 16:06 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-06-10 16:06 UTC (permalink / raw)
To: jian.w.wen; +Cc: netdev, john.r.fastabend
From: David Miller <davem@davemloft.net>
Date: Mon, 10 Jun 2019 09:05:26 -0700 (PDT)
> From: Jacob Wen <jian.w.wen@oracle.com>
> Date: Mon, 10 Jun 2019 14:38:21 +0800
>
>> It may return NULL thus we can't ignore it.
>
> Please repost with a proper signoff.
Also, you are breaking the reverse christmas tree ordering of the local
variables with your change. Please do not do that.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] net_sched: sch_mqprio: handle return value of mqprio_queue_get
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 18:19 ` Cong Wang
2019-06-11 0:27 ` Jacob Wen
1 sibling, 1 reply; 5+ messages in thread
From: Cong Wang @ 2019-06-10 18:19 UTC (permalink / raw)
To: Jacob Wen; +Cc: Linux Kernel Network Developers, John Fastabend
On Sun, Jun 9, 2019 at 11:41 PM Jacob Wen <jian.w.wen@oracle.com> wrote:
>
> It may return NULL thus we can't ignore it.
How is this possible? All of the callers should have validated
the 'cl' before calling this, for example by calling ->find().
I don't see it is possible to be NULL at this point.
Did you see a real crash? If so, please put the full stack trace
in your changelog.
Thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] net_sched: sch_mqprio: handle return value of mqprio_queue_get
2019-06-10 18:19 ` Cong Wang
@ 2019-06-11 0:27 ` Jacob Wen
0 siblings, 0 replies; 5+ messages in thread
From: Jacob Wen @ 2019-06-11 0:27 UTC (permalink / raw)
To: Cong Wang; +Cc: Linux Kernel Network Developers
Hi Cong,
This was detected by a tool.
Thanks for the review :)
I will abandon the patch.
On 6/11/19 2:19 AM, Cong Wang wrote:
> On Sun, Jun 9, 2019 at 11:41 PM Jacob Wen <jian.w.wen@oracle.com> wrote:
>> It may return NULL thus we can't ignore it.
> How is this possible? All of the callers should have validated
> the 'cl' before calling this, for example by calling ->find().
>
> I don't see it is possible to be NULL at this point.
>
> Did you see a real crash? If so, please put the full stack trace
> in your changelog.
>
> Thanks!
^ permalink raw reply [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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.