]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
net/sched: don't dereference a->goto_chain to read the chain index
authorDavide Caratti <dcaratti@redhat.com>
Wed, 20 Mar 2019 14:00:15 +0000 (15:00 +0100)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit355aa7093df7a53ba948c312288bfa7b0f1efec1
treeaf4fbe63b52393badb5d2716cd51e0226f63ca8f
parent4897958f279ae2b13ceb1b00ef12c93ebfd67ed0
net/sched: don't dereference a->goto_chain to read the chain index

BugLink: https://bugs.launchpad.net/bugs/1838459
[ Upstream commit fe384e2fa36ca084a456fd30558cccc75b4b3fbd ]

callers of tcf_gact_goto_chain_index() can potentially read an old value
of the chain index, or even dereference a NULL 'goto_chain' pointer,
because 'goto_chain' and 'tcfa_action' are read in the traffic path
without caring of concurrent write in the control path. The most recent
value of chain index can be read also from a->tcfa_action (it's encoded
there together with TC_ACT_GOTO_CHAIN bits), so we don't really need to
dereference 'goto_chain': just read the chain id from the control action.

Fixes: e457d86ada27 ("net: sched: add couple of goto_chain helpers")
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
include/net/tc_act/tc_gact.h