diff mbox

mqprio: Avoid panic if no options are provided

Message ID 1324555507-10148-1-git-send-email-tgraf@redhat.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Thomas Graf Dec. 22, 2011, 12:05 p.m. UTC
Userspace may not provide TCA_OPTIONS, in fact tc currently does
so not do so if no arguments are specified on the command line.
Return EINVAL instead of panicing.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
---
 net/sched/sch_mqprio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

David Miller Dec. 23, 2011, 3:39 a.m. UTC | #1
From: Thomas Graf <tgraf@redhat.com>
Date: Thu, 22 Dec 2011 13:05:07 +0100

> Userspace may not provide TCA_OPTIONS, in fact tc currently does
> so not do so if no arguments are specified on the command line.
> Return EINVAL instead of panicing.
> 
> Signed-off-by: Thomas Graf <tgraf@redhat.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c
index f88256c..28de430 100644
--- a/net/sched/sch_mqprio.c
+++ b/net/sched/sch_mqprio.c
@@ -107,7 +107,7 @@  static int mqprio_init(struct Qdisc *sch, struct nlattr *opt)
 	if (!netif_is_multiqueue(dev))
 		return -EOPNOTSUPP;
 
-	if (nla_len(opt) < sizeof(*qopt))
+	if (!opt || nla_len(opt) < sizeof(*qopt))
 		return -EINVAL;
 
 	qopt = nla_data(opt);