Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2574207pxb; Mon, 19 Apr 2021 08:44:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzUJWQAMxxXvKqzJ+n1t/pH9RaJGFxHa6c24w+rpDGeRZDuosLmAFPk5ERATvvWsLRwutT X-Received: by 2002:a05:6402:440d:: with SMTP id y13mr26686721eda.316.1618847050036; Mon, 19 Apr 2021 08:44:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618847050; cv=none; d=google.com; s=arc-20160816; b=xFqF2NgxMaWajgMal3pmlsUllWtpN508FD7M42vnQJNY4KlYKpi6RWrKfP7GKrn+u2 1i4rfAUzyx7JhvFrAH8Ty+dEsf9fS0aEMuNYDAZZMe0v5M+CcIU+vSs3ibF/GkIGUjbM f2h/dOWEP3hW1D0aXGOM3S/W5z2LtyrGGxvj1omuHNwWHTXXkNJbn1k9YSEE24rGAQx/ K1ZFsRv+/KGgeZsHnKWct5XQt5PzE1rKgfP4yXTmLwtL5pAftcSjFG1b66+/vk+AVTPJ psMKsWVcjQA0xG5/uJGlN70cto9yjFWgNVRWnJ2S5N7k/D1au9LKNgihBq6QFiJaPgm3 9LKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SXJiLlkSnscn6L6i/8mn5hRR2hVKyY2EOd7JgSLAcgQ=; b=jtU1P2fj4V+fMQPxW+SpaepOSCAyfYruw3Z5PYIKhnwlaVDXcfRsujA0c4aRhipsk4 7lk8t3b01zxaPTKVjWwqr/U92wgTYjI3GYUiG2AnrO5QOFt3WiTBNzgyan/Vd5Upisdp F5uPZoT9p9lm8TZh4FH6jIRNHnkhZ/VWCxvCoD8dAVjY+AQDNSY2GZrTk4rtQoQ7L7HZ /bCSG9twGHVgMfKV/u9VLG2ptPaQZ56AgIiCjb7N/jLKVCkyr4tkieZK0xL8K1ZfkgzC yTJ74IT+9IP1d0oykP6bi0F+g2rl/vUkJ3TdWbOYC06CSKZ8juAovy+tiF0Uyabpr8pT +9sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0S82r/Yz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b11si13295444edq.208.2021.04.19.08.43.46; Mon, 19 Apr 2021 08:44:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0S82r/Yz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241574AbhDSN0M (ORCPT + 99 others); Mon, 19 Apr 2021 09:26:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:56988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241154AbhDSNUC (ORCPT ); Mon, 19 Apr 2021 09:20:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7345E613E2; Mon, 19 Apr 2021 13:15:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618838144; bh=dAF5/SqOJKnqmlYgI+dE0TsDA1M5hV6EL+szpzELn/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0S82r/YzbbXP2rej74QIvGjw2NsA006n4WWDYmpO4qruuMg1Hvv6HxgzckVu6+rMw S+hCjeVsxcko5Wgo4ZRbQtT6W3ZgJHvw4cgmGaZtElgGj01DAEnFiGSrJ+5yhbvvUT YL9oqAnW87oU/nY6ohs4NlIpIghYkhoAo7za0T10= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso Subject: [PATCH 5.10 058/103] netfilter: flowtable: fix NAT IPv6 offload mangling Date: Mon, 19 Apr 2021 15:06:09 +0200 Message-Id: <20210419130529.798526389@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210419130527.791982064@linuxfoundation.org> References: <20210419130527.791982064@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pablo Neira Ayuso commit 0e07e25b481aa021e4b48085ecb8a049e9614510 upstream. Fix out-of-bound access in the address array. Fixes: 5c27d8d76ce8 ("netfilter: nf_flow_table_offload: add IPv6 support") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nf_flow_table_offload.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/net/netfilter/nf_flow_table_offload.c +++ b/net/netfilter/nf_flow_table_offload.c @@ -305,12 +305,12 @@ static void flow_offload_ipv6_mangle(str const __be32 *addr, const __be32 *mask) { struct flow_action_entry *entry; - int i; + int i, j; - for (i = 0; i < sizeof(struct in6_addr) / sizeof(u32); i += sizeof(u32)) { + for (i = 0, j = 0; i < sizeof(struct in6_addr) / sizeof(u32); i += sizeof(u32), j++) { entry = flow_action_entry_next(flow_rule); flow_offload_mangle(entry, FLOW_ACT_MANGLE_HDR_TYPE_IP6, - offset + i, &addr[i], mask); + offset + i, &addr[j], mask); } }