• Willy Tarreau's avatar
    floppy: use a statically allocated error counter · f71f0139
    Willy Tarreau authored
    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: default avatarMinh Yuan <yuanmingbuaa@gmail.com>
    Suggested-by: default avatarLinus Torvalds <torvalds@linuxfoundation.org>
    Tested-by: default avatarDenis Efremov <efremov@linux.com>
    Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    f71f0139
floppy.c 134 KB