From: Andre Guedes <andre.guedes@intel.com>
To: netdev@vger.kernel.org
Cc: vinicius.gomes@intel.com
Subject: [PATCH 3/5] net: sched: taprio: Fix null pointer deref bug
Date: Fri, 19 Apr 2019 17:00:50 -0700 [thread overview]
Message-ID: <20190420000052.4242-4-andre.guedes@intel.com> (raw)
In-Reply-To: <20190420000052.4242-1-andre.guedes@intel.com>
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@intel.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
next prev parent reply other threads:[~2019-04-20 1:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-20 0:00 [PATCH 0/5] Taprio qdisc fixes Andre Guedes
2019-04-20 0:00 ` [PATCH 1/5] net: sched: taprio: Remove pointless variable assigment Andre Guedes
2019-04-20 0:00 ` [PATCH 2/5] net: sched: taprio: Refactor taprio_get_start_time() Andre Guedes
2019-04-20 0:00 ` Andre Guedes [this message]
2019-04-22 18:04 ` [PATCH 3/5] net: sched: taprio: Fix null pointer deref bug Cong Wang
2019-04-22 18:07 ` Cong Wang
2019-04-22 19:21 ` Guedes, Andre
2019-04-22 19:36 ` Cong Wang
2019-04-23 19:21 ` Guedes, Andre
2019-04-23 19:24 ` Cong Wang
2019-04-20 0:00 ` [PATCH 4/5] net: sched: taprio: Fix taprio_peek() Andre Guedes
2019-04-20 0:00 ` [PATCH 5/5] net: sched: taprio: Fix taprio_dequeue() Andre Guedes
2019-04-21 3:46 ` [PATCH 0/5] Taprio qdisc fixes David Miller
2019-04-22 19:18 ` Guedes, Andre
2019-04-23 4:21 ` David Miller
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=20190420000052.4242-4-andre.guedes@intel.com \
--to=andre.guedes@intel.com \
--cc=netdev@vger.kernel.org \
--cc=vinicius.gomes@intel.com \
/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 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.