aboutsummaryrefslogtreecommitdiff
path: root/drivers/fpga/xilinx-spi.c
diff options
context:
space:
mode:
authorHao Xu <[email protected]>2021-08-05 18:05:37 +0800
committerJens Axboe <[email protected]>2021-08-06 08:27:54 -0600
commit3d4e4face9c1548752a2891e98b38b100feee336 (patch)
treed244adacc9c6e3f35303953ec242ba2a6cb47a20 /drivers/fpga/xilinx-spi.c
parent83d6c39310b6d11199179f6384c2b0a415389597 (diff)
io-wq: fix no lock protection of acct->nr_worker
There is an acct->nr_worker visit without lock protection. Think about the case: two callers call io_wqe_wake_worker(), one is the original context and the other one is an io-worker(by calling io_wqe_enqueue(wqe, linked)), on two cpus paralelly, this may cause nr_worker to be larger than max_worker. Let's fix it by adding lock for it, and let's do nr_workers++ before create_io_worker. There may be a edge cause that the first caller fails to create an io-worker, but the second caller doesn't know it and then quit creating io-worker as well: say nr_worker = max_worker - 1 cpu 0 cpu 1 io_wqe_wake_worker() io_wqe_wake_worker() nr_worker < max_worker nr_worker++ create_io_worker() nr_worker == max_worker failed return return But the chance of this case is very slim. Fixes: 685fe7feedb9 ("io-wq: eliminate the need for a manager thread") Signed-off-by: Hao Xu <[email protected]> [axboe: fix unconditional create_io_worker() call] Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'drivers/fpga/xilinx-spi.c')
0 files changed, 0 insertions, 0 deletions