mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 16:29:59 +00:00
Blackfin: add some bounds checking to peripheral_request
The requested peripheral is turned into an index into some state arrays, so make sure the calculated index doesn't exceed the index. This occurs when using bogus pin values or the define headers are screwed up. Now we'll notice right away that something needs fixing instead of trying to track down random memory corruption. Signed-off-by: Barry Song <barry.song@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
298571249a
commit
89e84eeace
1 changed files with 2 additions and 0 deletions
|
@ -762,6 +762,8 @@ int peripheral_request(unsigned short per, const char *label)
|
|||
if (!(per & P_DEFINED))
|
||||
return -ENODEV;
|
||||
|
||||
BUG_ON(ident >= MAX_RESOURCES);
|
||||
|
||||
local_irq_save_hw(flags);
|
||||
|
||||
/* If a pin can be muxed as either GPIO or peripheral, make
|
||||
|
|
Loading…
Reference in a new issue