Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c428b70c authored by Bjørn Mork's avatar Bjørn Mork Committed by Greg Kroah-Hartman
Browse files

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: default avatarBjørn Mork <bjorn@mork.no>
Acked-by: default avatarOliver Neukum <oneukum@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 1097cceb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -467,7 +467,9 @@ static ssize_t wdm_read
	for (i = 0; i < desc->length - cntr; i++)
		desc->ubuf[i] = desc->ubuf[i + cntr];

	spin_lock_irq(&desc->iuspin);
	desc->length -= cntr;
	spin_unlock_irq(&desc->iuspin);
	/* in case we had outstanding data */
	if (!desc->length)
		clear_bit(WDM_READ, &desc->flags);