]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: Use WRITE_ONCE() when writing to sq_flags
authorNadav Amit <namit@vmware.com>
Sun, 8 Aug 2021 00:13:42 +0000 (17:13 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 9 Aug 2021 03:21:11 +0000 (21:21 -0600)
commitf0c71b8dc5946ce071783e8ca17ad96e01a80785
tree502ab1f31055a72f8c56dc43190978fcb1d7915b
parent4525c7e295eee1ff9b8e6f6dbd21e65f446e83df
io_uring: Use WRITE_ONCE() when writing to sq_flags

The compiler should be forbidden from any strange optimization for async
writes to user visible data-structures. Without proper protection, the
compiler can cause write-tearing or invent writes that would confuse the
userspace.

However, there are writes to sq_flags which are not protected by
WRITE_ONCE(). Use WRITE_ONCE() for these writes.

This is purely a theoretical issue. Presumably, any compiler is very
unlikely to do such optimizations.

Fixes: e520227a8307 ("io_uring: allocate the two rings together")
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Nadav Amit <namit@vmware.com>
Link: https://lore.kernel.org/r/20210808001342.964634-3-namit@vmware.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c