Skip to content

Commit c5ccff7

Browse files
committed
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/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 611e1b0 + b80b829 commit c5ccff7

File tree

3 files changed

+0
-3
lines changed

3 files changed

+0
-3
lines changed

net/sched/cls_fw.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ static int fw_change(struct net *net, struct sk_buff *in_skb,
267267
return -ENOBUFS;
268268

269269
fnew->id = f->id;
270-
fnew->res = f->res;
271270
fnew->ifindex = f->ifindex;
272271
fnew->tp = f->tp;
273272

net/sched/cls_route.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,6 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,
513513
if (fold) {
514514
f->id = fold->id;
515515
f->iif = fold->iif;
516-
f->res = fold->res;
517516
f->handle = fold->handle;
518517

519518
f->tp = fold->tp;

net/sched/cls_u32.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,6 @@ static struct tc_u_knode *u32_init_knode(struct net *net, struct tcf_proto *tp,
826826

827827
new->ifindex = n->ifindex;
828828
new->fshift = n->fshift;
829-
new->res = n->res;
830829
new->flags = n->flags;
831830
RCU_INIT_POINTER(new->ht_down, ht);
832831

0 commit comments

Comments
 (0)