Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Filter locks in dvb-kernel/linux/drivers/media/dvb/dvb-core/dmxdev.c



When looking closer at your driver code, I think I found the following
potential problem:

The dmxdevfilter mutex is only used during read & ioctl calls to the
queue, however not during write calls.

This might lead to the following:
Suppose you filter for example sections (not with ONE_SHOT) and you
are currently trying to receive (= read) a section.
Then dvb_dmxdev_buffer_read will be called mith locked
dmxdevfilter->mutex. It will first check the queues status - which we
assume is okay.
Suppose furthermore that right now (before dvb_dmxdev_buffer_read
could copy the data), a section arrives which makes the
queue overflow (this can happen since the write calls do not use the
mutex).
What happens now is that the write pointer will be set to the read
pointer and than the dvb_dmxdev_buffer_read will return junk.

Therefore I propose that the lock is set during write calls, too.

Attached you find a patch (untested) for
dvb-kernel/linux/drivers/media/dvb/dvb-core/dmxdev.c

Best regards,
Ralf Gandy

P.S. By the way - I have
a) no clue whether not being able to get a lock right away might have serious side effects.
b) if the state of the queue should also reflect the problem of not
having written a section into it due to the failure to lock the mutex.









---------------------------------------------------
ABACHO@Home
Damit holen Sie sich die ABACHO-Suchfunktion direkt auf Ihre Homepage.
Die Integration unserer hochwertigen Internet-Suche ist unkompliziert,
schnell und kostenlos  http://funktionen.abacho.de/webnapping/

Die Abacho-Surftipps:
- http://www.abacho.com - die pure Suche!
- http://toolbar.abacho.de - viele Features weltweit!
- http://www.abacho.de - Das starke Informationsportal mit taegl. News,
  Stories und starker Suchmaschine

- eBay bietet Ihnen das Beste aus ueber 1,5 Mio.
Angeboten!- http://nl.hi-media.de/?goto=68174.134580.247.1
---------------------------------------------------

Attachment: patch
Description: Binary data


Home | Main Index | Thread Index