From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B67A5C31E45 for ; Thu, 13 Jun 2019 16:01:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7FCAD20679 for ; Thu, 13 Jun 2019 16:01:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560441689; bh=7IybN8Nha+uXU8W7xnlveY2BYrbSDvSR5HmEzqawZPI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=csQvgsMQRj99IxoY27SeXzoP8NjPV7XUK14ivqSHD5sIGJkJfxWHoY7X9SiuFchM2 kN3fVezWF2xjonwOGrueOxwhzpR0eGpub7u1ChZXPP5AbbSEDvAYRNKOHfKn0ye7U2 yrFXOmgFD06cQ4CIk5lP/XgJh2twFnsF2QziTTdA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732004AbfFMQB2 (ORCPT ); Thu, 13 Jun 2019 12:01:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:36454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731440AbfFMIsd (ORCPT ); Thu, 13 Jun 2019 04:48:33 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C8F06206BA; Thu, 13 Jun 2019 08:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560415713; bh=7IybN8Nha+uXU8W7xnlveY2BYrbSDvSR5HmEzqawZPI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1qD690R6YTM7Zy9J+qzIomdhSaw/Wg5ZBNjMJ7W1f6zdj3mryT9d+I0BpKh3AORs7 A4hJinAnR75ZuF27Woujbso7kScSnD01SRcDV4qaYsjpdKe6kNqZhTnoptdng/8xx9 7W9l/mQTMdKKZqP9jVPGAi/bgXhg5XeCw+/4h3qc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Jankowski , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.1 065/155] netfilter: nf_conntrack_h323: restore boundary check correctness Date: Thu, 13 Jun 2019 10:32:57 +0200 Message-Id: <20190613075656.656317226@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190613075652.691765927@linuxfoundation.org> References: <20190613075652.691765927@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit f5e85ce8e733c2547827f6268136b70b802eabdb ] Since commit bc7d811ace4a ("netfilter: nf_ct_h323: Convert CHECK_BOUND macro to function"), NAT traversal for H.323 doesn't work, failing to parse H323-UserInformation. nf_h323_error_boundary() compares contents of the bitstring, not the addresses, preventing valid H.323 packets from being conntrack'd. This looks like an oversight from when CHECK_BOUND macro was converted to a function. To fix it, stop dereferencing bs->cur and bs->end. Fixes: bc7d811ace4a ("netfilter: nf_ct_h323: Convert CHECK_BOUND macro to function") Signed-off-by: Jakub Jankowski Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nf_conntrack_h323_asn1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/nf_conntrack_h323_asn1.c b/net/netfilter/nf_conntrack_h323_asn1.c index 1601275efe2d..4c2ef42e189c 100644 --- a/net/netfilter/nf_conntrack_h323_asn1.c +++ b/net/netfilter/nf_conntrack_h323_asn1.c @@ -172,7 +172,7 @@ static int nf_h323_error_boundary(struct bitstr *bs, size_t bytes, size_t bits) if (bits % BITS_PER_BYTE > 0) bytes++; - if (*bs->cur + bytes > *bs->end) + if (bs->cur + bytes > bs->end) return 1; return 0; -- 2.20.1