From patchwork Fri Dec 11 09:23:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 58265 Delivered-To: patch@linaro.org Received: by 10.112.157.166 with SMTP id wn6csp6252lbb; Fri, 11 Dec 2015 01:23:28 -0800 (PST) X-Received: by 10.140.102.10 with SMTP id v10mr21377433qge.63.1449825808377; Fri, 11 Dec 2015 01:23:28 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id a18si150252qkb.114.2015.12.11.01.23.28; Fri, 11 Dec 2015 01:23:28 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: by lists.linaro.org (Postfix, from userid 109) id D403761FC7; Fri, 11 Dec 2015 09:23:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id E8FE161D8C; Fri, 11 Dec 2015 09:23:23 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 61DD461D8D; Fri, 11 Dec 2015 09:23:21 +0000 (UTC) Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com [209.85.220.41]) by lists.linaro.org (Postfix) with ESMTPS id 9825561D87 for ; Fri, 11 Dec 2015 09:23:20 +0000 (UTC) Received: by padhk6 with SMTP id hk6so22709567pad.2 for ; Fri, 11 Dec 2015 01:23:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=zJlskRVGqnGPYpWo4IVlyCrbYr9ob3Roft43dZNd7dw=; b=Cg5p8cDiKOPvrcoV8QtZs3J8tYpg0xTkmFdyflEDxhpf0neG9dNcQRJy5tQ1FQbpFR 67OSF8nK54IST8TzPVRknzSfH5VaebIGP2Jvs+JTUYaBb76oCNU5u53G4uy1uPcip3LQ Y2o7xUrZ8pRO/FIIhg4C/44ca2D7RFLiQVizwtf9MhQE05UqSTJGJwH/yV2NWo/iGIQB L1c5kZB+C5djTnhN92jdVMSU1JY0JOpgWV/aFQJ0t7TGjKCto5HrtYMX7AWiXGteKSQN 1dyB5D+iKRK5Tj+ar6Xy9VbElQHGvB6qrxap6BcRRPXZZNpQitz+Bonb9UnjAuxhgCRG UBJg== 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=zJlskRVGqnGPYpWo4IVlyCrbYr9ob3Roft43dZNd7dw=; b=CvZ54cA9k00mYYvKGKSukAc+IzspytAE75CocHzac7QY0IiM3U6xiGX55CTTNd1V7a GeLCCLcpPgKQgEaZ+Oid7OSXuf3IsdbOynxpZJirR+O94Vmj9dJ43Ji8EkMSPGmrFV5q ChwQwEVf7MKviUzVBq9qwbgaiWbs0wdOpqldeTNuREwjDveU6TBi1EaQP7niMqfQSp5Z jXdYufLR5xWE9uIIuMQtLL8QoIGQ8zlH/VWoz/2SyhA0mAaGCsbtjCrSHqN0YjVBbbNv wT4AJZXPUaItSmDGGgKm2IdZPTsw/3784dHMx38KxiNbr2wfs+0cQPEHNPrpCcOjR5OJ 4fBg== X-Gm-Message-State: ALoCoQmAg3axXioty1/NOnfcZWXQBJ7ofa0cr24SqjMEPKpD4dHf9n9t3SlGW1CrO1U70iNuA+eYX0HatPu5Gf9SIBohi0xInA== X-Received: by 10.66.102.4 with SMTP id fk4mr23797052pab.85.1449825799838; Fri, 11 Dec 2015 01:23:19 -0800 (PST) Received: from bala-Vostro-2520.caveonetworks.com ([111.93.218.67]) by smtp.gmail.com with ESMTPSA id sg4sm24097148pac.48.2015.12.11.01.23.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Dec 2015 01:23:19 -0800 (PST) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Fri, 11 Dec 2015 14:53:12 +0530 Message-Id: <1449825792-14038-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [API-NEXT/PATCHv2] pktio: linux-generic: add null check for pool assigned to CoS X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" 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" Fixes a crash caused by pool not assigned to CoS. Signed-off-by: Balasubramanian Manoharan Reviewed-and-Tested-by: Maxim Uvarov --- v2: patch subject updated to ODP format platform/linux-generic/pktio/pktio_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/linux-generic/pktio/pktio_common.c b/platform/linux-generic/pktio/pktio_common.c index 1fb10a0..1ed3260 100644 --- a/platform/linux-generic/pktio/pktio_common.c +++ b/platform/linux-generic/pktio/pktio_common.c @@ -26,12 +26,13 @@ int _odp_packet_cls_enq(pktio_entry_t *pktio_entry, _odp_cls_parse(&pkt_hdr, base); cos = pktio_select_cos(pktio_entry, (uint8_t *)base, &pkt_hdr); - pool = cos->s.pool->s.pool_hdl; /* if No CoS found then drop the packet */ - if (cos == NULL || cos->s.queue == NULL) + if (cos == NULL || cos->s.queue == NULL || cos->s.pool == NULL) return 0; + pool = cos->s.pool->s.pool_hdl; + pkt = odp_packet_alloc(pool, buf_len); if (odp_unlikely(pkt == ODP_PACKET_INVALID)) return 0;