]> git.baikalelectronics.ru Git - kernel.git/commit
libnvdimm: Out of bounds read in __nd_ioctl()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 25 Feb 2020 16:20:56 +0000 (19:20 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Apr 2020 08:36:42 +0000 (10:36 +0200)
commitc092efaf0cffa69472fec96ec7d7e3dc8f66f7d2
tree5631a1d0b73b4693ba066bec8ad75f4074b3d83b
parent46a5573d3e401987290be783892c0bc459844d79
libnvdimm: Out of bounds read in __nd_ioctl()

[ Upstream commit aaa6448d1985a0d432036721261bd5cae6aaea4e ]

The "cmd" comes from the user and it can be up to 255.  It it's more
than the number of bits in long, it results out of bounds read when we
check test_bit(cmd, &cmd_mask).  The highest valid value for "cmd" is
ND_CMD_CALL (10) so I added a compare against that.

Fixes: 430ef3231e6d ("libnvdimm: control (ioctl) messages for nvdimm_bus and nvdimm devices")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20200225162055.amtosfy7m35aivxg@kili.mountain
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvdimm/bus.c