Commit f71f013
floppy: use a statically allocated error counter
Interrupt handler bad_flp_intr() may cause a UAF on the recently freed
request just to increment the error count. There's no point keeping
that one in the request anyway, and since the interrupt handler uses a
static pointer to the error which cannot be kept in sync with the
pending request, better make it use a static error counter that's reset
for each new request. This reset now happens when entering
redo_fd_request() for a new request via set_next_request().
One initial concern about a single error counter was that errors on one
floppy drive could be reported on another one, but this problem is not
real given that the driver uses a single drive at a time, as that
PC-compatible controllers also have this limitation by using shared
signals. As such the error count is always for the "current" drive.
Reported-by: Minh Yuan <yuanmingbuaa@gmail.com>
Suggested-by: Linus Torvalds <torvalds@linuxfoundation.org>
Tested-by: Denis Efremov <efremov@linux.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>1 parent 30c8e80 commit f71f013
1 file changed
Lines changed: 8 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
509 | 509 | | |
510 | 510 | | |
511 | 511 | | |
512 | | - | |
513 | | - | |
| 512 | + | |
| 513 | + | |
514 | 514 | | |
515 | 515 | | |
516 | 516 | | |
| |||
530 | 530 | | |
531 | 531 | | |
532 | 532 | | |
533 | | - | |
534 | 533 | | |
535 | 534 | | |
536 | 535 | | |
| |||
1455 | 1454 | | |
1456 | 1455 | | |
1457 | 1456 | | |
1458 | | - | |
| 1457 | + | |
1459 | 1458 | | |
1460 | 1459 | | |
1461 | 1460 | | |
| |||
2095 | 2094 | | |
2096 | 2095 | | |
2097 | 2096 | | |
2098 | | - | |
| 2097 | + | |
2099 | 2098 | | |
2100 | 2099 | | |
2101 | 2100 | | |
| |||
2241 | 2240 | | |
2242 | 2241 | | |
2243 | 2242 | | |
2244 | | - | |
2245 | 2243 | | |
2246 | | - | |
| 2244 | + | |
2247 | 2245 | | |
2248 | 2246 | | |
2249 | 2247 | | |
| |||
2759 | 2757 | | |
2760 | 2758 | | |
2761 | 2759 | | |
2762 | | - | |
| 2760 | + | |
2763 | 2761 | | |
| 2762 | + | |
2764 | 2763 | | |
2765 | | - | |
| 2764 | + | |
2766 | 2765 | | |
2767 | 2766 | | |
2768 | 2767 | | |
| |||
2821 | 2820 | | |
2822 | 2821 | | |
2823 | 2822 | | |
2824 | | - | |
2825 | 2823 | | |
2826 | 2824 | | |
2827 | 2825 | | |
| |||
0 commit comments