]> 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>
Sun, 12 Oct 2025 10:57:18 +0000 (12:57 +0200)
commit7441d70d5cd6c1943caa107125c54c71070c3611
tree9f0e3efc324864db918235e181b461475b1eaf45
parentcc9cfbfb2916760fa34602d63d3c6070d3799dd5
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