mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-27 22:24:11 +08:00
Merge branch 'cls_drop-fix'
Jamal Hadi Salim says: ==================== net: dont intepret cls results when asked to drop It is possible that an error in processing may occur in tcf_classify() which will result in res.classid being some garbage value. Example of such a code path is when the classifier goes into a loop due to bad policy. See patch 1/2 for a sample splat. While the core code reacts correctly and asks the caller to drop the packet (by returning TC_ACT_SHOT) some callers first intepret the res.class as a pointer to memory and end up dropping the packet only after some activity with the pointer. There is likelihood of this resulting in an exploit. So lets fix all the known qdiscs that behave this way. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
819fcf4adf
@ -393,10 +393,13 @@ static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
||||
result = tcf_classify(skb, NULL, fl, &res, true);
|
||||
if (result < 0)
|
||||
continue;
|
||||
if (result == TC_ACT_SHOT)
|
||||
goto done;
|
||||
|
||||
flow = (struct atm_flow_data *)res.class;
|
||||
if (!flow)
|
||||
flow = lookup_flow(sch, res.classid);
|
||||
goto done;
|
||||
goto drop;
|
||||
}
|
||||
}
|
||||
flow = NULL;
|
||||
|
@ -230,6 +230,8 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
|
||||
result = tcf_classify(skb, NULL, fl, &res, true);
|
||||
if (!fl || result < 0)
|
||||
goto fallback;
|
||||
if (result == TC_ACT_SHOT)
|
||||
return NULL;
|
||||
|
||||
cl = (void *)res.class;
|
||||
if (!cl) {
|
||||
@ -250,8 +252,6 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
|
||||
case TC_ACT_TRAP:
|
||||
*qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
|
||||
fallthrough;
|
||||
case TC_ACT_SHOT:
|
||||
return NULL;
|
||||
case TC_ACT_RECLASSIFY:
|
||||
return cbq_reclassify(skb, cl);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user