From patchwork Mon Mar 2 18:46:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 45301 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 65F00214B5 for ; Mon, 2 Mar 2015 18:47:36 +0000 (UTC) Received: by wggy19 with SMTP id y19sf25068185wgg.1 for ; Mon, 02 Mar 2015 10:47:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=U3PsZgTnJRa4OdBxKh7KVt+WRD5SW3j+2BCaBSY2HeY=; b=AWFfKgYx9wabH66bQehgZf8XJdXnUKZmZcpjne1G1DAwnvrsdM8lVOAcesAFSZds+W nFOFfkjkZpM0ML0vQrAPwSu9BR1L/aCpAblzLOepVAgEAzPZnNlhAmigTBIKvZPVmnzk /OT8Rx/sXfByiu/Ocun5c8fiWUzRbZLPWWYZa3KWcdHquQ2Y28My46vq0uogaZDkHrFi CeR6vNIoCIEt5QM0UoVg7+/xdkRf1aQWdmf2JUY5no0wd9ecO3n9p9aYseS/Yx0z1MCi qcLRTsdLWHx/qDo1QGAI+MhwmvgMWCd9c393FsNoIy38QYHfiMnT+9hxhPVqMvauQ6WQ b1Zg== X-Gm-Message-State: ALoCoQn+SE4iiax4HjpS+14vaq1ibHTXwK1ZSMiM6K/0CM7Ret1Vnpeq3c7DOzDCSIZdVNUCAn0v X-Received: by 10.180.80.35 with SMTP id o3mr2477234wix.0.1425322055674; Mon, 02 Mar 2015 10:47:35 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.203.133 with SMTP id kq5ls528787lac.32.gmail; Mon, 02 Mar 2015 10:47:35 -0800 (PST) X-Received: by 10.152.245.38 with SMTP id xl6mr25689529lac.68.1425322055499; Mon, 02 Mar 2015 10:47:35 -0800 (PST) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id jc4si9491196lbc.53.2015.03.02.10.47.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Mar 2015 10:47:35 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by labgf13 with SMTP id gf13so7789663lab.10 for ; Mon, 02 Mar 2015 10:47:35 -0800 (PST) X-Received: by 10.152.116.18 with SMTP id js18mr25790344lab.106.1425322055379; Mon, 02 Mar 2015 10:47:35 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp89963lbj; Mon, 2 Mar 2015 10:47:34 -0800 (PST) X-Received: by 10.140.236.73 with SMTP id h70mr52394135qhc.41.1425322054215; Mon, 02 Mar 2015 10:47:34 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id m3si7644769qaz.39.2015.03.02.10.47.33 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 02 Mar 2015 10:47:34 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YSVNL-0008BO-EB; Mon, 02 Mar 2015 18:47:31 +0000 Received: from mail-lb0-f179.google.com ([209.85.217.179]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YSVN3-00087u-3W for lng-odp@lists.linaro.org; Mon, 02 Mar 2015 18:47:13 +0000 Received: by lbiz11 with SMTP id z11so6124108lbi.3 for ; Mon, 02 Mar 2015 10:47:07 -0800 (PST) X-Received: by 10.152.87.3 with SMTP id t3mr25781656laz.19.1425322027570; Mon, 02 Mar 2015 10:47:07 -0800 (PST) Received: from cipriantemp.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id i13sm2696725lab.38.2015.03.02.10.47.06 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Mar 2015 10:47:06 -0800 (PST) From: Ciprian Barbu To: lng-odp@lists.linaro.org Date: Mon, 2 Mar 2015 20:46:47 +0200 Message-Id: <1425322017-14636-3-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1425322017-14636-1-git-send-email-ciprian.barbu@linaro.org> References: <1425322017-14636-1-git-send-email-ciprian.barbu@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH NETMAP 02/12] linux-netmap: pktio: fix invalid ring crash X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ciprian.barbu@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Ciprian Barbu --- platform/linux-netmap/odp_packet_netmap.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/linux-netmap/odp_packet_netmap.c b/platform/linux-netmap/odp_packet_netmap.c index 6243040..47a15cb 100644 --- a/platform/linux-netmap/odp_packet_netmap.c +++ b/platform/linux-netmap/odp_packet_netmap.c @@ -239,6 +239,9 @@ int recv_pkt_netmap(pkt_netmap_t * const pkt_nm, odp_packet_t pkt_table[], rxring = NETMAP_RXRING(pkt_nm->nm_desc->nifp, ringid); } + if (ringid == pkt_nm->end) + break; + limit = len - nb_rx; if (nm_ring_space(rxring) < limit) limit = nm_ring_space(rxring); @@ -352,6 +355,9 @@ int send_pkt_netmap(pkt_netmap_t * const pkt_nm, odp_packet_t pkt_table[], txring = NETMAP_TXRING(pkt_nm->nm_desc->nifp, ringid); } + if (ringid == pkt_nm->end) + break; + limit = len - nb_tx; if (nm_ring_space(txring) < limit) limit = nm_ring_space(txring);