Skip to content

Commit 2cc8a00

Browse files
Ivan Vecerakuba-moo
authored andcommitted
net/sched: cls_api: Initialize miss_cookie_node when action miss is not used
Function tcf_exts_init_ex() sets exts->miss_cookie_node ptr only when use_action_miss is true so it assumes in other case that the field is set to NULL by the caller. If not then the field contains garbage and subsequent tcf_exts_destroy() call results in a crash. Ensure that the field .miss_cookie_node pointer is NULL when use_action_miss parameter is false to avoid this potential scenario. Fixes: 80cd22c ("net/sched: cls_api: Support hardware miss to tc action") Signed-off-by: Ivan Vecera <[email protected]> Reviewed-by: Pedro Tammela <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 7041101 commit 2cc8a00

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
@@ -3211,6 +3211,7 @@ int tcf_exts_init_ex(struct tcf_exts *exts, struct net *net, int action,
32113211
#ifdef CONFIG_NET_CLS_ACT
32123212
exts->type = 0;
32133213
exts->nr_actions = 0;
3214+
exts->miss_cookie_node = NULL;
32143215
/* Note: we do not own yet a reference on net.
32153216
* This reference might be taken later from tcf_exts_get_net().
32163217
*/

0 commit comments

Comments
 (0)