]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
media: hdpvr: fix locking and a missing msleep
authorHans Verkuil <hverkuil@xs4all.nl>
Thu, 20 Jun 2019 11:43:41 +0000 (07:43 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2019 07:12:41 +0000 (09:12 +0200)
commit93ba4c724b8ff6195851583e3f9c5305434019db
treee7c76ee19e4d7d89e2468a2c5d92703e63ceba8f
parente116077a17925b86b4e762f8800fe477f07e4b58
media: hdpvr: fix locking and a missing msleep

[ Upstream commit 6bc5a4a1927556ff9adce1aa95ea408c95453225 ]

This driver has three locking issues:

- The wait_event_interruptible() condition calls hdpvr_get_next_buffer(dev)
  which uses a mutex, which is not allowed. Rewrite with list_empty_careful()
  that doesn't need locking.

- In hdpvr_read() the call to hdpvr_stop_streaming() didn't lock io_mutex,
  but it should have since stop_streaming expects that.

- In hdpvr_device_release() io_mutex was locked when calling flush_work(),
  but there it shouldn't take that mutex since the work done by flush_work()
  also wants to lock that mutex.

There are also two other changes (suggested by Keith):

- msecs_to_jiffies(4000); (a NOP) should have been msleep(4000).
- Change v4l2_dbg to v4l2_info to always log if streaming had to be restarted.

Reported-by: Keith Pyle <kpyle@austin.rr.com>
Suggested-by: Keith Pyle <kpyle@austin.rr.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/usb/hdpvr/hdpvr-video.c