提交 4e18b3ed 编写于 作者: D Dan Carpenter 提交者: David S. Miller

cls_u32: signedness bug

skb_headroom() is unsigned so "skb_headroom(skb) + toff" is also
unsigned and can't be less than zero.  This test was added in 66d50d25:
"u32: negative offset fix"  It was supposed to fix a regression.
Signed-off-by: NDan Carpenter <error27@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 51e97a12
...@@ -137,7 +137,7 @@ static int u32_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_re ...@@ -137,7 +137,7 @@ static int u32_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_re
int toff = off + key->off + (off2 & key->offmask); int toff = off + key->off + (off2 & key->offmask);
__be32 *data, _data; __be32 *data, _data;
if (skb_headroom(skb) + toff < 0) if (skb_headroom(skb) + toff > INT_MAX)
goto out; goto out;
data = skb_header_pointer(skb, toff, 4, &_data); data = skb_header_pointer(skb, toff, 4, &_data);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册