netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mqprio: Avoid panic if no options are provided
@ 2011-12-22 12:05 Thomas Graf
  2011-12-23  3:39 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Graf @ 2011-12-22 12:05 UTC (permalink / raw)
  To: davem; +Cc: netdev, john.r.fastabend, Thomas Graf

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(-)

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);
-- 
1.7.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mqprio: Avoid panic if no options are provided
  2011-12-22 12:05 [PATCH] mqprio: Avoid panic if no options are provided Thomas Graf
@ 2011-12-23  3:39 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-12-23  3:39 UTC (permalink / raw)
  To: tgraf; +Cc: netdev, john.r.fastabend

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-23  3:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-22 12:05 [PATCH] mqprio: Avoid panic if no options are provided Thomas Graf
2011-12-23  3:39 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).