Merge branch 'net-sched-bind-logic-fixes-for-cls_fw-cls_u32-and-cls_route'
valis says: ==================== net/sched Bind logic fixes for cls_fw, cls_u32 and cls_route Three classifiers (cls_fw, cls_u32 and cls_route) always copy tcf_result struct into the new instance of the filter on update. This causes a problem when updating a filter bound to a class, as tcf_unbind_filter() is always called on the old instance in the success path, decreasing filter_cnt of the still referenced class and allowing it to be deleted, leading to a use-after-free. This patch set fixes this issue in all affected classifiers by no longer copying the tcf_result struct from the old filter. ==================== Link: https://lore.kernel.org/r/20230729123202.72406-1-jhs@mojatatu.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
c5ccff7050
|
@ -267,7 +267,6 @@ static int fw_change(struct net *net, struct sk_buff *in_skb,
|
|||
return -ENOBUFS;
|
||||
|
||||
fnew->id = f->id;
|
||||
fnew->res = f->res;
|
||||
fnew->ifindex = f->ifindex;
|
||||
fnew->tp = f->tp;
|
||||
|
||||
|
|
|
@ -513,7 +513,6 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,
|
|||
if (fold) {
|
||||
f->id = fold->id;
|
||||
f->iif = fold->iif;
|
||||
f->res = fold->res;
|
||||
f->handle = fold->handle;
|
||||
|
||||
f->tp = fold->tp;
|
||||
|
|
|
@ -826,7 +826,6 @@ static struct tc_u_knode *u32_init_knode(struct net *net, struct tcf_proto *tp,
|
|||
|
||||
new->ifindex = n->ifindex;
|
||||
new->fshift = n->fshift;
|
||||
new->res = n->res;
|
||||
new->flags = n->flags;
|
||||
RCU_INIT_POINTER(new->ht_down, ht);
|
||||
|
||||
|
|
Loading…
Reference in New Issue