]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
dibs: loopback: validate offset and size in move_data()
authorDust Li <dust.li@linux.alibaba.com>
Tue, 7 Jul 2026 07:43:18 +0000 (15:43 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 9 Jul 2026 10:44:00 +0000 (12:44 +0200)
commit78237e3c0720fcc6eb9b87e90fd70f63eeca886f
tree626153581998515ed11af65563ec77f9bbc52837
parentfabb881df322da25442f98d23f5fa371e3c78ec4
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.

Fixes: f7a22071dbf3 ("net/smc: implement DMB-related operations of loopback-ism")
Cc: stable@vger.kernel.org
Reported-by: Federico Kirschbaum <federico.kirschbaum@xbow.com>
Signed-off-by: Dust Li <dust.li@linux.alibaba.com>
Reported-by: Baul Lee <baul.lee@xbow.com>
Link: https://patch.msgid.link/20260707074318.1448662-1-dust.li@linux.alibaba.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/dibs/dibs_loopback.c