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

Commit d8682453 authored by Rajkumar Raghupathy's avatar Rajkumar Raghupathy Committed by Gerrit - the friendly Code Review server
Browse files

USB: u_ether: Check if port_usb is NULL before accessing



Rndis tx requests are queued to the controller, while disconnect
is in progress. There is a chance of getting the completion of
those requests after dev->port_usb is set to NULL. This leads to
NULL pointer dereference in tx_complete().

Hence, check if dev->port_usb is NULL before accessing it
in tx_complete() and free the current request accordingly.

Change-Id: I42a427f7e51ffe4f81768756d835d123778df260
Signed-off-by: default avatarRajkumar Raghupathy <raghup@codeaurora.org>
Signed-off-by: default avatarAjay Agarwal <ajaya@codeaurora.org>
parent 14681b57
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -511,6 +511,11 @@ static void tx_complete(struct usb_ep *ep, struct usb_request *req)
	int length;
	int retval;

	if (!dev->port_usb) {
		usb_ep_free_request(ep, req);
		return;
	}

	switch (req->status) {
	default:
		dev->net->stats.tx_errors++;