In the Linux kernel, the following vulnerability has been resolved:
net: sched: fix memory leak in tcindex_set_parms
Kernel uses tcindex_change() to change an existing filter properties.
Yet the problem is that, during the process of changing,
if old_r is retrieved from p->perfect, then
kernel uses tcindex_alloc_perfect_hash() to newly
allocate filter results, uses tcindex_filter_result_init()
to clear the old filter result, without destroying
its tcf_exts structure, which triggers the above memory leak.
To be more specific, there are only two source for the old_r,
according to the tcindex_lookup(). old_r is retrieved from
p->perfect, or old_r is retrieved from p->h.
If old_r is retrieved from p->perfect, kernel uses
tcindex_alloc_perfect_hash() to newly allocate the
filter results. Then r is assigned with cp->perfect + handle,
which is newly allocated. So condition old_r && old_r != r is
true in this situation, and kernel uses tcindex_filter_result_init()
to clear the old filter result, without destroying
its tcf_exts structure
If old_r is retrieved from p->h, then p->perfect is NULL
according to the tcindex_lookup(). Considering that cp->h
is directly copied from p->h and p->perfect is NULL,
r is assigned with tcindex_lookup(cp, handle), whose value
should be the same as old_r, so condition old_r && old_r != r
is false in this situation, kernel ignores using
tcindex_filter_result_init() to clear the old filter result.
So only when old_r is retrieved from p->perfect does kernel use
tcindex_filter_result_init() to clear the old filter result, which
triggers the above memory leak.
Considering that there already exists a tc_filter_wq workqueue to destroy the old tcindex_d ---truncated---
Exploitability
AV:LAC:LPR:LUI:NScope
S:UImpact
C:NI:NA:H5.5/CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H