linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <chen.ganir@ti.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: Chen Ganir <chen.ganir@ti.com>
Subject: [PATCH] eir: Keep parsed eir_data on error
Date: Wed, 9 May 2012 12:21:15 +0300	[thread overview]
Message-ID: <1336555275-32638-1-git-send-email-chen.ganir@ti.com> (raw)

From: Chen Ganir <chen.ganir@ti.com>

Do not discard already parsed eir_data on eir data length error.
Data corruption may occur, but this does not mean that we need
to ignore already parsed valid eir data
---
 src/eir.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/eir.c b/src/eir.c
index 310cd53..f2f6992 100644
--- a/src/eir.c
+++ b/src/eir.c
@@ -114,10 +114,9 @@ int eir_parse(struct eir_data *eir, uint8_t *eir_data, uint8_t eir_len)
 
 		len += field_len + 1;
 
-		/* Bail out if got incorrect length */
+		/* Do not continue EIR Data parsing if got incorrect length */
 		if (len > eir_len) {
-			eir_data_free(eir);
-			return -EINVAL;
+			return 0;
 		}
 
 		data_len = field_len - 1;
-- 
1.7.0.4


             reply	other threads:[~2012-05-09  9:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-09  9:21 chen.ganir [this message]
2012-05-15  5:46 ` [PATCH] eir: Keep parsed eir_data on error Ganir, Chen
2012-05-15  7:58 ` 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=1336555275-32638-1-git-send-email-chen.ganir@ti.com \
    --to=chen.ganir@ti.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;
as well as URLs for NNTP newsgroup(s).