From patchwork Fri Dec 11 08:34:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 58261 Delivered-To: patch@linaro.org Received: by 10.112.157.166 with SMTP id wn6csp4627lbb; Fri, 11 Dec 2015 00:34:46 -0800 (PST) X-Received: by 10.55.21.156 with SMTP id 28mr19131725qkv.7.1449822886521; Fri, 11 Dec 2015 00:34:46 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id u102si19185866qge.90.2015.12.11.00.34.45; Fri, 11 Dec 2015 00:34:46 -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 79E5061FC4; Fri, 11 Dec 2015 08:34:45 +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 87B3661F9D; Fri, 11 Dec 2015 08:34:41 +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 1C1C261FAC; Fri, 11 Dec 2015 08:34:40 +0000 (UTC) Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by lists.linaro.org (Postfix) with ESMTPS id 1372D61D1E for ; Fri, 11 Dec 2015 08:34:39 +0000 (UTC) Received: by pacwq6 with SMTP id wq6so62031411pac.1 for ; Fri, 11 Dec 2015 00:34:38 -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=Vw0TajjFXcCtbuy89vh/19T4FeFY+VUoQRyEsxzArMQ=; b=NaQeJ02e7JGZ1i7Ot2SRE06TPtjxH5fxBNIeM/Gw2amQankSjEOXWluIiWDgcoeeeP GgtiZfuU10bFbYub/3HON3pK+wENFCnZ4iklkQZ03lGt/XJ8IVDQHsj78ZGy16JnmDJc DUT2w+UHvmvxtm3CV9KVfnimgeM5Qfvy/ArzFcKMssjFgydXc1ZdGsjhbb1iXntYDyfj h+pbSdC+1dqYKcUZenCjFZIa7IgBizt3LYEH2hdWiY0/ZpsTr2QVWNyFE4CesNngShb/ ZazHyiRud6Z6cocg7aVK82DHuyey0fk3kDlnlhQnDxZIjtnWOLuNpc+47gOlpcJp8bCV LYLA== 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=Vw0TajjFXcCtbuy89vh/19T4FeFY+VUoQRyEsxzArMQ=; b=HAux5LQ2skzWuV8uhQbnEe9iLnitI1+sccD0/0yXjiJWe5ckwG5I77TmZ1jM4pr3gj nggK3thW9dKWuXv99COZbrxOhXiXo61WBib7as8De6GUMCIlh+RZkSKFu6JGNlJPRBhS ex1fntYKiahC5BPRhG2KjHBh4GL7QXaTnyPfMdCk+9pQb3kmgEYQ4RjN3xhCk1a4A+xi bjfyado4lGQsLJTjqdm3grVBUQhSs2tMjlLdfPEVHVlbG4s2iYtFIc68HnWbSQBFLnZG PmeMo/vkI127iz7sylAuU7a1Xj+U0ScPzcKKgY+xfwD3V8+6sHzYlMBDC7yYLq/Tu3jK ZaZw== X-Gm-Message-State: ALoCoQmCbKtNBzIJTRFee0b3a8HLS1SEUSdBpWRkRHujPrnfsZ+EcFHtXlfrijiCMKkH/Mspvqw3yjZ+ZdA1+1eXpeQEUOUTPw== X-Received: by 10.66.62.137 with SMTP id y9mr23512785par.123.1449822878298; Fri, 11 Dec 2015 00:34:38 -0800 (PST) Received: from bala-Vostro-2520.caveonetworks.com ([111.93.218.67]) by smtp.gmail.com with ESMTPSA id m70sm23348441pfi.65.2015.12.11.00.34.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Dec 2015 00:34:37 -0800 (PST) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Fri, 11 Dec 2015 14:04:30 +0530 Message-Id: <1449822870-20147-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: Classification patch Subject: [lng-odp] [API-NEXT/PATCH] fix: classification: 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 --- 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;