From: Szymon Janc <szymon.janc@tieto.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: Szymon Janc <szymon.janc@tieto.com>
Subject: [PATCH 5/6] android/hal: Verify if command response service ID match
Date: Wed, 23 Oct 2013 15:46:25 +0200 [thread overview]
Message-ID: <1382535986-30684-5-git-send-email-szymon.janc@tieto.com> (raw)
In-Reply-To: <1382535986-30684-1-git-send-email-szymon.janc@tieto.com>
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
next prev parent reply other threads:[~2013-10-23 13:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-23 13:46 [PATCH 1/6] android: Add missing adapter state values to IPC documentation Szymon Janc
2013-10-23 13:46 ` [PATCH 2/6] android: Add missing adapter state values to IPC header Szymon Janc
2013-10-23 13:46 ` [PATCH 3/6] android/hal: Fix crash while receiving notification Szymon Janc
2013-10-23 13:46 ` [PATCH 4/6] android: Send notification on adapter power state change Szymon Janc
2013-10-23 13:46 ` Szymon Janc [this message]
2013-10-23 13:46 ` [PATCH 6/6] android: Fix use of invalid service ID in response Szymon Janc
2013-10-23 16:34 ` [PATCH 1/6] android: Add missing adapter state values to IPC documentation Johan Hedberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1382535986-30684-5-git-send-email-szymon.janc@tieto.com \
--to=szymon.janc@tieto.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox