Commit 8247c59
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 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 3452796 commit 8247c59
1 file changed
Lines changed: 10 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | 46 | | |
48 | 47 | | |
49 | 48 | | |
| |||
302 | 301 | | |
303 | 302 | | |
304 | 303 | | |
305 | | - | |
306 | | - | |
307 | | - | |
| 304 | + | |
308 | 305 | | |
309 | | - | |
310 | 306 | | |
311 | 307 | | |
312 | 308 | | |
| |||
371 | 367 | | |
372 | 368 | | |
373 | 369 | | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
393 | 374 | | |
394 | 375 | | |
395 | | - | |
| 376 | + | |
| 377 | + | |
396 | 378 | | |
397 | 379 | | |
398 | | - | |
| 380 | + | |
399 | 381 | | |
| 382 | + | |
| 383 | + | |
400 | 384 | | |
401 | 385 | | |
402 | 386 | | |
| |||
0 commit comments