Skip to content

Commit 44f8baa

Browse files
HBh25Ydavem330
authored andcommitted
net: sched: fix possible refcount leak in tc_chain_tmplt_add()
try_module_get will be called in tcf_proto_lookup_ops. So module_put needs to be called to drop the refcount if ops don't implement the required function. Fixes: 9f407f1 ("net: sched: introduce chain templates") Signed-off-by: Hangyu Hua <hbh25y@gmail.com> Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 682881e commit 44f8baa

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

net/sched/cls_api.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2950,6 +2950,7 @@ static int tc_chain_tmplt_add(struct tcf_chain *chain, struct net *net,
29502950
return PTR_ERR(ops);
29512951
if (!ops->tmplt_create || !ops->tmplt_destroy || !ops->tmplt_dump) {
29522952
NL_SET_ERR_MSG(extack, "Chain templates are not supported with specified classifier");
2953+
module_put(ops->owner);
29532954
return -EOPNOTSUPP;
29542955
}
29552956

0 commit comments

Comments
 (0)