Commit 07accfa9 authored by Jerry Hoemann's avatar Jerry Hoemann Committed by Dan Williams

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: default avatarJerry Hoemann <jerry.hoemann@hpe.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 4dc0e7be
...@@ -547,10 +547,10 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm, ...@@ -547,10 +547,10 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
/* fail write commands (when read-only) */ /* fail write commands (when read-only) */
if (read_only) if (read_only)
switch (ioctl_cmd) { switch (cmd) {
case ND_IOCTL_VENDOR: case ND_CMD_VENDOR:
case ND_IOCTL_SET_CONFIG_DATA: case ND_CMD_SET_CONFIG_DATA:
case ND_IOCTL_ARS_START: case ND_CMD_ARS_START:
dev_dbg(&nvdimm_bus->dev, "'%s' command while read-only.\n", dev_dbg(&nvdimm_bus->dev, "'%s' command while read-only.\n",
nvdimm ? nvdimm_cmd_name(cmd) nvdimm ? nvdimm_cmd_name(cmd)
: nvdimm_bus_cmd_name(cmd)); : nvdimm_bus_cmd_name(cmd));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment