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

Commit 99ea54d1 authored by Hemant Kumar's avatar Hemant Kumar
Browse files

usb: u_bam_data: Invalidate prod and cons client handles upon connect



Producer and consumer USB BAM pipe client handles are zero initialized
which is a valid value for a client handle. It is possible that only
consumer pipe is connected in connect work and disconnect interrupt
comes and sets the state as U_BAM_DATA_DISCONNECT_E. When connect work
gets a chance to run due to disconnect it disconnects both producer and
consumer pipes by checking if handle is valid. This results in calling
disconnect on a client handle which is not connected yet. Hence
invalidate both pipe's client handle first before calling pipe connect.
Also, let disconnect work perform disconnect of producer and consumer
pipes instead of calling usb_bam_disconnect_ipa() from connect work.

CRs-Fixed: 788805
Change-Id: I3c36d2bb926265f96793d7968aa75963319b4991
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
parent 0f7d8a53
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -906,6 +906,8 @@ static void bam2bam_data_connect_work(struct work_struct *w)
	if (d->trans == USB_GADGET_XPORT_BAM2BAM_IPA) {

		d->ipa_params.usb_connection_speed = gadget->speed;
		d->ipa_params.cons_clnt_hdl = -1;
		d->ipa_params.prod_clnt_hdl = -1;

		if (d->dst_pipe_type != USB_BAM_PIPE_BAM2BAM) {
			spin_unlock_irqrestore(&port->port_lock, flags);
@@ -1188,7 +1190,9 @@ static void bam2bam_data_connect_work(struct work_struct *w)
	return;

disconnect_ipa:
	usb_bam_disconnect_ipa(&d->ipa_params);
	/* let disconnect work take care of ipa disconnect */
	port->is_ipa_connected = true;
	return;
}

/*