* [PATCH] drm/amdgpu: reject UALink peers outside the vPod active set
@ 2026-12-04 3:43 Mukul Joshi
2026-12-04 3:57 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Mukul Joshi @ 2026-12-04 3:43 UTC (permalink / raw)
To: amd-gfx; +Cc: Felix.Kuehling, Harish.Kasiviswanathan, philip.yang, Mukul Joshi
remote->peer[] is only set up for active vPod members other than this
GPU, but the import ioctl and HELLO processing only range-check the
accelerator id. An unused id makes connection setup run on a zeroed
peer: an uninitialized mutex and scheduler entity, and GPU address 0.
Reject such ids in the import ioctl, connection setup and HELLO
processing.
Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 33 ++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
index 0ce5faccfda7..6dcaf297a496 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
@@ -58,6 +58,8 @@ static void amdgpu_ualink_reset_peer_rings(struct amdgpu_device *adev,
u32 remote_accel_id);
static int amdgpu_ualink_ring_resync_ptrs(struct amdgpu_device *adev,
u32 remote_accel_id);
+static bool amdgpu_ualink_peer_is_set_up(struct amdgpu_device *adev,
+ u32 accel_id);
#define STRIP_NPA(addr) \
(((u64)(addr) & ~AMDGPU_UALINK_NPA_ADDR_GPUID_MASK))
@@ -2280,6 +2282,13 @@ static void amdgpu_ualink_process_hello_msg(struct amdgpu_device *adev,
return;
}
+ if (!amdgpu_ualink_peer_is_set_up(adev, sender_acc_id)) {
+ dev_err_ratelimited(adev->dev,
+ "HELLO: sender AccId:%u is not in the vPod\n",
+ sender_acc_id);
+ return;
+ }
+
conn_state = &adev->ualink.conn_state[sender_acc_id];
/* Check if connection is already established. If yes, then receiving HELLO msg
@@ -2353,6 +2362,9 @@ static int amdgpu_ualink_setup_connection(struct amdgpu_device *adev,
struct amdgpu_ualink_connection *conn_state;
int r;
+ if (!amdgpu_ualink_peer_is_set_up(adev, remote_acc_id))
+ return -EINVAL;
+
conn_state = &adev->ualink.conn_state[remote_acc_id];
/* Connection state management goes through different states.
@@ -3899,6 +3911,13 @@ int amdgpu_ualink_import_handle(struct drm_device *dev,
return amdgpu_ualink_local_import(adev, remote_acc_id,
&handle, fd_out);
+ if (!amdgpu_ualink_peer_is_set_up(adev, remote_acc_id)) {
+ dev_dbg(adev->dev,
+ "IMPORT: remote AccId:%u is not in the vPod\n",
+ remote_acc_id);
+ return -EINVAL;
+ }
+
xa_lock(&adev->ualink.imp_xa);
imp_xa_node = xa_load(&adev->ualink.imp_xa, handle.handle_lo);
@@ -4506,6 +4525,20 @@ static inline enum amdgpu_ualink_addr_mode ualink_addr_mode(struct amdgpu_device
return adev->ualink.info->vpod.addr_mode;
}
+/*
+ * remote->peer[] (lock, scheduler entity, ring addresses and sizes) is only
+ * set up for members of the activation-time snapshot, excluding this GPU.
+ */
+static bool amdgpu_ualink_peer_is_set_up(struct amdgpu_device *adev,
+ u32 accel_id)
+{
+ struct amdgpu_ualink_remote *remote = to_remote(adev);
+
+ return remote && accel_id < AMDGPU_UALINK_ACCEL_MAX &&
+ accel_id != ualink_accel_id(adev) &&
+ test_bit(accel_id, remote->active_accel_bits);
+}
+
/*
* address mode and NPA address for ring wptr, rptr, wb status, wb data
*
--
2.56.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/amdgpu: reject UALink peers outside the vPod active set
2026-12-04 3:43 [PATCH] drm/amdgpu: reject UALink peers outside the vPod active set Mukul Joshi
@ 2026-12-04 3:57 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-12-04 3:57 UTC (permalink / raw)
To: Mukul Joshi, amd-gfx
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/amdgpu: missing Fixes trailers on UALink peer validation
bug-fix commit
--
commit 37d1bf77df3bc8c5b8bf6a9b288a54b6e7fd9a36
Author: Mukul Joshi <mukul.joshi@amd.com>
> drm/amdgpu: reject UALink peers outside the vPod active set
>
> remote->peer[] is only set up for active vPod members other than this
> GPU, but the import ioctl and HELLO processing only range-check the
> accelerator id. An unused id makes connection setup run on a zeroed
> peer: an uninitialized mutex and scheduler entity, and GPU address 0.
>
> Reject such ids in the import ioctl, connection setup and HELLO
> processing.
>
> Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
[Severity: Low]
This fixes missing active vPod peer checks in the connection management
and import ioctl paths. Should this include:
Fixes: 2b4c5569d888 ("drm/amdgpu: Add connection state management")
Fixes: a9a7035e2ec9 ("drm/amdgpu: Implement UALink handle import ioctl")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204034336.940330-1-mukul.joshi@amd.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-04 3:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 3:43 [PATCH] drm/amdgpu: reject UALink peers outside the vPod active set Mukul Joshi
2026-12-04 3:57 ` sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.