staging: most: hdm-usb: fix race between enqueue and most_stop_enqueue
authorChristian Gromm <christian.gromm@microchip.com>
Fri, 19 Aug 2016 09:12:54 +0000 (11:12 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Aug 2016 14:53:57 +0000 (16:53 +0200)
commitbf9503f11dedf40158a8a5847f2d482bc15cd82b
tree7319082a573eb27c01ede556eed44ded6dd9ef2e
parentcf05918370006fbdb6dc5708ca9951ee8093b8ef
staging: most: hdm-usb: fix race between enqueue and most_stop_enqueue

The "broken in pipe" handler of the USB-HDM calls most_stop_enqueue() to
stop the MBO traffic before returning all MBOs back to the Mostcore.  As
the enqueue() call from the Mostcore may run in parallel with the
most_stop_enqueue(), the HDM may run into the inconsistent state and
crash the kernel.

This patch synchronizes enqueue(), most_stop_enqueue() and
most_resume_enqueue() with a mutex, hence avoiding the race condition.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/most/hdm-usb/hdm_usb.c
drivers/staging/most/mostcore/core.c