提交 c428b70c 编写于 作者: B Bjørn Mork 提交者: Greg Kroah-Hartman

USB: cdc-wdm: updating desc->length must be protected by spin_lock

wdm_in_callback() will also touch this field, so we cannot change it without locking

Cc: stable@vger.kernel.org
Signed-off-by: NBjørn Mork <bjorn@mork.no>
Acked-by: NOliver Neukum <oneukum@suse.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 1097cceb
...@@ -467,7 +467,9 @@ static ssize_t wdm_read ...@@ -467,7 +467,9 @@ static ssize_t wdm_read
for (i = 0; i < desc->length - cntr; i++) for (i = 0; i < desc->length - cntr; i++)
desc->ubuf[i] = desc->ubuf[i + cntr]; desc->ubuf[i] = desc->ubuf[i + cntr];
spin_lock_irq(&desc->iuspin);
desc->length -= cntr; desc->length -= cntr;
spin_unlock_irq(&desc->iuspin);
/* in case we had outstanding data */ /* in case we had outstanding data */
if (!desc->length) if (!desc->length)
clear_bit(WDM_READ, &desc->flags); clear_bit(WDM_READ, &desc->flags);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册