]> git.baikalelectronics.ru Git - kernel.git/commit
[media] dvb_demux: fix deadlock in dmx_section_feed_release_filter()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Sat, 9 Nov 2013 21:28:43 +0000 (18:28 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Fri, 29 Nov 2013 14:18:25 +0000 (12:18 -0200)
commitca8f045edd55f1fb1f1cf10d9c078dcc1c726476
tree8b15c43911b272535286e227d5263010a52e2438
parent6065db2c4846b2f4660e3a0697b0bcae75be1a6f
[media] dvb_demux: fix deadlock in dmx_section_feed_release_filter()

dmx_section_feed_release_filter() locks dvbdmx->mutex and
if the feed is still filtering, it calls feed->stop_filtering(feed).
stop_filtering() is implemented by dmx_section_feed_stop_filtering()
that first of all try to lock the same mutex: dvbdmx->mutex.
That leads to a deadlock.
It does not happen often in practice because all callers of
release_filter() stop filtering by themselves.
So the problem can happen in case of race condition only.
The patch releases dvbdmx->mutex before call to feed->stop_filtering(feed)
and reacquires the mutex after that.
Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/dvb-core/dvb_demux.c