From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ob0-f172.google.com (mail-ob0-f172.google.com [209.85.214.172]) by dpdk.org (Postfix) with ESMTP id 9ED54B515 for ; Sat, 21 Feb 2015 23:56:47 +0100 (CET) Received: by mail-ob0-f172.google.com with SMTP id nt9so30658821obb.3 for ; Sat, 21 Feb 2015 14:56:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=Hv61LF2ryNbMF25ex6zSU4DMKQW+5pPZwB6j6WVCEmo=; b=HVi2KgHlUB6j7hXj2596Nnoyhm1pp0bgCcP2EDXZvpl0IYET0AlE8I4fe7v5CQ0md1 369AG/EQ80KA96i5V4uBBq+xa2pUMpjZhvnFMliLT/DHIlHNdsoy0HN4RQAXNM2As4bU cwFPwmuxBJI2D+qkre6u3mRjsZL9xShxoBCmcG0A/1TjZDNBQzBbP+IHopeBbU+X/UXl QJPHv/zf+NK+2lxXFi4rp1IZmjSVj0hAKDT8WRxFFV0uhlgfOwSOKlKJ9qNrKqvILNHo 2rwxcsj3zhRPv5vk2UXTNuV9FGZQoQ6G+VjWjWsMyLdwQ4dxLI8BKl9+MQwkRgV2Bp64 btOw== X-Gm-Message-State: ALoCoQnSu3ma2A1KoMYXSHA7F9HUW6iUwXzaYbC7d+xuK5+n9YcofhBfu/BBS4rAGRrlpQl0XcxO MIME-Version: 1.0 X-Received: by 10.202.216.68 with SMTP id p65mr2771180oig.4.1424559407028; Sat, 21 Feb 2015 14:56:47 -0800 (PST) Received: by 10.60.80.233 with HTTP; Sat, 21 Feb 2015 14:56:46 -0800 (PST) X-Originating-IP: [46.138.87.188] In-Reply-To: <1424438206-29526-1-git-send-email-iryzhov@nfware.com> References: <1424438206-29526-1-git-send-email-iryzhov@nfware.com> Date: Sun, 22 Feb 2015 02:56:46 +0400 Message-ID: From: Igor Ryzhov To: dev@dpdk.org, bruce.richardson@intel.com Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Feb 2015 22:56:47 -0000 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 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 > --- > 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