diff mbox series

[v2,3/3] qmi: Allow QRTR services to be destroyed

Message ID 20240318183754.71578-3-steve.schrock@getcruise.com (mailing list archive)
State Accepted
Commit a703d1cc8e7edb4c3310b81f179936b547e06fdf
Headers show
Series [v2,1/3] qmi: Discover timeout could cause a crash | expand

Commit Message

Steve Schrock March 18, 2024, 6:37 p.m. UTC
QRTR services were never being destroyed because they were being
created with a reference count of 1 and immediately incrementing the
count to 2.
---
 drivers/qmimodem/qmi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c
index 555a4afe562e..69a28afd1a2a 100644
--- a/drivers/qmimodem/qmi.c
+++ b/drivers/qmimodem/qmi.c
@@ -2582,7 +2582,8 @@  bool qmi_service_create_shared(struct qmi_device *device, uint16_t type,
 			service = service_create(device, info, 0);
 			l_hashmap_insert(device->service_list,
 					L_UINT_TO_PTR(type_val), service);
-		}
+		} else
+			service = qmi_service_ref(service);
 
 		data = l_new(struct service_create_shared_data, 1);
 
@@ -2591,8 +2592,8 @@  bool qmi_service_create_shared(struct qmi_device *device, uint16_t type,
 		data->func = func;
 		data->user_data = user_data;
 		data->destroy = destroy;
+		data->service = service;
 
-		data->service = qmi_service_ref(service);
 		data->idle = l_idle_create(service_create_shared_reply,
 							data, NULL);