FAILED: patch "[PATCH] dibs: loopback: validate offset and size in move_data()" failed to apply to 6.12-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 78237e3c0720fcc6eb9b87e90fd70f63eeca886f
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072130-tadpole-coauthor-d48e@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 78237e3c0720fcc6eb9b87e90fd70f63eeca886f Mon Sep 17 00:00:00 2001
From: Dust Li <[email protected]>
Date: Tue, 7 Jul 2026 15:43:18 +0800
Subject: [PATCH] dibs: loopback: validate offset and size in move_data()
The loopback move_data() performs a memcpy into the registered DMB without checking whether offset + size exceeds the DMB length. Unlike real ISM hardware, which enforces memory region bounds natively, the software loopback has no such protection.
A peer-supplied out-of-bounds offset or oversized write would result in an OOB write past the allocated kernel buffer. Add an explicit bounds check before the memcpy to reject such requests with -EINVAL.
drivers/dibs/dibs_loopback.c +5 -0
@@ -254,6 +254,11 @@ static int dibs_lo_move_data(struct dibs_dev *dibs, u64 dmb_tok,read_unlock_bh (&ldev->dmb_ht_lock);return -EINVAL ; } +if ((u64 )offset + size > rmb_node->len) { +read_unlock_bh (&ldev->dmb_ht_lock); +return -EINVAL ; + } +memcpy ((char *)rmb_node->cpu_addr + offset, data, size); sba_idx = rmb_node->sba_idx;read_unlock_bh (&ldev->dmb_ht_lock);
PATCH 1/1 dibs: loopback: validate offset and size in move_data()
commit 78237e3c0720fcc6eb9b87e90fd70f63eeca886f upstream.
The loopback move_data() performs a memcpy into the registered DMB without checking whether offset + size exceeds the DMB length. Unlike real ISM hardware, which enforces memory region bounds natively, the software loopback has no such protection.
A peer-supplied out-of-bounds offset or oversized write would result in an OOB write past the allocated kernel buffer. Add an explicit bounds check before the memcpy to reject such requests with -EINVAL.
--- net/smc/smc_loopback.c | 5 +++++ 1 file changed, 5 insertions(+)
net/smc/smc_loopback.c +5 -0
@@ -245,6 +245,11 @@ static int smc_lo_move_data(struct smcd_dev *smcd, u64 dmb_tok,read_unlock_bh (&ldev->dmb_ht_lock);return -EINVAL ; } +if ((u64 )offset + size > rmb_node->len) { +read_unlock_bh (&ldev->dmb_ht_lock); +return -EINVAL ; + } +memcpy ((char *)rmb_node->cpu_addr + offset, data, size);read_unlock_bh (&ldev->dmb_ht_lock);
Signature · 1 line
2.43.7