summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJerry Hoemann <jerry.hoemann@hpe.com>2016-01-06 16:03:41 -0700
committerDan Williams <dan.j.williams@intel.com>2016-03-05 12:24:06 -0800
commit07accfa9d1a8bac8262f6d24a94a54d2d1f35149 (patch)
treee1c5fa13f27d8094d61a630d47cd1f6a621d3443 /drivers
parent4dc0e7be884e0f99211107dd75e6e1884b7b3754 (diff)
downloadop-kernel-dev-07accfa9d1a8bac8262f6d24a94a54d2d1f35149.zip
op-kernel-dev-07accfa9d1a8bac8262f6d24a94a54d2d1f35149.tar.gz
libnvdimm: Fix security issue with DSM IOCTL.
Code attempts to prevent certain IOCTL DSM from being called when device is opened read only. This security feature can be trivially overcome by changing the size portion of the ioctl_command which isn't used. Check only the _IOC_NR (i.e. the command). Cc: <stable@vger.kernel.org> Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/nvdimm/bus.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index f85227a..2e9ac22 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -547,10 +547,10 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
/* fail write commands (when read-only) */
if (read_only)
- switch (ioctl_cmd) {
- case ND_IOCTL_VENDOR:
- case ND_IOCTL_SET_CONFIG_DATA:
- case ND_IOCTL_ARS_START:
+ switch (cmd) {
+ case ND_CMD_VENDOR:
+ case ND_CMD_SET_CONFIG_DATA:
+ case ND_CMD_ARS_START:
dev_dbg(&nvdimm_bus->dev, "'%s' command while read-only.\n",
nvdimm ? nvdimm_cmd_name(cmd)
: nvdimm_bus_cmd_name(cmd));
OpenPOWER on IntegriCloud