From patchwork Mon Sep 20 16:43:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 514359 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2321364jao; Mon, 20 Sep 2021 11:27:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxF+VgWG9YrAKniSlByKIfz7QaFcOy4QajcQ8lAN8/KgZNKgX1m28C1vVEvjoaWvBi+7/1q X-Received: by 2002:a17:906:4452:: with SMTP id i18mr28317507ejp.374.1632162442499; Mon, 20 Sep 2021 11:27:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632162442; cv=none; d=google.com; s=arc-20160816; b=UKKMqBYo7mwx1yHJpG/XjGaf0d4PWfxbmSCz76JcijeQTvaCvskXuJC57Le4GgItxb amlcclkkY8qTzKWDY8pzhVYd1bJPQQzAErJeEC8nTzNyVwbzFSPHWsiLp/aiFcjoLUzf 1g2L2qdmzM2f9W5uzgXfeOvISq9euNrGuOFw4nytyBBpDwvL1KMH01kG8P0TsCPM7pbE 6I1E5suJCL/ARxG0FO4oIbC0SPDcljcW2P6ow0PPXWEQPS7cQ2wnDd1ojnki2JlnBKMJ 37Vag4wQJAl745diCZO6ChGK3LkvRF9r1DE+mN/Y0slu/oqEMP6VFtRCqQb7+gjbnZDQ 5+EA== 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=aSJ3NakeTddxgF1apn1CcY1VQ/Hpe63ga6sVzynDOBw=; b=suBHAACY2jI6QOgIhVC96Xap1eBBQAPLkMvDu0rvjtldRzqHVBEGAcy2PP0dwKPEpe j1UfJ+xVxNj4BgMAvxVuwkFmwfzm8lolqF36pRZjhRNO7KxChftDIVgEAi49JXqECjyd XY/dZit5SKO+dhEKTcVwis5N00BtmmoAxCYdKFetFQkPKVhGCoUUQUeY5MtPjXvnNpDg 28pZrNhr5R5lEa5cxR8PvGwyLLl07K4sVLOWLw+B4F9kHS71YWAVRwZYzEwQND7vfKwV 4DTb/SY/Hqerryn5+Un2xsxrsPtaDkfcl6JeeEpxkI/RNKC6pAD9n6loPjt09EshwmKF VMCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FCpB672a; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 n6si2303844eda.103.2021.09.20.11.27.22; Mon, 20 Sep 2021 11:27:22 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=FCpB672a; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S1348660AbhITS2r (ORCPT + 11 others); Mon, 20 Sep 2021 14:28:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:44432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378765AbhITS0W (ORCPT ); Mon, 20 Sep 2021 14:26:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AB8DB6126A; Mon, 20 Sep 2021 17:25:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158743; bh=T6bfA4lJXrzJMqxed6cF3AHuqdBRgfj7i1mn/NlkoqY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FCpB672a7YyyitjttkBem9uvfSCAmYDHK2JohTODJFYia858+XeMcCPy/6jYKu1Vh Cw8TuQbBqp4Bg2MPBIfi6gJ/VLtHpqu1/DDJWOk4vv3fkg880o1FE8eXPVoJKIFciy 8mGUjroBav2tXItX6goMUKY3gqWHNEUhaDY6bBc4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Elder , "David S. Miller" Subject: [PATCH 5.10 036/122] net: ipa: initialize all filter table slots Date: Mon, 20 Sep 2021 18:43:28 +0200 Message-Id: <20210920163916.975682498@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163915.757887582@linuxfoundation.org> References: <20210920163915.757887582@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Alex Elder commit b5c102238cea985d8126b173d06b9e1de88037ee upstream. There is an off-by-one problem in ipa_table_init_add(), when initializing filter tables. In that function, the number of filter table entries is determined based on the number of set bits in the filter map. However that count does *not* include the extra "slot" in the filter table that holds the filter map itself. Meanwhile, ipa_table_addr() *does* include the filter map in the memory it returns, but because the count it's provided doesn't include it, it includes one too few table entries. Fix this by including the extra slot for the filter map in the count computed in ipa_table_init_add(). Note: ipa_filter_reset_table() does not have this problem; it resets filter table entries one by one, but does not overwrite the filter bitmap. Fixes: 2b9feef2b6c2 ("soc: qcom: ipa: filter and routing tables") Signed-off-by: Alex Elder Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ipa/ipa_table.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ipa/ipa_table.c +++ b/drivers/net/ipa/ipa_table.c @@ -451,7 +451,8 @@ static void ipa_table_init_add(struct gs * table region determines the number of entries it has. */ if (filter) { - count = hweight32(ipa->filter_map); + /* Include one extra "slot" to hold the filter map itself */ + count = 1 + hweight32(ipa->filter_map); hash_count = hash_mem->size ? count : 0; } else { count = mem->size / IPA_TABLE_ENTRY_SIZE;