[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1525417505-19056-1-git-send-email-wang6495@umn.edu>
Date: Fri, 4 May 2018 02:05:05 -0500
From: Wenwen Wang <wang6495@....edu>
To: Wenwen Wang <wang6495@....edu>
Cc: Kangjie Lu <kjlu@....edu>, Jamal Hadi Salim <jhs@...atatu.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Jiri Pirko <jiri@...nulli.us>,
"David S. Miller" <davem@...emloft.net>,
netdev@...r.kernel.org (open list:TC subsystem),
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH] net: sched: cls: fix a potential missing-check bug
In rsvp_change(), the value of f->res.classid is checked to be no more
than 255. Otherwise, the execution will goto errout. This is enforced by a
if-statement check. However, in the following execution, f->res.classid is
assigned with a new value returned from gen_tunnel(), and the new value
is only checked against 0. Given that gen_tunnel() may return a value
larger than 255 based on data, the new value of f->res.classid should
be re-checked.
This patch adds a re-check to ensure the new value of f->res.classid is not
great than 255; otherwise, an error code will be returned.
Signed-off-by: Wenwen Wang <wang6495@....edu>
---
net/sched/cls_rsvp.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h
index 4f12976..7ced8fc 100644
--- a/net/sched/cls_rsvp.h
+++ b/net/sched/cls_rsvp.h
@@ -590,6 +590,9 @@ static int rsvp_change(struct net *net, struct sk_buff *in_skb,
if (f->res.classid == 0 &&
(f->res.classid = gen_tunnel(data)) == 0)
goto errout;
+
+ if (f->res.classid > 255)
+ goto errout;
}
for (sp = &data->ht[h1];
--
2.7.4
Powered by blists - more mailing lists