]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
staging: axis-fifo: fix TX handling on copy_from_user() failure
authorOvidiu Panait <ovidiu.panait.oss@gmail.com>
Fri, 12 Sep 2025 10:13:21 +0000 (13:13 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Oct 2025 09:56:24 +0000 (11:56 +0200)
commit6bee010fbce4100ce6f0e888c49095bb2d7f79bd
tree4f89d869603c5446970802ca935d81b9663b0007
parentdb0c843cb5a5a975258d8d99154455d5aa7f535b
staging: axis-fifo: fix TX handling on copy_from_user() failure

commit 6d07bee10e4bdd043ec7152cbbb9deb27033c9e2 upstream.

If copy_from_user() fails, write() currently returns -EFAULT, but any
partially written data leaves the TX FIFO in an inconsistent state.
Subsequent write() calls then fail with "transmit length mismatch"
errors.

Once partial data is written to the hardware FIFO, it cannot be removed
without a TX reset. Commit c6e8d85fafa7 ("staging: axis-fifo: Remove
hardware resets for user errors") removed a full FIFO reset for this case,
which fixed a potential RX data loss, but introduced this TX issue.

Fix this by introducing a bounce buffer: copy the full packet from
userspace first, and write to the hardware FIFO only if the copy
was successful.

Fixes: c6e8d85fafa7 ("staging: axis-fifo: Remove hardware resets for user errors")
Cc: stable@vger.kernel.org
Signed-off-by: Ovidiu Panait <ovidiu.panait.oss@gmail.com>
Link: https://lore.kernel.org/r/20250912101322.1282507-1-ovidiu.panait.oss@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/axis-fifo/axis-fifo.c