From patchwork Tue Jan 26 11:38:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 60446 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp1901260lbb; Tue, 26 Jan 2016 03:38:57 -0800 (PST) X-Received: by 10.140.148.81 with SMTP id 78mr28864975qhu.17.1453808337469; Tue, 26 Jan 2016 03:38:57 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id v64si6658725qkv.48.2016.01.26.03.38.56; Tue, 26 Jan 2016 03:38:57 -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 Received: by lists.linaro.org (Postfix, from userid 109) id C6281616BA; Tue, 26 Jan 2016 11:38:56 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=OwfWF2LQ; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, 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 5EE2061625; Tue, 26 Jan 2016 11:38:53 +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 95FAD61695; Tue, 26 Jan 2016 11:38:50 +0000 (UTC) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) by lists.linaro.org (Postfix) with ESMTPS id AF7336160F for ; Tue, 26 Jan 2016 11:38:49 +0000 (UTC) Received: by mail-lf0-f51.google.com with SMTP id m198so103076430lfm.0 for ; Tue, 26 Jan 2016 03:38:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=FGc7zZO87ELIojl/ectCnEfg2Rl2N8TMa40HJiiCtbE=; b=OwfWF2LQGYtMFfhpf2vmH3MXWFxV+l28eIwjDDd8imYgcE4ZvCqOyZmPDZ03oI/3/U sCOmoJ76LlG1AaRGlRlvS8Z9uQQCGU4fNRST05APq5Bylf8hnLjQhDyqViZT4hQTYdSL KIMgVPtx3wvCh2FRuE0SxbryBm5bS1tvEjiOw= 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=FGc7zZO87ELIojl/ectCnEfg2Rl2N8TMa40HJiiCtbE=; b=ifMlJ8wQ0Y8VrhIpv9dj/tO+odu/ELaAqf0VHXOQ7i+as41U6PY1YnrkitxXg2zB/S XKV7t72t8UEw+LG+0HYrzxVdM4CAKJiD8BtT61E3iwG8Kvr6850R7gUdRibAhNcSpgc8 8a8EUlMDMP4CfwA/Dxm0e7r2/AAUPqP4xmTr/q6Lnm4pT2EMngWcTrccjcqKvHbqUizG XKTpDEpXK6M637pS6+y0N/CEtzQNNGMqgdkLJs6eMyTMyIyHdLQM2c+mFYjClyrDQHht ACdIn7wubbEGRUhM/XMMqpjKFNe318eJLE3D0PpfPdwQ31r8G+KMKRMCVMBu1dhPWrvy R0sg== X-Gm-Message-State: AG10YOQdFj1W4hJ+pt8u9Te1sXzZ+NTEuNMDQ6NYzxAl5ktQKloRl9AkiJ3YGRFUPrNL4WGt3uk= X-Received: by 10.25.136.139 with SMTP id k133mr8493108lfd.157.1453808328285; Tue, 26 Jan 2016 03:38:48 -0800 (PST) Received: from localhost.localdomain (ppp91-76-173-134.pppoe.mtu-net.ru. [91.76.173.134]) by smtp.gmail.com with ESMTPSA id um4sm135276lbb.1.2016.01.26.03.38.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Jan 2016 03:38:47 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Tue, 26 Jan 2016 14:38:42 +0300 Message-Id: <1453808322-6775-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [PATCH] linux-generic: queue: check invalid handle in odp_queue_destroy 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" Avoid seg. fault if invalid handle provided to queue destroy. Reviewed-by: Zoltan Kiss Signed-off-by: Maxim Uvarov --- platform/linux-generic/odp_queue.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index e39176c..7f11478 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -308,6 +308,9 @@ int odp_queue_destroy(odp_queue_t handle) queue_entry_t *queue; queue = queue_to_qentry(handle); + if (handle == ODP_QUEUE_INVALID) + return -1; + LOCK(&queue->s.lock); if (queue->s.status == QUEUE_STATUS_FREE) { UNLOCK(&queue->s.lock);