diff options
author | Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org> | 2021-10-29 15:29:45 +0200 |
---|---|---|
committer | Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org> | 2022-03-02 11:19:37 +0100 |
commit | 1767024ccd62fe7212679d959527eb445767d01a (patch) | |
tree | ec751e3c2d971e69b497bdb6ee4dfe9991d6bc9d | |
parent | 2c4fdd8fb33adc5c98677c7d5c87687c405be868 (diff) | |
download | illumos-gate-1767024ccd62fe7212679d959527eb445767d01a.tar.gz |
14528 nvme should return ENOTSUP for ioctls not supported by the hardware
Reviewed by: Andrew Giles <agiles@tintri.com>
Reviewed by: Guy Morrogh <gmorrogh@tintri.com>
Reviewed by: Robert Mustacchi <rm+illumos@fingolfin.org>
Reviewed by: Andy Fiddaman <andy@omnios.org>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/uts/common/io/nvme/nvme.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/usr/src/uts/common/io/nvme/nvme.c b/usr/src/uts/common/io/nvme/nvme.c index 77117adda0..c2aeda2e8a 100644 --- a/usr/src/uts/common/io/nvme/nvme.c +++ b/usr/src/uts/common/io/nvme/nvme.c @@ -4662,7 +4662,7 @@ nvme_ioctl_get_features(nvme_t *nvme, int nsid, nvme_ioctl_t *nioc, return (EINVAL); } } else if (res != 0) { - return (EINVAL); + return (ENOTSUP); } break; @@ -4777,7 +4777,7 @@ nvme_ioctl_format(nvme_t *nvme, int nsid, nvme_ioctl_t *nioc, int mode, * Check whether the FORMAT NVM command is supported. */ if (nvme->n_idctl->id_oacs.oa_format == 0) - return (EINVAL); + return (ENOTSUP); /* * Don't allow format or secure erase of individual namespace if that @@ -4908,6 +4908,9 @@ nvme_ioctl_firmware_download(nvme_t *nvme, int nsid, nvme_ioctl_t *nioc, if ((mode & FWRITE) == 0 || secpolicy_sys_config(cred_p, B_FALSE) != 0) return (EPERM); + if (nvme->n_idctl->id_oacs.oa_firmware == 0) + return (ENOTSUP); + if (nsid != 0) return (EINVAL); @@ -4989,6 +4992,9 @@ nvme_ioctl_firmware_commit(nvme_t *nvme, int nsid, nvme_ioctl_t *nioc, if ((mode & FWRITE) == 0 || secpolicy_sys_config(cred_p, B_FALSE) != 0) return (EPERM); + if (nvme->n_idctl->id_oacs.oa_firmware == 0) + return (ENOTSUP); + if (nsid != 0) return (EINVAL); |