mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-27 22:51:31 +00:00
media: dm1105: Limit number of cards to avoid buffer over read
dm1105_probe() counts number of cards at dm1105_devcount, but missed bounds check before dereference a card array. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
817dc4b579
commit
65b40a986f
1 changed files with 3 additions and 0 deletions
|
@ -986,6 +986,9 @@ static int dm1105_probe(struct pci_dev *pdev,
|
|||
int ret = -ENOMEM;
|
||||
int i;
|
||||
|
||||
if (dm1105_devcount >= ARRAY_SIZE(card))
|
||||
return -ENODEV;
|
||||
|
||||
dev = kzalloc(sizeof(struct dm1105_dev), GFP_KERNEL);
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
|
|
Loading…
Reference in a new issue