• Jens Axboe's avatar
    io_uring/net: harden multishot termination case for recv · c314094c
    Jens Axboe authored
    If the recv returns zero, or an error, then it doesn't matter if more
    data has already been received for this buffer. A condition like that
    should terminate the multishot receive. Rather than pass in the
    collected return value, pass in whether to terminate or keep the recv
    going separately.
    
    Note that this isn't a bug right now, as the only way to get there is
    via setting MSG_WAITALL with multishot receive. And if an application
    does that, then -EINVAL is returned anyway. But it seems like an easy
    bug to introduce, so let's make it a bit more explicit.
    
    Link: https://github.com/axboe/liburing/issues/1246
    Cc: stable@vger.kernel.org
    Fixes: b3fdea6e ("io_uring: multishot recv")
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    c314094c
net.c 44.9 KB