]> git.baikalelectronics.ru Git - kernel.git/commit
nvme: disallow passthru cmd from targeting a nsid != nsid of the block dev
authorNiklas Cassel <niklas.cassel@wdc.com>
Fri, 26 Mar 2021 19:48:00 +0000 (19:48 +0000)
committerChristoph Hellwig <hch@lst.de>
Tue, 6 Apr 2021 06:34:38 +0000 (08:34 +0200)
commit72339bd7576214b1a51904ba3530f2f5552a7647
tree028709e097c6971a29b39540ba21e1cf1b0ce775
parent953937b4d0c7cd8766f4224d1da72932e1cb6105
nvme: disallow passthru cmd from targeting a nsid != nsid of the block dev

When a passthru command targets a specific namespace, the ns parameter to
nvme_user_cmd()/nvme_user_cmd64() is set. However, there is currently no
validation that the nsid specified in the passthru command targets the
namespace/nsid represented by the block device that the ioctl was
performed on.

Add a check that validates that the nsid in the passthru command matches
that of the supplied namespace.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Javier González <javier@javigon.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/core.c