[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161127155815.10359-1-amir@vadai.me>
Date: Sun, 27 Nov 2016 17:58:15 +0200
From: Amir Vadai <amir@...ai.me>
To: "David S. Miller" <davem@...emloft.net>
Cc: netdev@...r.kernel.org, Jamal Hadi Salim <jhs@...atatu.com>,
Or Gerlitz <ogerlitz@...lanox.com>,
Hadar Har-Zion <hadarh@...lanox.com>,
Jiri Pirko <jiri@...lanox.com>, Amir Vadai <amir@...ai.me>
Subject: [PATCH net] net/sched: act_pedit: limit negative offset
Should not allow setting a negative offset that goes below the skb head.
Signed-off-by: Amir Vadai <amir@...ai.me>
---
Hi Dave,
Please pull to -stable branches.
Thanks,
Amir
net/sched/act_pedit.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index b54d56d4959b..e79e8a88f2d2 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -154,8 +154,11 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
}
ptr = skb_header_pointer(skb, off + offset, 4, &_data);
- if (!ptr)
+ if ((unsigned char *)ptr < skb->head) {
+ pr_info("tc filter pedit offset out of bounds\n");
goto bad;
+ }
+
/* just do it, baby */
*ptr = ((*ptr & tkey->mask) ^ tkey->val);
if (ptr == &_data)
--
2.10.2
Powered by blists - more mailing lists