Message ID | 1424438206-29526-1-git-send-email-iryzhov@nfware.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 96E2EB6ED; Fri, 20 Feb 2015 14:17:28 +0100 (CET) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43]) by dpdk.org (Postfix) with ESMTP id 7C2E7B6EB for <dev@dpdk.org>; Fri, 20 Feb 2015 14:17:27 +0100 (CET) Received: by labgm9 with SMTP id gm9so6086289lab.2 for <dev@dpdk.org>; Fri, 20 Feb 2015 05:17:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=c5ztNFFivBhPs64Obf8WOrS/YB71tdPkURr7jy2UQLo=; b=Tr0lqTVz8s0vmwffqxpg53BZ+wbVd6LXXYDZj2hK0zpgliJdBJUGGpXn7B9ExhnPAF vRdVTCjDsLIDG1kD+Y2b4AJdMm8KVhYvXbS2argyWSxYEM12K1+DFsw9zK5WQMF8e5/e td3lyT6D1Gn0ZGNm3+7HnYMQ0bjCYAB8mvN8HmHVVupNwc4Buy9vDU3RBAcTqK8voVzO UHx9QpJeY179J/eFXpKA6OgiEU9ZDjFcyjkLuIA5Egv/jevRcfhneFKh8OpDJ4FHtbBc JhaHyxMezU1wNuyUBGPxh7ELT1cjZgoUQliQGoc0/zV67edEwajbF0QtEP+QZFsXs602 nIVQ== X-Gm-Message-State: ALoCoQl8QQewsVa2q7UDG/P+BFl+dLgGAXUq7czhXKkZ7/bm5KqIMS1WD4hLXd6+IYoeXsjYwCLb X-Received: by 10.152.87.178 with SMTP id az18mr8643496lab.122.1424438247155; Fri, 20 Feb 2015 05:17:27 -0800 (PST) Received: from localhost.localdomain (vpn.arccn.ru. [95.182.74.2]) by mx.google.com with ESMTPSA id rk10sm4086873lac.12.2015.02.20.05.17.25 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Feb 2015 05:17:26 -0800 (PST) From: Igor Ryzhov <iryzhov@nfware.com> To: dev@dpdk.org Date: Fri, 20 Feb 2015 16:16:46 +0300 Message-Id: <1424438206-29526-1-git-send-email-iryzhov@nfware.com> X-Mailer: git-send-email 1.9.3 (Apple Git-50) Cc: Igor Ryzhov <iryzhov@nfware.com> Subject: [dpdk-dev] [PATCH] lpm: fix overflow issue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Igor Ryzhov
Feb. 20, 2015, 1:16 p.m. UTC
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@nfware.com>
---
lib/librte_lpm/rte_lpm.c | 3 +++
1 file changed, 3 insertions(+)
Comments
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@nfware.com> 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@nfware.com> > --- > 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) > >
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@nfware.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com> > --- > 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) >
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@nfware.com> > Acked-by: Bruce Richardson <bruce.richardson@intel.com> Applied, thanks
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;