From: Jens Axboe Date: Fri, 24 Jan 2025 21:32:25 +0000 (-0700) Subject: io_uring/register: use atomic_read/write for sq_flags migration X-Git-Tag: v6.13.2~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=016bc7b496d8f77d287fc8912aa2a53961eeab92;p=thirdparty%2Fkernel%2Fstable.git io_uring/register: use atomic_read/write for sq_flags migration [ Upstream commit a23ad06bfee5e51cd9e51aebf11401e7b4b5d00a ] A previous commit changed all of the migration from the old to the new ring for resizing to use READ/WRITE_ONCE. However, ->sq_flags is an atomic_t, and while most archs won't complain on this, some will indeed flag this: io_uring/register.c:554:9: sparse: sparse: cast to non-scalar io_uring/register.c:554:9: sparse: sparse: cast from non-scalar Just use atomic_set/atomic_read for handling this case. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202501242000.A2sKqaCL-lkp@intel.com/ Fixes: 2c5aae129f42 ("io_uring/register: document io_register_resize_rings() shared mem usage") Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- diff --git a/io_uring/register.c b/io_uring/register.c index 371aec87e078c..14ece7754e4ca 100644 --- a/io_uring/register.c +++ b/io_uring/register.c @@ -553,7 +553,7 @@ overflow: ctx->cqe_cached = ctx->cqe_sentinel = NULL; WRITE_ONCE(n.rings->sq_dropped, READ_ONCE(o.rings->sq_dropped)); - WRITE_ONCE(n.rings->sq_flags, READ_ONCE(o.rings->sq_flags)); + atomic_set(&n.rings->sq_flags, atomic_read(&o.rings->sq_flags)); WRITE_ONCE(n.rings->cq_flags, READ_ONCE(o.rings->cq_flags)); WRITE_ONCE(n.rings->cq_overflow, READ_ONCE(o.rings->cq_overflow));