usb: gadget: f_mass_storage: add missing memory barrier for thread_wakeup_needed
authorUCHINO Satoshi <satoshi.uchino@toshiba.co.jp>
Thu, 23 May 2013 02:10:11 +0000 (11:10 +0900)
committerFelipe Balbi <balbi@ti.com>
Mon, 10 Jun 2013 14:10:34 +0000 (17:10 +0300)
commitd68c277b501889b3a50c179d1c3d704db7947b83
tree6d3b81f4a3279c32f353184dc744697b33f2f958
parenteb127cb519d73c0d0e8089dcbde8c94dc1fc7e20
usb: gadget: f_mass_storage: add missing memory barrier for thread_wakeup_needed

Without this memory barrier, the file-storage thread may fail to
escape from the following while loop, because it may observe new
common->thread_wakeup_needed and old bh->state which are updated by
the callback functions.

/* Wait for the CBW to arrive */
while (bh->state != BUF_STATE_FULL) {
rc = sleep_thread(common);
if (rc)
return rc;
}

Cc: stable@vger.kernel.org
Signed-off-by: UCHINO Satoshi <satoshi.uchino@toshiba.co.jp>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/f_mass_storage.c