Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp12324807rwd; Fri, 23 Jun 2023 04:45:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ678tE8ImBkPqCMLd93EqnTgIOjFzwr+l2y7e63v60gzB8rZL+sEgjflEITg78/oBSkNwHK X-Received: by 2002:a17:902:e541:b0:1b6:76ee:190b with SMTP id n1-20020a170902e54100b001b676ee190bmr14409667plf.35.1687520748269; Fri, 23 Jun 2023 04:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687520748; cv=none; d=google.com; s=arc-20160816; b=k3G80nykFMyZ5g0cBKB5kVjXFChfzpw6OF68FtfDQeSe7388pkAu8bjHRrelKAAOES DTyI1iLOl7Q00x2zmugnOIGc13Lsao5eK93w3Sq+emkALP9bt7FU6OKC3NgLkW50uxqU uShOUYLp6UyZAD96t6vigTFYlf8gl/M89BbQVzqeDNW10cnKIink55OUODtgFhhvzHNr biiS4iToljqT/xiGEwo9gA2m0Z+wvDoqrg+G5gGvhimuVasSJQAcSsnXD92i5IFV3hrF rb04PyxTyCvtGcpxAHSSDpjOSh1ER6Z4Q9Cc7suVWxZf5dsfuuQaP2cQMVPD0kMhlg33 vEwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature:dkim-filter; bh=kIEjeLlwMyGE/F2FO5BfREgq/lnS99K0Zaa4Lod/2nY=; b=Bwnz+G2w4Fn6QP4kjnoZqPzaFuix9uM74AtHoXYth0lPeVgwPc+igk7n9UaS552591 djWVhW0x/z9U3n2qq0NL8Wed4ND9HV+xplmkI6MphM2z97HMiuq8U89/RvthfwuKDnVD TaOxXqOP+262cNMfkGGtl5hcIXivBp10aWyNT2WeGbJD2Ia8n6TwJo7dwJJCpjXiU8Ek 3pVzWyv4U4LNfYfhzUizDXEpAUHkVK0WTkuiKYjaXUgfitCYJ6e4fWD8QGYR7imJKijM fX9UL6CfsCO25ubTx8tLPiNzWsQEumH8iOVN/PKM33Ksle9GlY1amEOeqj2qmm2r8mLy 11XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infotecs.ru header.s=mx header.b=qpxoJe2b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=infotecs.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kn7-20020a170903078700b001b55cebc1d4si8062717plb.120.2023.06.23.04.45.35; Fri, 23 Jun 2023 04:45:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infotecs.ru header.s=mx header.b=qpxoJe2b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=infotecs.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230270AbjFWLXw (ORCPT + 99 others); Fri, 23 Jun 2023 07:23:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbjFWLXv (ORCPT ); Fri, 23 Jun 2023 07:23:51 -0400 Received: from mx0.infotecs.ru (mx0.infotecs.ru [91.244.183.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1323D1739; Fri, 23 Jun 2023 04:23:49 -0700 (PDT) Received: from mx0.infotecs-nt (localhost [127.0.0.1]) by mx0.infotecs.ru (Postfix) with ESMTP id 1178A110A562; Fri, 23 Jun 2023 14:23:47 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx0.infotecs.ru 1178A110A562 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=infotecs.ru; s=mx; t=1687519427; bh=kIEjeLlwMyGE/F2FO5BfREgq/lnS99K0Zaa4Lod/2nY=; h=From:To:CC:Subject:Date:From; b=qpxoJe2b/id7wbMIsRr4KeQdxLDYmXrDXbGiC6yBrxGnm4uuRjXR4Lmpyt28kt9nZ mbCwcL1afIAw0A9gmsOie/Ou4K/W8EtbyEiGWbPrC4Ctoc9UhJIul4PWjWLhREMl6K oh49fI2zqizyqTFnATQj5e4YRJ/No4UV/jY0pg+0= Received: from msk-exch-01.infotecs-nt (msk-exch-01.infotecs-nt [10.0.7.191]) by mx0.infotecs-nt (Postfix) with ESMTP id 0DFC430CDD64; Fri, 23 Jun 2023 14:23:47 +0300 (MSK) From: Gavrilov Ilia To: Pablo Neira Ayuso CC: Gavrilov Ilia , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Patrick McHardy , "netfilter-devel@vger.kernel.org" , "coreteam@netfilter.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "lvc-project@linuxtesting.org" , Simon Horman Subject: [PATCH net] netfilter: nf_conntrack_sip: fix the ct_sip_parse_numerical_param() return value. Thread-Topic: [PATCH net] netfilter: nf_conntrack_sip: fix the ct_sip_parse_numerical_param() return value. Thread-Index: AQHZpcUtMQS/azgYmUuZ/5v6pmZwlQ== Date: Fri, 23 Jun 2023 11:23:46 +0000 Message-ID: <20230623112247.1468836-1-Ilia.Gavrilov@infotecs.ru> Accept-Language: ru-RU, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.17.0.10] x-exclaimer-md-config: 208ac3cd-1ed4-4982-a353-bdefac89ac0a Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-KLMS-Rule-ID: 1 X-KLMS-Message-Action: clean X-KLMS-AntiSpam-Lua-Profiles: 178208 [Jun 23 2023] X-KLMS-AntiSpam-Version: 5.9.59.0 X-KLMS-AntiSpam-Envelope-From: Ilia.Gavrilov@infotecs.ru X-KLMS-AntiSpam-Rate: 0 X-KLMS-AntiSpam-Status: not_detected X-KLMS-AntiSpam-Method: none X-KLMS-AntiSpam-Auth: dkim=none X-KLMS-AntiSpam-Info: LuaCore: 517 517 b0056c19d8e10afbb16cb7aad7258dedb0179a79, {Tracking_uf_ne_domains}, {Tracking_from_domain_doesnt_match_to}, lore.kernel.org:7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;127.0.0.199:7.1.2;infotecs.ru:7.1.1, FromAlignment: s X-MS-Exchange-Organization-SCL: -1 X-KLMS-AntiSpam-Interceptor-Info: scan successful X-KLMS-AntiPhishing: Clean, bases: 2023/06/23 08:19:00 X-KLMS-AntiVirus: Kaspersky Security for Linux Mail Server, version 8.0.3.30, bases: 2023/06/23 08:45:00 #21561595 X-KLMS-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Ilia.Gavrilov" 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 expe= ctations") Reviewed-by: Simon Horman Signed-off-by: Ilia.Gavrilov --- - Fix description - Repost according https://lore.kernel.org/all/20230622144325.GC29784@breakpoint.cc/ net/netfilter/nf_conntrack_sip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_= sip.c index 77f5e82d8e3f..d0eac27f6ba0 100644 --- a/net/netfilter/nf_conntrack_sip.c +++ b/net/netfilter/nf_conntrack_sip.c @@ -611,7 +611,7 @@ int ct_sip_parse_numerical_param(const struct nf_conn *= ct, const char *dptr, start +=3D strlen(name); *val =3D simple_strtoul(start, &end, 0); if (start =3D=3D end) - return 0; + return -1; if (matchoff && matchlen) { *matchoff =3D start - dptr; *matchlen =3D end - start; --=20 2.39.2