• Dmitry Torokhov's avatar
    Input: serio_raw - signal EFAULT even if read/write partially succeeds · 46f49b7a
    Dmitry Torokhov authored
    When copy_to/from_user fails in the middle of transfer we should not
    report to the user that read/write partially succeeded but rather
    report -EFAULT right away, so that application will know that it got
    its buffers all wrong.
    
    If application messed up its buffers we can't trust the data fetched
    from userspace and successfully written to the device or if data read
    from the device and transferred to userspace ended up where application
    expected it to end.
    
    If serio_write() fails we still going to report partial writes if failure
    happens in the middle of the transfer.
    
    This is basically a revert of 7a0a27d2
    and 4fa07711.
    Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
    46f49b7a
serio_raw.c 9.93 KB