netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: Jakub Kicinski <kuba@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, Daniel Jurgens <danielj@nvidia.com>,
	Colin Ian King <colin.king@canonical.com>,
	Saeed Mahameed <saeedm@nvidia.com>
Subject: [net 1/4] net/mlx5: Fix function calculation for page trees
Date: Mon,  1 Feb 2021 23:07:00 -0800	[thread overview]
Message-ID: <20210202070703.617251-2-saeed@kernel.org> (raw)
In-Reply-To: <20210202070703.617251-1-saeed@kernel.org>

From: Daniel Jurgens <danielj@nvidia.com>

The function calculation always results in a value of 0. This works
generally, but when the release all pages feature is enabled it will
result in crashes.

Fixes: 0aa128475d33 ("net/mlx5: Maintain separate page trees for ECPF and PF functions")
Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
index eaa8958e24d7..c0656d4782e1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
@@ -76,7 +76,7 @@ enum {
 
 static u32 get_function(u16 func_id, bool ec_function)
 {
-	return func_id & (ec_function << 16);
+	return (u32)func_id | (ec_function << 16);
 }
 
 static struct rb_root *page_root_per_function(struct mlx5_core_dev *dev, u32 function)
-- 
2.29.2


  reply	other threads:[~2021-02-02  7:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02  7:06 [pull request][net 0/4] mlx5 fixes 2021-02-01 Saeed Mahameed
2021-02-02  7:07 ` Saeed Mahameed [this message]
2021-02-02 17:00   ` [net 1/4] net/mlx5: Fix function calculation for page trees patchwork-bot+netdevbpf
2021-02-02  7:07 ` [net 2/4] net/mlx5: Fix leak upon failure of rule creation Saeed Mahameed
2021-02-02  7:07 ` [net 3/4] net/mlx5e: Update max_opened_tc also when channels are closed Saeed Mahameed
2021-02-02  7:07 ` [net 4/4] net/mlx5e: Release skb in case of failure in tc update skb Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210202070703.617251-2-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=colin.king@canonical.com \
    --cc=danielj@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).