Commit 7441d70
staging: axis-fifo: fix TX handling on copy_from_user() failure
commit 6d07bee 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 c6e8d85 ("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: c6e8d85 ("staging: axis-fifo: Remove hardware resets for user errors")
Cc: [email protected]
Signed-off-by: Ovidiu Panait <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>1 parent cc9cfbf commit 7441d70
1 file changed
+10
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
| |||
466 | 465 | | |
467 | 466 | | |
468 | 467 | | |
469 | | - | |
470 | | - | |
471 | | - | |
| 468 | + | |
472 | 469 | | |
473 | | - | |
474 | 470 | | |
475 | 471 | | |
476 | 472 | | |
| |||
535 | 531 | | |
536 | 532 | | |
537 | 533 | | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
557 | 538 | | |
558 | 539 | | |
559 | | - | |
| 540 | + | |
| 541 | + | |
560 | 542 | | |
561 | 543 | | |
562 | | - | |
| 544 | + | |
563 | 545 | | |
| 546 | + | |
| 547 | + | |
564 | 548 | | |
565 | 549 | | |
566 | 550 | | |
| |||
0 commit comments