io_uring: make offset == -1 consistent with preadv2/pwritev2
authorJens Axboe <axboe@kernel.dk>
Wed, 26 Aug 2020 16:36:20 +0000 (10:36 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:29:50 +0000 (11:29 +0200)
commite93fd7a49023c16ae6da90ff8605be5d384bb81c
tree47e1584a5e3e4b3d3b4a03f17a95c5cc661b5552
parent9ab83e1c4a31601a0006f8d26353012dc8876a92
io_uring: make offset == -1 consistent with preadv2/pwritev2

[ Upstream commit 0fef948363f62494d779cf9dc3c0a86ea1e5f7cd ]

The man page for io_uring generally claims were consistent with what
preadv2 and pwritev2 accept, but turns out there's a slight discrepancy
in how offset == -1 is handled for pipes/streams. preadv doesn't allow
it, but preadv2 does. This currently causes io_uring to return -EINVAL
if that is attempted, but we should allow that as documented.

This change makes us consistent with preadv2/pwritev2 for just passing
in a NULL ppos for streams if the offset is -1.

Cc: stable@vger.kernel.org # v5.7+
Reported-by: Benedikt Ames <wisp3rwind@posteo.eu>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/io_uring.c