linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] eir: Keep parsed eir_data on error
@ 2012-05-09  9:21 chen.ganir
  2012-05-15  5:46 ` Ganir, Chen
  2012-05-15  7:58 ` Johan Hedberg
  0 siblings, 2 replies; 3+ messages in thread
From: chen.ganir @ 2012-05-09  9:21 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Chen Ganir

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] eir: Keep parsed eir_data on error
  2012-05-09  9:21 [PATCH] eir: Keep parsed eir_data on error chen.ganir
@ 2012-05-15  5:46 ` Ganir, Chen
  2012-05-15  7:58 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Ganir, Chen @ 2012-05-15  5:46 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org; +Cc: Ganir, Chen

> -----Original Message-----
> From: Ganir, Chen
> Sent: Wednesday, May 09, 2012 12:21 PM
> To: linux-bluetooth@vger.kernel.org
> Cc: Ganir, Chen
> Subject: [PATCH] eir: Keep parsed eir_data on error
> 
> 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

Ping ?

BR,
Chen Ganir.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] eir: Keep parsed eir_data on error
  2012-05-09  9:21 [PATCH] eir: Keep parsed eir_data on error chen.ganir
  2012-05-15  5:46 ` Ganir, Chen
@ 2012-05-15  7:58 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2012-05-15  7:58 UTC (permalink / raw)
  To: chen.ganir; +Cc: linux-bluetooth

Hi Chen,

On Wed, May 09, 2012, chen.ganir@ti.com wrote:
> 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(-)

Applied, though I did clean it up a little bit (e.g. removing {} and
doing a break instead of a return).

Johan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-15  7:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-09  9:21 [PATCH] eir: Keep parsed eir_data on error chen.ganir
2012-05-15  5:46 ` Ganir, Chen
2012-05-15  7:58 ` Johan Hedberg

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).