]> git.baikalelectronics.ru Git - kernel.git/commit
[media] media-device: better lock media_device_unregister()
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 15 Dec 2015 10:36:51 +0000 (08:36 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 11 Jan 2016 14:19:15 +0000 (12:19 -0200)
commitf15ee467daa84736aa0cc8a018ab18f4c2946490
treec43c57c89f2be2b72dee12183172af907436a999
parent02500484eefe73e924da74c2e0aad55a8ac4551e
[media] media-device: better lock media_device_unregister()

If media_device_unregister() is called by two different
drivers, a race condition may happen, as the check if the
device is not registered is not protected.

Move the spin_lock() to happen earlier in the function, in order
to prevent such race condition.

Reported-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/media-device.c