]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
net sched actions: fix refcnt leak in skbmod
authorRoman Mashak <mrv@mojatatu.com>
Fri, 11 May 2018 18:35:33 +0000 (14:35 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 14 Aug 2018 10:26:34 +0000 (12:26 +0200)
commit909f549179273096383069c1eaf919a5d56e637e
tree882998c8ddbe4171c5a6edb697bf017a32e48e04
parent8b5ea76909f757ebd5b171476c3a38a70e6d566a
net sched actions: fix refcnt leak in skbmod

BugLink: http://bugs.launchpad.net/bugs/1780858
[ Upstream commit a52956dfc503f8cc5cfe6454959b7049fddb4413 ]

When application fails to pass flags in netlink TLV when replacing
existing skbmod action, the kernel will leak refcnt:

$ tc actions get action skbmod index 1
total acts 0

        action order 0: skbmod pipe set smac 00:11:22:33:44:55
         index 1 ref 1 bind 0

For example, at this point a buggy application replaces the action with
index 1 with new smac 00:aa:22:33:44:55, it fails because of zero flags,
however refcnt gets bumped:

$ tc actions get actions skbmod index 1
total acts 0

        action order 0: skbmod pipe set smac 00:11:22:33:44:55
         index 1 ref 2 bind 0
$

Tha patch fixes this by calling tcf_idr_release() on existing actions.

Fixes: 86da71b57383d ("net_sched: Introduce skbmod action")
Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/sched/act_skbmod.c