linux_dsm_epyc7002/drivers/media/usb
Kosuke Tatsukawa 5063452ecb [media] media: fix waitqueue_active without memory barrier in cpia2 driver
cpia2_usb_disconnect() seems to be missing a memory barrier which might
cause the waker to not notice the waiter and miss sending a wake_up as
in the following figure.

	cpia2_usb_disconnect			sync
------------------------------------------------------------------------
					mutex_unlock(&cam->v4l2_lock);
if (waitqueue_active(&cam->wq_stream))
/* The CPU might reorder the test for
   the waitqueue up here, before
   prior writes complete */
					/* wait_event_interruptible */
					 /* __wait_event_interruptible */
					  /* ___wait_event */
					  long __int = prepare_to_wait_event(
					    &wq, &__wait, state);
					  if (!cam->streaming ||
					    frame->status == FRAME_READY)
cam->curbuff->status = FRAME_READY;
cam->curbuff->length = 0;
					  schedule()
------------------------------------------------------------------------

The attached patch removes the call to waitqueue_active() leaving just
wake_up() behind.  This fixes the problem because the call to
spin_lock_irqsave() in wake_up() will be an ACQUIRE operation.

I found this issue when I was looking through the linux source code
for places calling waitqueue_active() before wake_up*(), but without
preceding memory barriers, after sending a patch to fix a similar
issue in drivers/tty/n_tty.c  (Details about the original issue can be
found here: https://lkml.org/lkml/2015/9/28/849).

Signed-off-by: Kosuke Tatsukawa <tatsu@ab.jp.nec.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:55:06 -02:00
..
airspy [media] media: videobuf2: Change queue_setup argument 2015-10-20 14:48:39 -02:00
as102 [media] as102: fix error return code 2015-05-01 07:00:51 -03:00
au0828 [media] media: videobuf2: Change queue_setup argument 2015-10-20 14:48:39 -02:00
b2c2 [media] drivers: media: usb: b2c2: use usb_*_coherent() instead of pci_*_consistent() in flexcop-usb.c 2013-10-17 11:26:41 -03:00
cpia2 [media] media: fix waitqueue_active without memory barrier in cpia2 driver 2015-11-17 14:55:06 -02:00
cx231xx [media] cx231xx: fix bulk transfer mode 2015-11-17 14:53:41 -02:00
dvb-usb [media] Technisat SkyStar USB HD,(DVB-S/S2) too much URBs for arm devices 2015-08-11 14:43:23 -03:00
dvb-usb-v2 media updates for v4.4-rc1 2015-11-05 12:05:15 -08:00
em28xx [media] include/media: move driver interface headers to a separate dir 2015-11-17 06:57:29 -02:00
go7007 [media] go7007: fix broken test 2015-11-17 14:33:41 -02:00
gspca [media] gspca: ov534/topro: prevent a division by 0 2015-11-17 14:54:25 -02:00
hackrf [media] hackrf: do not set human readable name for formats 2015-10-20 15:55:28 -02:00
hdpvr [media] include/media: split I2C headers from V4L2 core 2015-11-17 06:57:11 -02:00
msi2500 [media] media: videobuf2: Change queue_setup argument 2015-10-20 14:48:39 -02:00
pvrusb2 [media] media/usb/pvrusb2: Support for V4L2_CTRL_WHICH_DEF_VAL 2015-11-17 14:46:44 -02:00
pwc [media] media: videobuf2: Change queue_setup argument 2015-10-20 14:48:39 -02:00
s2255 [media] media: videobuf2: Change queue_setup argument 2015-10-20 14:48:39 -02:00
siano [media] siano: avoid a linkedit error if !MC 2015-03-02 14:17:01 -03:00
stk1160 [media] include/media: split I2C headers from V4L2 core 2015-11-17 06:57:11 -02:00
stkwebcam [media] stk-webcam: Delete an unnecessary check before the function call "vfree" 2015-03-02 14:53:27 -03:00
tm6000 [media] include/media: split I2C headers from V4L2 core 2015-11-17 06:57:11 -02:00
ttusb-budget [media] dvb: Get rid of typedev usage for enums 2015-06-09 17:47:35 -03:00
ttusb-dec [media] dvb: get rid of enum dmx_success 2015-10-06 19:53:02 -03:00
usbtv [media] media: videobuf2: Change queue_setup argument 2015-10-20 14:48:39 -02:00
usbvision [media] include/media: split I2C headers from V4L2 core 2015-11-17 06:57:11 -02:00
uvc [media] usb/uvc: Support for V4L2_CTRL_WHICH_DEF_VAL 2015-11-17 14:46:21 -02:00
zr364xx [media] usb drivers: use BUG_ON() instead of if () BUG 2015-06-09 18:30:09 -03:00
Kconfig [media] tlg2300: move to staging in preparation for removal 2014-12-16 23:21:43 -02:00
Makefile [media] tlg2300: move to staging in preparation for removal 2014-12-16 23:21:43 -02:00