[PATCH 5/6] android/hal: Verify if command response service ID match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Received response service ID should match command service ID in
command, abort if it doesn't.
---
 android/hal-ipc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/android/hal-ipc.c b/android/hal-ipc.c
index 97a3d29..8f13e88 100644
--- a/android/hal-ipc.c
+++ b/android/hal-ipc.c
@@ -335,6 +335,12 @@ int hal_ipc_cmd(uint8_t service_id, uint8_t opcode, uint16_t len, void *param,
 		exit(EXIT_FAILURE);
 	}
 
+	if (hal_msg.service_id != service_id) {
+		error("Invalid service id (%u vs %u), aborting",
+					hal_msg.service_id, service_id);
+		exit(EXIT_FAILURE);
+	}
+
 	if (ret != (ssize_t) (sizeof(hal_msg) + hal_msg.len)) {
 		error("Malformed response received(%zd bytes), aborting", ret);
 		exit(EXIT_FAILURE);
-- 
1.8.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux