diff options
author | Shenghui Wang <shhuiw@foxmail.com> | 2019-05-07 16:03:19 +0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-05-07 08:41:26 -0600 |
commit | 7889f44dd9cee15aff1c3f7daf81ca4dfed48fc7 (patch) | |
tree | 02b01ac768591a2f08f4b599dfc2305b67ff4022 /include/uapi | |
parent | efeb862bd5bc001636e690debf6f9fbba98e5bfd (diff) | |
download | linux-7889f44dd9cee15aff1c3f7daf81ca4dfed48fc7.tar.bz2 |
io_uring: use cpu_online() to check p->sq_thread_cpu instead of cpu_possible()
This issue is found by running liburing/test/io_uring_setup test.
When test run, the testcase "attempt to bind to invalid cpu" would not
pass with messages like:
io_uring_setup(1, 0xbfc2f7c8), \
flags: IORING_SETUP_SQPOLL|IORING_SETUP_SQ_AFF, \
resv: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000, \
sq_thread_cpu: 2
expected -1, got 3
FAIL
On my system, there is:
CPU(s) possible : 0-3
CPU(s) online : 0-1
CPU(s) offline : 2-3
CPU(s) present : 0-1
The sq_thread_cpu 2 is offline on my system, so the bind should fail.
But cpu_possible() will pass the check. We shouldn't be able to bind
to an offline cpu. Use cpu_online() to do the check.
After the change, the testcase run as expected: EINVAL will be returned
for cpu offlined.
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Shenghui Wang <shhuiw@foxmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/uapi')
0 files changed, 0 insertions, 0 deletions