]> asedeno.scripts.mit.edu Git - linux.git/commit
nvme: fix the dangerous reference of namespaces list
authorJianchao Wang <jianchao.w.wang@oracle.com>
Mon, 12 Feb 2018 12:54:44 +0000 (20:54 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 26 Mar 2018 14:53:43 +0000 (08:53 -0600)
commit6f8e0d787e3727ed70116e3523f4ecb86887c000
treef6a40039e4fc34a35c5775cd2b30cc8172340da1
parent9a915a5be7dc320743034a17394e08eb438baf33
nvme: fix the dangerous reference of namespaces list

nvme_remove_namespaces and nvme_remove_invalid_namespaces reference
the ctrl->namespaces list w/o holding namespaces_mutext. It is ok
to invoke nvme_ns_remove there, but what if there is others.

To be safer, reference the ctrl->namespaces list under
namespaces_mutext.

Reviewed-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/host/core.c