OSDN Git Service

media: coda: fix memory corruption in case more than 32 instances are opened
authorPhilipp Zabel <p.zabel@pengutronix.de>
Tue, 6 Nov 2018 10:40:54 +0000 (05:40 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Fri, 23 Nov 2018 10:19:39 +0000 (05:19 -0500)
commit649cfc2bdfeeb98ff7d8fdff0af3f8fb9c8da50f
tree8065841baf7a7126c64a6bb5e0e9f13f9b3f11c9
parentc45fbdf24c61a7b7a37f1b3bbd46f054637a3627
media: coda: fix memory corruption in case more than 32 instances are opened

The ffz() return value is undefined if the instance mask does not
contain any zeros. If it returned 32, the following set_bit would
corrupt the debugfs_root pointer.
Switch to IDA for context index allocation. This also removes the
artificial 32 instance limit for all except CodaDx6.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/coda/coda-common.c
drivers/media/platform/coda/coda.h