[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190420000052.4242-4-andre.guedes@intel.com>
Date: Fri, 19 Apr 2019 17:00:50 -0700
From: Andre Guedes <andre.guedes@...el.com>
To: netdev@...r.kernel.org
Cc: vinicius.gomes@...el.com
Subject: [PATCH 3/5] net: sched: taprio: Fix null pointer deref bug
If 'entry' is NULL we WARN_ON() but dereference the pointer anyway,
generating a null pointer dereference bug. This patch fixes should_
restart_cycle() so we return if the pointer is NULL.
Fixes: 5a781ccbd19e (“tc: Add support for configuring the taprio scheduler”)
Signed-off-by: Andre Guedes <andre.guedes@...el.com>
---
net/sched/sch_taprio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index f7139e6179b6..1671510c187f 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -204,7 +204,8 @@ static struct sk_buff *taprio_dequeue(struct Qdisc *sch)
static bool should_restart_cycle(const struct taprio_sched *q,
const struct sched_entry *entry)
{
- WARN_ON(!entry);
+ if (WARN_ON(!entry))
+ return false;
return list_is_last(&entry->list, &q->entries);
}
--
2.21.0
Powered by blists - more mailing lists