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

Commit 336c4649 authored by Mayank Rana's avatar Mayank Rana
Browse files

f_gsi: Update max_pkt_size based on speed instead of using ep desc value



USB endpoints are enabled and disabled from interrupt context whereas
IPA and GSI related operations are performed in work context. Commit
41d5c6f1 "f_gsi: Pass 64 byte as max_pkt_size to IPA driver") used
endpoint related descriptor information to update max_pkt_size which
is resulting into NULL pointer dereference when there is race condition
happening between EVT_CONNECT_IN_PROGRESS event based operations and
USB endpoint being disabled from gsi_disable(). Hence fix this issue
by updating max_pkt_size based on speed instead of using value from
endpoint descriptor.

Change-Id: Ide82c2542674f25e8ebfd3d5cd0e77592d3611d4
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent f9d020d2
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -585,8 +585,13 @@ static int ipa_connect_channels(struct gsi_data_port *d_port)
	}

	/* Populate connection params */
	conn_params->max_pkt_size =
		le16_to_cpu(d_port->in_ep->desc->wMaxPacketSize);
	if (cdev->gadget->speed >= USB_SPEED_SUPER)
		conn_params->max_pkt_size = IPA_USB_SUPER_SPEED_1024B;
	else if (cdev->gadget->speed == USB_SPEED_HIGH)
		conn_params->max_pkt_size = IPA_USB_HIGH_SPEED_512B;
	else
		conn_params->max_pkt_size = IPA_USB_FULL_SPEED_64B;

	log_event_dbg("%s(): max_pkt_size:%d\n", __func__,
		conn_params->max_pkt_size);
	conn_params->ipa_to_usb_xferrscidx =