From patchwork Mon Sep 20 16:43:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 514371 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2332658jao; Mon, 20 Sep 2021 11:40:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWkZPL8Z9w0f0ge7zsVijxHxELqB6H65Gy5tqWsoVOAgV3yCUFZCHsMmbPbDAVRaFrgmzR X-Received: by 2002:a92:d3c1:: with SMTP id c1mr19025051ilh.223.1632163254059; Mon, 20 Sep 2021 11:40:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632163254; cv=none; d=google.com; s=arc-20160816; b=dzIgR0S+CIarFKc+HX/Rg0xMNdooeDB4v89UZNn0Dkzfv2rBVuUOXeAp3rXTCd3sIR MUGvxQ63zFjJ0D/SJi4fDAdNmu84T2UkeHJH87ldzcpa2UoOOzY1adD3dAoTyjlr6nHn ybUIpXNLrp11gJBUFtS4x4Kn5aW+ISooDCbyAfwlRX9dTp6UkuBC0mtcppdnH/OWpsWF e1iajhHiZDDNyZFn8k8U4OD7FdPIgQds5xkS6+q2av7h9vFrx1lq4iBJAB12NBzsYHgl E2bFhRNqGDNnHx4hr/4+EJezHZtYe7FEOXhMKpz+F7YcLa8NXLinF8ctRwKtFjAdCGI6 ySSg== 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=8aV1SM7MTjHwSHejGGxKampTf8JbC60NtJ0Fm7O6zTI=; b=rHZFytJ3t28PW0R88n6gTRr2A3mr/RfTK7sN4t83R19uIVZaS5dYqRHcGQgX6OAM04 oICVTszYdCIx3lgpnS4WutTii17lR/kSSpWcqsaJEVW9QQNIPVvGaFm9VnkqzXYawi0r okrZYiUsVo29qnzgD1pdhLQ0Tebrh2hj7GuO+FZ3W//1wj0KCIg2mQVA+3ZfE4EtgdxD Fo75kPsy1AoHFnbIJKzrbhSkMaVdQ99RsYNTXGgRUITFAtGXTerMvVyMrUI4CquaTcLp 01kAkXUCrBxTJNj/lC81yC2cTs1Id+W978mcFFMgKe0qqQRNI7Z6tmieMSSuzlFqfLGu /pRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YMSXFpJC; 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 c20si4517836ilu.11.2021.09.20.11.40.53; Mon, 20 Sep 2021 11:40:54 -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=YMSXFpJC; 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 S1349277AbhITSmS (ORCPT + 11 others); Mon, 20 Sep 2021 14:42:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:56448 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382301AbhITSkR (ORCPT ); Mon, 20 Sep 2021 14:40:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8664C63331; Mon, 20 Sep 2021 17:31:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159064; bh=aU5jjJkB3VmCgVUlzT1/mI1oGjuuEmcURWIZ7K3uIXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YMSXFpJCFUtIsI8/2tMDZdWO8ODqISSpU9YOdEYZeovecwpOSS7CsjDVGoJVX9Fv0 Ed9W2WB/mFLMUNti0PnJmgB/IGu1NKTjU5zwrqOExp0FLKL4xfsKZiRhCbWnnFYOZf vz/u14aQjSXbFDfhZg/M3r7gHKM2XudLPJeVONEs= 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.14 058/168] net: ipa: initialize all filter table slots Date: Mon, 20 Sep 2021 18:43:16 +0200 Message-Id: <20210920163923.548389478@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@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 @@ -430,7 +430,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 / sizeof(__le64);