nandsim: correct test to avoid out-of-bounds access
Previously nandsim_chip_status returned EINVAL iff both of user-provided chip->ctrl_num and chip->num were out of bounds. If only one failed the bounds check arbitrary memory would be read and returned. The NAND framework is not built by default, nandsim is not intended for production use (it is a simulator), and the nandsim device has root-only permissions. admbugs: 827 Reported by: Daniel Hodson of elttam MFC after: 3 days Security: kernel information leak or DoS Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
c6d750cdc7
commit
08e5a1f70b
@ -295,7 +295,7 @@ nandsim_chip_status(struct sim_chip *chip)
|
||||
nand_debug(NDBG_SIM,"status for chip num:%d at ctrl:%d", chip->num,
|
||||
chip->ctrl_num);
|
||||
|
||||
if (chip->ctrl_num >= MAX_SIM_DEV &&
|
||||
if (chip->ctrl_num >= MAX_SIM_DEV ||
|
||||
chip->num >= MAX_CTRL_CS)
|
||||
return (EINVAL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user