]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
netfilter: nf_conntrack_sip: fix the ct_sip_parse_numerical_param() return value.
authorIlia.Gavrilov <Ilia.Gavrilov@infotecs.ru>
Fri, 23 Jun 2023 11:23:46 +0000 (11:23 +0000)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Mon, 2 Oct 2023 15:19:38 +0000 (17:19 +0200)
commitc151202f3a417f853bce7ddcdb4c2e28ef2b5bcc
tree2b7a79b7f9b8973763e319c7f35653d9e3154179
parent6973c8cf6cd2096a0f5e28fef7d4f39c454ddf53
netfilter: nf_conntrack_sip: fix the ct_sip_parse_numerical_param() return value.

BugLink: https://bugs.launchpad.net/bugs/2034469
[ Upstream commit f188d30087480eab421cd8ca552fb15f55d57f4d ]

ct_sip_parse_numerical_param() returns only 0 or 1 now.
But process_register_request() and process_register_response() imply
checking for a negative value if parsing of a numerical header parameter
failed.
The invocation in nf_nat_sip() looks correct:
  if (ct_sip_parse_numerical_param(...) > 0 &&
      ...) { ... }

Make the return value of the function ct_sip_parse_numerical_param()
a tristate to fix all the cases
a) return 1 if value is found; *val is set
b) return 0 if value is not found; *val is unchanged
c) return -1 on error; *val is undefined

Found by InfoTeCS on behalf of Linux Verification Center
(linuxtesting.org) with SVACE.

Fixes: 0f32a40fc91a ("[NETFILTER]: nf_conntrack_sip: create signalling expectations")
Signed-off-by: Ilia.Gavrilov <Ilia.Gavrilov@infotecs.ru>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
net/netfilter/nf_conntrack_sip.c