Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3937212pxj; Mon, 21 Jun 2021 09:45:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzK03hXxUwvxum8OT167woMnBqlhRJorkbhwStfeKcpj4mIjMw0EgVHc1L3RCwHoIsHu912 X-Received: by 2002:a05:6e02:1be4:: with SMTP id y4mr1574400ilv.247.1624293926761; Mon, 21 Jun 2021 09:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624293926; cv=none; d=google.com; s=arc-20160816; b=DgK0B/pRd/3mfA5uqPEkCaEMw7O+7Jz8Eii+qjhBkh34BV94C5qgHh1ihe++UiAmLM odq7QQdxXBEtl5fOyaxB1hfnOJvyEBmZqYRAlZk7NujO+QGVSp5GS1anOzUwUggGJu/7 iu4Bq5c3IdT8+b7n909wMBvLGBCagZ3qAT4Qf+v1+dO+c1X4vOmdpI8ugR+m8Hvx5COv nWtAqR5Y8XGIVTbGb+Esog4flkrJLCm8HsGzEQUeRaIqyPhWWpVU74IZQOnGho5jogdX BZAQuNEHkX/NVzg2OtIHDlyDYGFofnDTCKQLFi1klHaivcgO2gsh3K0a51k/gXvMJjME BaXA== 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=0tZCpuGgE8SxB1FlmoDy0ceZxwbvBc4j7rlpQthMKtE=; b=Fba00R362w9+lvsKLwmaU5C15rSh0BkxH9tIIh20KlVDG1esLjcenGlPlAF+mBBYSm 3koa2Cr3ZS2OnmY0X+kWq4OVDaoBO1qXKbZnu/eDDX8V1HKzD+ZlTT2CjsEYiZyrV7qK dt3R9VTsSId0nZWa1EnkSeNyrslXMY60ZCQn9+H+zcrCrdSAj3qeXk0Oht5ew3fJQB11 d60nhKk7NSorVOZnAqIQ0O9Gl58uUZHR/BgdF3UxnkL4P7QdR6Z3meYNpFLX4zoc+P+6 DsnnXiGmgFfGIQcYjkeaYXtiRl00r9y9mkCjuDnTiaAIovyxBmt8vBlJXrfTmz3iauv0 uALQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1NYFmAyp; 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 s4si21708892jat.42.2021.06.21.09.45.14; Mon, 21 Jun 2021 09:45:26 -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=1NYFmAyp; 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 S232312AbhFUQqV (ORCPT + 99 others); Mon, 21 Jun 2021 12:46:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:33886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232775AbhFUQlX (ORCPT ); Mon, 21 Jun 2021 12:41:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7B36B61439; Mon, 21 Jun 2021 16:30:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624293046; bh=0NMaKIKGw+mFpmbvt8pntH3Z677ASsHYhlVB7cobfTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1NYFmAyp5y+k6chqjFJ91B1GHtATkveYO/8bT8QiunfFb5/ilWwgugRZDG2FlgC5s gteG5ceJXwKU75YBOjeyfeqzlKa7J0oC0tP/34oO8tdAP7Kl0zY3WG3rwdJvvpxv6X 5/uqpoIlt0MKNa03v3EpWjYrfbE2YwpSQMte459Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aya Levin , Amir Tzin , Tariq Toukan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.12 078/178] net/mlx5: Reset mkey index on creation Date: Mon, 21 Jun 2021 18:14:52 +0200 Message-Id: <20210621154925.259222619@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154921.212599475@linuxfoundation.org> References: <20210621154921.212599475@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: Aya Levin [ Upstream commit 0232fc2ddcf4ffe01069fd1aa07922652120f44a ] Reset only the index part of the mkey and keep the variant part. On devlink reload, driver recreates mkeys, so the mkey index may change. Trying to preserve the variant part of the mkey, driver mistakenly merged the mkey index with current value. In case of a devlink reload, current value of index part is dirty, so the index may be corrupted. Fixes: 54c62e13ad76 ("{IB,net}/mlx5: Setup mkey variant before mr create command invocation") Signed-off-by: Aya Levin Signed-off-by: Amir Tzin Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mr.c b/drivers/net/ethernet/mellanox/mlx5/core/mr.c index 50af84e76fb6..174f71ed5280 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/mr.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/mr.c @@ -54,7 +54,7 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev, mkey_index = MLX5_GET(create_mkey_out, lout, mkey_index); mkey->iova = MLX5_GET64(mkc, mkc, start_addr); mkey->size = MLX5_GET64(mkc, mkc, len); - mkey->key |= mlx5_idx_to_mkey(mkey_index); + mkey->key = (u32)mlx5_mkey_variant(mkey->key) | mlx5_idx_to_mkey(mkey_index); mkey->pd = MLX5_GET(mkc, mkc, pd); init_waitqueue_head(&mkey->wait); -- 2.30.2