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

Commit 2c45b6fe authored by Adam Oldham's avatar Adam Oldham Committed by Greg Kroah-Hartman
Browse files

[PATCH] USB: Fix race condition in usblp_write



Initialize status fields in the read and write urbs to prevent a race
condition with open/read/close - open/write/close sequences.

Fixes bug #4432 at bugzilla.kernel.org

Signed-off-by: default avatarAdam Oldham <oldhamca@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5da0106f
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -379,6 +379,8 @@ static int usblp_open(struct inode *inode, struct file *file)
	usblp->writeurb->transfer_buffer_length = 0;
	usblp->writeurb->transfer_buffer_length = 0;
	usblp->wcomplete = 1; /* we begin writeable */
	usblp->wcomplete = 1; /* we begin writeable */
	usblp->rcomplete = 0;
	usblp->rcomplete = 0;
	usblp->writeurb->status = 0;
	usblp->readurb->status = 0;


	if (usblp->bidir) {
	if (usblp->bidir) {
		usblp->readcount = 0;
		usblp->readcount = 0;