]> git.ipfire.org Git - thirdparty/kernel/linux.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>
Fri, 12 Sep 2025 14:21:46 +0000 (16:21 +0200)
commit6d07bee10e4bdd043ec7152cbbb9deb27033c9e2
tree9c4faf1dd9b674fc3fd7288a448ddf2aa1bf0367
parent52ff2b840bc723f3be1f096f8017c78e0515858c
staging: axis-fifo: fix TX handling on copy_from_user() failure

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