Skip to content

Commit 338469d

Browse files
tammeladavem330
authored andcommitted
net/sched: clear actions pointer in miss cookie init fail
Palash reports a UAF when using a modified version of syzkaller[1]. When 'tcf_exts_miss_cookie_base_alloc()' fails in 'tcf_exts_init_ex()' a call to 'tcf_exts_destroy()' is made to free up the tcf_exts resources. In flower, a call to '__fl_put()' when 'tcf_exts_init_ex()' fails is made; Then calling 'tcf_exts_destroy()', which triggers an UAF since the already freed tcf_exts action pointer is lingering in the struct. Before the offending patch, this was not an issue since there was no case where the tcf_exts action pointer could linger. Therefore, restore the old semantic by clearing the action pointer in case of a failure to initialize the miss_cookie. [1] https://github.com/cmu-pasta/linux-kernel-enriched-corpus v1->v2: Fix compilation on configs without tc actions (kernel test robot) Fixes: 80cd22c ("net/sched: cls_api: Support hardware miss to tc action") Reported-by: Palash Oswal <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Signed-off-by: Pedro Tammela <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a80bb8e commit 338469d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/sched/cls_api.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3235,6 +3235,9 @@ int tcf_exts_init_ex(struct tcf_exts *exts, struct net *net, int action,
32353235

32363236
err_miss_alloc:
32373237
tcf_exts_destroy(exts);
3238+
#ifdef CONFIG_NET_CLS_ACT
3239+
exts->actions = NULL;
3240+
#endif
32383241
return err;
32393242
}
32403243
EXPORT_SYMBOL(tcf_exts_init_ex);

0 commit comments

Comments
 (0)