]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drivers/rapidio/rio_cm.c: prevent possible heap overwrite
authorAndrew Morton <akpm@linux-foundation.org>
Sun, 8 Jun 2025 00:43:18 +0000 (17:43 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:05:33 +0000 (11:05 +0100)
commit58f664614f8c3d6142ab81ae551e466dc6e092e8
treed0286e28c5b1f5ad3b987d5ce250ea21d320dad9
parenta41f447cb27a1985c17cadc57883966a6b53dd6a
drivers/rapidio/rio_cm.c: prevent possible heap overwrite

commit 50695153d7ddde3b1696dbf0085be0033bf3ddb3 upstream.

In

riocm_cdev_ioctl(RIO_CM_CHAN_SEND)
   -> cm_chan_msg_send()
      -> riocm_ch_send()

cm_chan_msg_send() checks that userspace didn't send too much data but
riocm_ch_send() failed to check that userspace sent sufficient data.  The
result is that riocm_ch_send() can write to fields in the rio_ch_chan_hdr
which were outside the bounds of the space which cm_chan_msg_send()
allocated.

Address this by teaching riocm_ch_send() to check that the entire
rio_ch_chan_hdr was copied in from userspace.

Reported-by: maher azz <maherazz04@gmail.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Alexandre Bounine <alex.bou9@gmail.com>
Cc: Linus Torvalds <torvalds@linuxfoundation.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/rapidio/rio_cm.c