All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lpm: fix overflow issue
@ 2015-02-20 13:16 Igor Ryzhov
       [not found] ` <1424438206-29526-1-git-send-email-iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Igor Ryzhov @ 2015-02-20 13:16 UTC (permalink / raw)
  To: dev-VfR2kkLFssw; +Cc: Igor Ryzhov

LPM table overflow may occur if table is full and added rule has the biggest depth that already have some rules.

Signed-off-by: Igor Ryzhov <iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org>
---
 lib/librte_lpm/rte_lpm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c
index 983e04b..cc51210 100644
--- a/lib/librte_lpm/rte_lpm.c
+++ b/lib/librte_lpm/rte_lpm.c
@@ -298,6 +298,9 @@ rule_add(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth,
 				return rule_index;
 			}
 		}
+
+		if (rule_index == lpm->max_rules)
+			return -ENOSPC;
 	} else {
 		/* Calculate the position in which the rule will be stored. */
 		rule_index = 0;
-- 
1.9.3 (Apple Git-50)

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

* Re: [PATCH] lpm: fix overflow issue
       [not found] ` <1424438206-29526-1-git-send-email-iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org>
@ 2015-02-21 22:56   ` Igor Ryzhov
       [not found]     ` <CAF+s_FyLywggUfOL55qdkzT=kb=RTQ6DiscOcObTn+6+Q+gH4g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2015-02-22 20:29   ` Bruce Richardson
  1 sibling, 1 reply; 6+ messages in thread
From: Igor Ryzhov @ 2015-02-21 22:56 UTC (permalink / raw)
  To: dev-VfR2kkLFssw, bruce.richardson-ral2JQCrhuEAvxtiuMwx3w

Hello again. Will anybody review this patch?
This is really critical issue, because it can lead to memory corruption and
break any program using LPM.

CCing this to Bruce Richardson, because he is maintainer of LPM.

Regards,
Igor Ryzhov

On Fri, Feb 20, 2015 at 4:16 PM, Igor Ryzhov <iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org> wrote:

> LPM table overflow may occur if table is full and added rule has the
> biggest depth that already have some rules.
>
> Signed-off-by: Igor Ryzhov <iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org>
> ---
>  lib/librte_lpm/rte_lpm.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c
> index 983e04b..cc51210 100644
> --- a/lib/librte_lpm/rte_lpm.c
> +++ b/lib/librte_lpm/rte_lpm.c
> @@ -298,6 +298,9 @@ rule_add(struct rte_lpm *lpm, uint32_t ip_masked,
> uint8_t depth,
>                                 return rule_index;
>                         }
>                 }
> +
> +               if (rule_index == lpm->max_rules)
> +                       return -ENOSPC;
>         } else {
>                 /* Calculate the position in which the rule will be
> stored. */
>                 rule_index = 0;
> --
> 1.9.3 (Apple Git-50)
>
>


-- 
Regards,
Igor Ryzhov

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

* Re: [PATCH] lpm: fix overflow issue
       [not found]     ` <CAF+s_FyLywggUfOL55qdkzT=kb=RTQ6DiscOcObTn+6+Q+gH4g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-02-22 18:40       ` Richardson, Bruce
       [not found]         ` <19E2A698-96BB-4CFE-9BCE-50AFB815D24B-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Richardson, Bruce @ 2015-02-22 18:40 UTC (permalink / raw)
  To: Igor Ryzhov; +Cc: dev-VfR2kkLFssw

Sorry I missed this Friday. I'll look at it  shortly.



On 21 Feb 2015, at 22:56, Igor Ryzhov <iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org<mailto:iryzhov@nfware.com>> wrote:

Hello again. Will anybody review this patch?
This is really critical issue, because it can lead to memory corruption and break any program using LPM.

CCing this to Bruce Richardson, because he is maintainer of LPM.

Regards,
Igor Ryzhov

On Fri, Feb 20, 2015 at 4:16 PM, Igor Ryzhov <iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org<mailto:iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org>> wrote:
LPM table overflow may occur if table is full and added rule has the biggest depth that already have some rules.

Signed-off-by: Igor Ryzhov <iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org<mailto:iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org>>
---
 lib/librte_lpm/rte_lpm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c
index 983e04b..cc51210 100644
--- a/lib/librte_lpm/rte_lpm.c
+++ b/lib/librte_lpm/rte_lpm.c
@@ -298,6 +298,9 @@ rule_add(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth,
                                return rule_index;
                        }
                }
+
+               if (rule_index == lpm->max_rules)
+                       return -ENOSPC;
        } else {
                /* Calculate the position in which the rule will be stored. */
                rule_index = 0;
--
1.9.3 (Apple Git-50)




--
Regards,
Igor Ryzhov

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

* Re: [PATCH] lpm: fix overflow issue
       [not found]         ` <19E2A698-96BB-4CFE-9BCE-50AFB815D24B-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2015-02-22 18:47           ` Igor Ryzhov
  0 siblings, 0 replies; 6+ messages in thread
From: Igor Ryzhov @ 2015-02-22 18:47 UTC (permalink / raw)
  To: Richardson, Bruce; +Cc: dev-VfR2kkLFssw

Great. The easiest way to reproduce the issue is to fill LPM table with
rules using only one depth and try to add another one rule with same depth.
Rule will be successfully added and memory will be corrupted.

воскресенье, 22 февраля 2015 г. пользователь Richardson, Bruce написал:

> Sorry I missed this Friday. I'll look at it  shortly.
>
>
>
> On 21 Feb 2015, at 22:56, Igor Ryzhov <iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org <javascript:;>
> <mailto:iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org <javascript:;>>> wrote:
>
> Hello again. Will anybody review this patch?
> This is really critical issue, because it can lead to memory corruption
> and break any program using LPM.
>
> CCing this to Bruce Richardson, because he is maintainer of LPM.
>
> Regards,
> Igor Ryzhov
>
> On Fri, Feb 20, 2015 at 4:16 PM, Igor Ryzhov <iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org
> <javascript:;><mailto:iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org <javascript:;>>> wrote:
> LPM table overflow may occur if table is full and added rule has the
> biggest depth that already have some rules.
>
> Signed-off-by: Igor Ryzhov <iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org <javascript:;><mailto:
> iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org <javascript:;>>>
> ---
>  lib/librte_lpm/rte_lpm.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c
> index 983e04b..cc51210 100644
> --- a/lib/librte_lpm/rte_lpm.c
> +++ b/lib/librte_lpm/rte_lpm.c
> @@ -298,6 +298,9 @@ rule_add(struct rte_lpm *lpm, uint32_t ip_masked,
> uint8_t depth,
>                                 return rule_index;
>                         }
>                 }
> +
> +               if (rule_index == lpm->max_rules)
> +                       return -ENOSPC;
>         } else {
>                 /* Calculate the position in which the rule will be
> stored. */
>                 rule_index = 0;
> --
> 1.9.3 (Apple Git-50)
>
>
>
>
> --
> Regards,
> Igor Ryzhov
>

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

* Re: [PATCH] lpm: fix overflow issue
       [not found] ` <1424438206-29526-1-git-send-email-iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org>
  2015-02-21 22:56   ` Igor Ryzhov
@ 2015-02-22 20:29   ` Bruce Richardson
  2015-02-24  1:09     ` Thomas Monjalon
  1 sibling, 1 reply; 6+ messages in thread
From: Bruce Richardson @ 2015-02-22 20:29 UTC (permalink / raw)
  To: Igor Ryzhov; +Cc: dev-VfR2kkLFssw

On Fri, Feb 20, 2015 at 04:16:46PM +0300, Igor Ryzhov wrote:
> LPM table overflow may occur if table is full and added rule has the biggest depth that already have some rules.
> 
> Signed-off-by: Igor Ryzhov <iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org>
Acked-by: Bruce Richardson <bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

> ---
>  lib/librte_lpm/rte_lpm.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c
> index 983e04b..cc51210 100644
> --- a/lib/librte_lpm/rte_lpm.c
> +++ b/lib/librte_lpm/rte_lpm.c
> @@ -298,6 +298,9 @@ rule_add(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth,
>  				return rule_index;
>  			}
>  		}
> +
> +		if (rule_index == lpm->max_rules)
> +			return -ENOSPC;
>  	} else {
>  		/* Calculate the position in which the rule will be stored. */
>  		rule_index = 0;
> -- 
> 1.9.3 (Apple Git-50)
> 

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

* Re: [PATCH] lpm: fix overflow issue
  2015-02-22 20:29   ` Bruce Richardson
@ 2015-02-24  1:09     ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2015-02-24  1:09 UTC (permalink / raw)
  To: Igor Ryzhov; +Cc: dev-VfR2kkLFssw

2015-02-22 20:29, Bruce Richardson:
> On Fri, Feb 20, 2015 at 04:16:46PM +0300, Igor Ryzhov wrote:
> > LPM table overflow may occur if table is full and added rule has the biggest depth that already have some rules.
> > 
> > Signed-off-by: Igor Ryzhov <iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org>
> Acked-by: Bruce Richardson <bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Applied, thanks

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

end of thread, other threads:[~2015-02-24  1:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-20 13:16 [PATCH] lpm: fix overflow issue Igor Ryzhov
     [not found] ` <1424438206-29526-1-git-send-email-iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org>
2015-02-21 22:56   ` Igor Ryzhov
     [not found]     ` <CAF+s_FyLywggUfOL55qdkzT=kb=RTQ6DiscOcObTn+6+Q+gH4g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-02-22 18:40       ` Richardson, Bruce
     [not found]         ` <19E2A698-96BB-4CFE-9BCE-50AFB815D24B-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-22 18:47           ` Igor Ryzhov
2015-02-22 20:29   ` Bruce Richardson
2015-02-24  1:09     ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.