Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2353429pxb; Mon, 20 Sep 2021 19:51:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy19W/Ku/ikOXm6Xj44lYCd1gPlWyObsvpHrYXSOuZHx1oM3p4h/w2Nm6FIV1viig2uIptY X-Received: by 2002:a17:906:659:: with SMTP id t25mr30733162ejb.372.1632192701609; Mon, 20 Sep 2021 19:51:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192701; cv=none; d=google.com; s=arc-20160816; b=f8gtjiIhYRjHeU+4UmyA1XhgbyxC9r5PMQT9ECJA+KkGp4rXibBLxU2IqOH7bA5EGP MCKFFFaKQV9T23bioSl8MKKHCKW+wOlATVr/p0xij5l06Vzzwp7q0jxL6eUQZCb2/ly2 TAUw1BZCwnamDpuGiyEMQBxJSh+keQepiHop4T/wXyDgIpM4OuPAD8y1I30mDHCRN2hl SFQKTG3XNEAEYBOvMGgrThUnN8D9u8m23vFxL2d2SzYsiLiwTKuCQXiZ38TaE8ULGzZg Dt/rnTLuWo9JcXX9YszWG/B8kaeVWFJzw2m9tKEOab4j/JXwr7P4x9StQjernNyW6Pzg O4wQ== 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=PKkqyn2N/3lBCrH55lbCbK5uOjt7PmeN7DAn/udBSbdr86ENOsIhZmkNYNVxOZUsRX BnWr/F08vxTNonqRRTa/OL/kwImqKD2EpItgBraEhI7hfr4409O9tbtgcGGu8ix/RkXo kIEItyGVQhtiOVOHm15dyxNYlbwCS83fVt06/kRvbrR+mlVP/Qy3YvA/m7LW2cLmd08r t+v6PXkiCwbBT2x9I+BqdhezYbF9M27Cphr2Trprbwk3sCwWn8pPiJQgrL9Nl6JJ6LSY C6O47EK4iByvtjzocvvisWl8RzmcxnE+uPhwC15f/05GIDJ5B/VmHa5ZLdtRrNQn+CW4 wWJw== 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 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 j3si1500647ejj.448.2021.09.20.19.51.17; Mon, 20 Sep 2021 19:51:41 -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=YMSXFpJC; 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 S1383424AbhITSoc (ORCPT + 99 others); Mon, 20 Sep 2021 14:44:32 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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);