Skip to content

Commit

Permalink
libnvdimm: Fix security issue with DSM IOCTL.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jerry Hoemann authored and Dan Williams committed Mar 5, 2016
1 parent 4dc0e7b commit 07accfa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/nvdimm/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 07accfa

Please sign in to comment.