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

Commit e79189cc authored by Arumuga Durai A's avatar Arumuga Durai A
Browse files

USB: android: Fix gsmd_setup() error path cleanup on sigkill



gsmd_setup might fail if userspace kills adbd while
usb_add_config was executed in its context. This results
in alloc_workqueue failure followed by gport_setup bailing
out without proper cleanup. Due to this next time when
adbd starts no_smd_ports exceeds the allow limit so serial
function bind_config fails. Fix this by perform cleanup when
gport_setup fails.

CRs-Fixed: 1098860
Change-Id: Ic54a588b5232029b3598f38645afdbe70b70f927
Signed-off-by: default avatarArumuga Durai A <cadurai@codeaurora.org>
parent e5c91c68
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1930,6 +1930,7 @@ static int serial_function_bind_config(struct android_usb_function *f,
	err = gport_setup(c);
	if (err) {
		pr_err("serial: Cannot setup transports");
		gserial_deinit_port();
		goto out;
	}

+8 −0
Original line number Diff line number Diff line
@@ -1211,6 +1211,14 @@ int gserial_init_port(int port_num, const char *name,
	return ret;
}

void gserial_deinit_port(void)
{
	no_char_bridge_ports = 0;
	no_tty_ports = 0;
	no_smd_ports = 0;
	no_hsic_sports = 0;
	nr_ports = 0;
}

bool gserial_is_connected(void)
{
+1 −0
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@ extern int gport_setup(struct usb_configuration *c);
extern void gport_cleanup(void);
extern int gserial_init_port(int port_num, const char *name,
					const char *port_name);
extern void gserial_deinit_port(void);
extern bool gserial_is_connected(void);
extern bool gserial_is_dun_w_softap_enabled(void);
extern void gserial_dun_w_softap_enable(bool enable);