[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1617114468-2928-1-git-send-email-wangyunjian@huawei.com>
Date: Tue, 30 Mar 2021 22:27:48 +0800
From: wangyunjian <wangyunjian@...wei.com>
To: <netdev@...r.kernel.org>
CC: <kuba@...nel.org>, <xiyou.wangcong@...il.com>, <jhs@...atatu.com>,
<jiri@...nulli.us>, <chenchanghu@...wei.com>,
Yunjian Wang <wangyunjian@...wei.com>
Subject: [PATCH net] sch_htb: fix null pointer dereference on a null new_q
From: Yunjian Wang <wangyunjian@...wei.com>
sch_htb: fix null pointer dereference on a null new_q
Currently if new_q is null, the null new_q pointer will be
dereference when 'q->offload' is true. Fix this by adding
a braces around htb_parent_to_leaf_offload() to avoid it.
Addresses-Coverity: ("Dereference after null check")
Fixes: d03b195b5aa0 ("sch_htb: Hierarchical QoS hardware offload")
Signed-off-by: Yunjian Wang <wangyunjian@...wei.com>
---
net/sched/sch_htb.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 62e12cb41a3e..081c11d5717c 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1675,9 +1675,10 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg,
cl->parent->common.classid,
NULL);
if (q->offload) {
- if (new_q)
+ if (new_q) {
htb_set_lockdep_class_child(new_q);
- htb_parent_to_leaf_offload(sch, dev_queue, new_q);
+ htb_parent_to_leaf_offload(sch, dev_queue, new_q);
+ }
}
}
--
2.23.0
Powered by blists - more mailing lists