Skip to content

Commit c2e1cfe

Browse files
HBh25Ykuba-moo
authored andcommitted
net: sched: fix possible refcount leak in tc_new_tfilter()
tfilter_put need to be called to put the refount got by tp->ops->get to avoid possible refcount leak when chain->tmplt_ops != NULL and chain->tmplt_ops != tp->ops. Fixes: 7d5509f ("net: sched: extend proto ops with 'put' callback") Signed-off-by: Hangyu Hua <[email protected]> Reviewed-by: Vlad Buslov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 878e240 commit c2e1cfe

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/sched/cls_api.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2137,6 +2137,7 @@ static int tc_new_tfilter(struct sk_buff *skb, struct nlmsghdr *n,
21372137
}
21382138

21392139
if (chain->tmplt_ops && chain->tmplt_ops != tp->ops) {
2140+
tfilter_put(tp, fh);
21402141
NL_SET_ERR_MSG(extack, "Chain template is set to a different filter kind");
21412142
err = -EINVAL;
21422143
goto errout;

0 commit comments

Comments
 (0)