From: Szymon Janc <szymon.janc@tieto.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: Szymon Janc <szymon.janc@tieto.com>
Subject: [RFC 02/14] android: Use IPC command sanity checks
Date: Wed, 6 Nov 2013 15:09:18 +0100 [thread overview]
Message-ID: <1383746970-25906-3-git-send-email-szymon.janc@tieto.com> (raw)
In-Reply-To: <1383746970-25906-1-git-send-email-szymon.janc@tieto.com>
Make deamon checks received IPC commands for correctness.
---
android/main.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/android/main.c b/android/main.c
index 75004cf..85ea270 100644
--- a/android/main.c
+++ b/android/main.c
@@ -236,13 +236,8 @@ static gboolean cmd_watch_cb(GIOChannel *io, GIOCondition cond,
goto fail;
}
- if (ret < (ssize_t) sizeof(*msg)) {
- error("HAL command too small, terminating (%zd)", ret);
- goto fail;
- }
-
- if (ret != (ssize_t) (sizeof(*msg) + msg->len)) {
- error("Malformed HAL command (%zd bytes), terminating", ret);
+ if (!hal_cmd_check(msg, msg->payload, ret)) {
+ error("IPC protocol error, terminating");
goto fail;
}
--
1.8.4.2
next prev parent reply other threads:[~2013-11-06 14:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-06 14:09 [RFC 00/14] IPC sanity checks Szymon Janc
2013-11-06 14:09 ` [RFC 01/14] android: Add HAL IPC commands sanity check Szymon Janc
2013-11-07 8:44 ` Johan Hedberg
2013-11-06 14:09 ` Szymon Janc [this message]
2013-11-06 14:09 ` [RFC 03/14] android: Add HAL IPC message response sanity checks Szymon Janc
2013-11-06 14:09 ` [RFC 04/14] android/hal: Use IPC command responses " Szymon Janc
2013-11-06 14:09 ` [RFC 05/14] android: Add HAL IPC events sanity check Szymon Janc
2013-11-06 14:09 ` [RFC 06/14] android/hal: Use IPC notifications sanity checks Szymon Janc
2013-11-06 14:09 ` [RFC 07/14] android: Remove not needed HAL_MINIMUM_EVENT define Szymon Janc
2013-11-06 14:09 ` [RFC 08/14] android: Remove not needed buf len from Core service functions Szymon Janc
2013-11-06 14:09 ` [RFC 09/14] android: Remove not needed buf len from Bluetooth " Szymon Janc
2013-11-06 14:09 ` [RFC 10/14] android: Remove not needed buf len from Hidhost " Szymon Janc
2013-11-06 14:09 ` [RFC 11/14] android: Remove not needed buf len from Socket " Szymon Janc
2013-11-06 14:09 ` [RFC 12/14] android/hal: Remove not neede buf len from bluetooth HAL Szymon Janc
2013-11-06 14:09 ` [RFC 13/14] android/hal: Remove not neede buf len from hidhost HAL Szymon Janc
2013-11-06 14:09 ` [RFC 14/14] android/hal: Remove not neede buf len from av HAL Szymon Janc
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=1383746970-25906-3-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