mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
netfilter: nfnl_cthelper: apply per-class values when updating policies
commitd738feccb9upstream. When a userspace conntrack helper with multiple expectation classes is updated via nfnetlink, every class ends up with the first class's max_expected and timeout values. nfnl_cthelper_update_policy_all() validates each new policy into the corresponding slot of the temporary new_policy array, but the second loop that commits the values into the live helper dereferences new_policy as a pointer instead of indexing it, so every iteration reads new_policy[0] regardless of i. An update that changes per-class values is silently collapsed onto class 0's values with no error returned to userspace. Index the temporary array by i in the commit loop so each class gets its own validated values. Fixes:2c42225755("netfilter: nfnl_cthelper: fix runtime expectation policy updates") Cc: stable@vger.kernel.org Signed-off-by: David Carlier <devnexen@gmail.com> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2b70f61f56
commit
893319e995
@@ -348,8 +348,8 @@ static int nfnl_cthelper_update_policy_all(struct nlattr *tb[],
|
||||
for (i = 0; i < helper->expect_class_max + 1; i++) {
|
||||
policy = (struct nf_conntrack_expect_policy *)
|
||||
&helper->expect_policy[i];
|
||||
policy->max_expected = new_policy->max_expected;
|
||||
policy->timeout = new_policy->timeout;
|
||||
policy->max_expected = new_policy[i].max_expected;
|
||||
policy->timeout = new_policy[i].timeout;
|
||||
}
|
||||
|
||||
err:
|
||||
|
||||
Reference in New Issue
Block a user