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

Commit 9927d25d authored by Sriharsha Allenki's avatar Sriharsha Allenki
Browse files

usb: ccid: Fix possible scenario of double unlock



There is a possible case of double unlock of the
spinlock ccid_dev->lock when the ccid daemon is trying
to write while the disable is being processed.
Fix this by going to done once the unlock is done.

Also, remove the unnecessary goto at the end of the
function call.

Change-Id: Idab0801cbf9db91e18d933c8088a4af479b8691f
Signed-off-by: default avatarSriharsha Allenki <sallenki@codeaurora.org>
parent ec12b494
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -857,9 +857,9 @@ static ssize_t ccid_bulk_write(struct file *fp, const char __user *buf,
						&bulk_dev->tx_idle)))
						&bulk_dev->tx_idle)))
				ccid_request_free(req, ccid_dev->in);
				ccid_request_free(req, ccid_dev->in);
			r = -ENODEV;
			r = -ENODEV;
			goto done;
		}
		}
		spin_unlock_irqrestore(&ccid_dev->lock, flags);
		spin_unlock_irqrestore(&ccid_dev->lock, flags);
		goto done;
	}
	}
done:
done:
	pr_debug("ccid_bulk_write returning %d\n", r);
	pr_debug("ccid_bulk_write returning %d\n", r);