mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
nvme: identify-namespace without CAP_SYS_ADMIN
Allow all identify-namespace variants (CNS 00h, 05h and 08h) without requiring CAP_SYS_ADMIN. The information (retrieved using id-ns) is needed to form IO commands for passthrough interface. Signed-off-by: Kanchan Joshi <joshi.k@samsung.com> Reviewed-by: Jens Axboe <axboe@kernel.dk> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
855b7717f4
commit
e4fbcf32c8
1 changed files with 16 additions and 2 deletions
|
@ -22,9 +22,23 @@ static bool nvme_cmd_allowed(struct nvme_ns *ns, struct nvme_command *c,
|
||||||
c->common.opcode == nvme_fabrics_command)
|
c->common.opcode == nvme_fabrics_command)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* do not allow unprivileged admin commands */
|
/*
|
||||||
if (!ns)
|
* Do not allow unprivileged passthrough of admin commands except
|
||||||
|
* for a subset of identify commands that contain information required
|
||||||
|
* to form proper I/O commands in userspace and do not expose any
|
||||||
|
* potentially sensitive information.
|
||||||
|
*/
|
||||||
|
if (!ns) {
|
||||||
|
if (c->common.opcode == nvme_admin_identify) {
|
||||||
|
switch (c->identify.cns) {
|
||||||
|
case NVME_ID_CNS_NS:
|
||||||
|
case NVME_ID_CNS_CS_NS:
|
||||||
|
case NVME_ID_CNS_NS_CS_INDEP:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Only allow I/O commands that transfer data to the controller if the
|
* Only allow I/O commands that transfer data to the controller if the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue