hdpvr: fix iteration over uninitialized lists in hdpvr_probe()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Wed, 3 Jul 2013 19:17:34 +0000 (16:17 -0300)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 26 Oct 2013 20:06:02 +0000 (21:06 +0100)
commit9eb9bfa030d8a49d54f0e4ae671e33f406bbbeff
treebb8ba92107101028dd554552174100b39e90c8b9
parent559a2e36f047ac7e1ab27c489322cfd1409dd842
hdpvr: fix iteration over uninitialized lists in hdpvr_probe()

commit 2e923a0527ac439e135b9961e58d3acd876bba10 upstream.

free_buff_list and rec_buff_list are initialized in the middle of hdpvr_probe(),
but if something bad happens before that, error handling code calls hdpvr_delete(),
which contains iteration over the lists (via hdpvr_free_buffers()).
The patch moves the lists initialization to the beginning and by the way fixes
goto label in error handling of registering videodev.
Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[bwh: Backported to 3.2: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/media/video/hdpvr/hdpvr-core.c