Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 335ae30a authored by Ilia.Gavrilov's avatar Ilia.Gavrilov Committed by Greg Kroah-Hartman
Browse files

netfilter: nf_conntrack_sip: fix the ct_sip_parse_numerical_param() return value.



[ 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: 0f32a40f ("[NETFILTER]: nf_conntrack_sip: create signalling expectations")
Signed-off-by: default avatarIlia.Gavrilov <Ilia.Gavrilov@infotecs.ru>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Reviewed-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent d624b93f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -605,7 +605,7 @@ int ct_sip_parse_numerical_param(const struct nf_conn *ct, const char *dptr,
	start += strlen(name);
	*val = simple_strtoul(start, &end, 0);
	if (start == end)
		return 0;
		return -1;
	if (matchoff && matchlen) {
		*matchoff = start - dptr;
		*matchlen = end - start;