Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2351833pxb; Mon, 20 Sep 2021 19:48:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxai7IXQv5HlQeWaIPTmp7BqNs+ZZl9Szzr0XmmnmsFwTYSUqLy1zlY7NvHVucUUio1IJjN X-Received: by 2002:a50:9d07:: with SMTP id v7mr704052ede.185.1632192498555; Mon, 20 Sep 2021 19:48:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192498; cv=none; d=google.com; s=arc-20160816; b=qKf11+vefF7Q+Zokt7m+Asok+D5LOruXnRr3+A6rsyMOHu8VQWThZme/ltk32/OlGN PcKyEjHbtxi9+LTAU74T/4wqDL3RWGA4HAamGHVSnsCHDPgxPG0i3Bt23HTYa5xLiwkX kWk4Q+IMmHHdj6BgUyhCnMkYPMrK6gQfOIuyfhOx9WjRaxKfhq3gdWnh9/nwiU67wcex +YA5oWYIsTMpEG6aJS5zlsBF4jCIpiuZIqZjNJtJJSTwnsjhV8HouXwDS05iBMCpWhUo wOJqJhI8E7WKnqN2q/auHrnsg0aGnIIeNPtQ1PA8W1bDtNORlb52uU7bDLKWBZu4yEx4 o5Lg== 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=GBcGOZQGoE/U/5BMoGFBsFeU8dSh+ucW0PVDmHHbmcRMkhJDstwBBZk+rgFjo1N8LK ODUymmoOwWRleOWdBtAlkr350CcSEzjO1N/pMIIgqXfLBNz/8wono+V4BRKu8hTgNGO/ GSLpguTlcLkuxw4wrGddqLZyoIuaDCD0Ma14gxM8rhUE0ZEJI0Ji3shssGhdRJ2QQOLp EtyEuMEK3kRL1CU9FfKk6ougK8CQ3ufOjGzqGeVykjvRyDNFpCEGf0Vpl7IHpt7Y+vRi s3UZBLgyI9l/1RWHievpdafd5NFdtnLeZyO7G2MxNRnhoj0/Yf2blmxooALaIeNMtIdE pGdQ== 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 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 x18si19927014edl.617.2021.09.20.19.47.54; Mon, 20 Sep 2021 19:48:18 -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=FCpB672a; 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 S1380302AbhITSdT (ORCPT + 99 others); Mon, 20 Sep 2021 14:33:19 -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 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 @@ -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;