[PATCH 02/13] gobi: Clear out service request queue on shutdown

Denis Kenzior <[email protected]>
Newsgroups dev.linux.lists.ofono
Message-ID <[email protected]>
Not doing so can result in a crash on subsequent .enable() calls

ofonod[365853]: #0  0x743188e15ae0 in /usr/lib/libc.so.6
ofonod[365853]: #1  0x472b94 in request_service_cb() at plugins/gobi.c:475
ofonod[365853]: #2  0x45ce9f in qmux_create_client_callback() at drivers/qmimodem/qmi.c:1448
ofonod[365853]: #3  0x45bd87 in __rx_ctl_message() at drivers/qmimodem/qmi.c:993
ofonod[365853]: #4  0x45bf97 in received_qmux_data() at drivers/qmimodem/qmi.c:1041
ofonod[365853]: #5  0x597df3 in io_callback() at ell/io.c:105 (discriminator 1)
ofonod[365853]: #6  0x59674a in l_main_iterate() at ell/main.c:461
ofonod[365853]: #7  0x508898 in event_check() at src/main.c:183
ofonod[365853]: #8  0x743189073ae1 in /usr/lib/libglib-2.0.so.0
ofonod[365853]: #9  0x7431890d4816 in /usr/lib/libglib-2.0.so.0
ofonod[365853]: #10 0x743189073787 in /usr/lib/libglib-2.0.so.0
ofonod[365853]: #11 0x508d35 in main() at src/main.c:302
ofonod[365853]: #12 0x743188dfec88 in /usr/lib/libc.so.6
ofonod[365853]: #13 0x743188dfed4c in /usr/lib/libc.so.6
---
 plugins/gobi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/plugins/gobi.c b/plugins/gobi.c
index cb20824cc424..b2c9c3d50ea4 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -251,6 +251,10 @@ static void shutdown_cb(void *user_data)
 	DBG("");
 
 	data->discover_attempts = 0;
+	memset(&data->service_requests, 0, sizeof(data->service_requests));
+	data->cur_service_request = 0;
+	data->num_service_requests = 0;
+	data->features = 0;
 
 	qmi_qmux_device_free(data->device);
 	data->device = NULL;
-- 
2.45.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.