diff options
| author | Dan Carpenter <dan.carpenter@oracle.com> | 2018-09-22 16:46:48 +0300 |
|---|---|---|
| committer | Ben Hutchings <ben@decadent.org.uk> | 2018-12-16 22:09:32 +0000 |
| commit | a25d12961a5f2543c9a9185df8af5d1ab1cf1cce (patch) | |
| tree | 1808a74c3a13a7d540b1418eb7befb245f6a33d2 | |
| parent | 42695dbe46603e2899db34bb8fc900b575c68332 (diff) | |
| download | linux-a25d12961a5f2543c9a9185df8af5d1ab1cf1cce.tar.gz linux-a25d12961a5f2543c9a9185df8af5d1ab1cf1cce.tar.bz2 linux-a25d12961a5f2543c9a9185df8af5d1ab1cf1cce.zip | |
net: sched: act_ipt: check for underflow in __tcf_ipt_init()
commit aeadd93f2b0a609f603ac33e574b97a9832d1b90 upstream.
If "td->u.target_size" is larger than sizeof(struct xt_entry_target) we
return -EINVAL. But we don't check whether it's smaller than
sizeof(struct xt_entry_target) and that could lead to an out of bounds
read.
Fixes: 7ba699c604ab ("[NET_SCHED]: Convert actions from rtnetlink to new netlink API")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
| -rw-r--r-- | net/sched/act_ipt.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index 8a64a0734aee..745d3071855e 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c @@ -107,7 +107,7 @@ static int tcf_ipt_init(struct net *net, struct nlattr *nla, struct nlattr *est, return -EINVAL; td = (struct xt_entry_target *)nla_data(tb[TCA_IPT_TARG]); - if (nla_len(tb[TCA_IPT_TARG]) < td->u.target_size) + if (nla_len(tb[TCA_IPT_TARG]) != td->u.target_size) return -EINVAL; if (tb[TCA_IPT_INDEX] != NULL) |
