From: Arnd Bergmann <arnd@kernel.org>
To: Leon Romanovsky <leon@kernel.org>, Jason Gunthorpe <jgg@ziepe.ca>,
Parav Pandit <parav@nvidia.com>
Cc: Arnd Bergmann <arnd@arndb.de>, Mark Bloch <mbloch@nvidia.com>,
Patrisious Haddad <phaddad@nvidia.com>,
Moshe Shemesh <moshe@nvidia.com>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] RDMA/mlx5: fix linking with CONFIG_INFINIBAND_USER_ACCESS=n
Date: Thu, 10 Jul 2025 10:09:50 +0200 [thread overview]
Message-ID: <20250710080955.2517331-1-arnd@kernel.org> (raw)
From: Arnd Bergmann <arnd@arndb.de>
The check for rdma_uattrs_has_raw_cap() is not possible if user
access is disabled:
ERROR: modpost: "rdma_uattrs_has_raw_cap" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined!
Limit the check to configurations that have the option enabled
and instead assume the capability is not there otherwise.
From what I can tell, the UVERBS code in fs.c is not actually called
when INFINIBAND_USER_ACCESS is turned off, so this haz no effect
other than fixing the link error. A better change might be to not
build the code at all in that configuration, but I did not see
an obvious way to do that.
Fixes: 95a89ec304c3 ("RDMA/mlx5: Check CAP_NET_RAW in user namespace for flow create")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
If there is a better way of addressing the link failure, please just
treat this as a bug report
---
drivers/infiniband/hw/mlx5/fs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/mlx5/fs.c b/drivers/infiniband/hw/mlx5/fs.c
index bab2f58240c9..c1ec9aa1dfd3 100644
--- a/drivers/infiniband/hw/mlx5/fs.c
+++ b/drivers/infiniband/hw/mlx5/fs.c
@@ -2459,7 +2459,8 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_CREATE_FLOW)(
struct mlx5_ib_dev *dev;
u32 flags;
- if (!rdma_uattrs_has_raw_cap(attrs))
+ if (!IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS) ||
+ !rdma_uattrs_has_raw_cap(attrs))
return -EPERM;
fs_matcher = uverbs_attr_get_obj(attrs,
--
2.39.5
next reply other threads:[~2025-07-10 8:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-10 8:09 Arnd Bergmann [this message]
2025-07-10 20:12 ` yanjun.zhu
2025-07-11 5:39 ` Arnd Bergmann
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=20250710080955.2517331-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=arnd@arndb.de \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=moshe@nvidia.com \
--cc=parav@nvidia.com \
--cc=phaddad@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
all inboxes | Powered by JetHome®