From patchwork Tue Feb 24 12:33:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 44940 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7F0D820502 for ; Tue, 24 Feb 2015 12:33:27 +0000 (UTC) Received: by wghl18 with SMTP id l18sf3716430wgh.3 for ; Tue, 24 Feb 2015 04:33:26 -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: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=QRRuqF3hcL+AND9ZmbManhzmBtTL5ZS1jsoFZBSEG/U=; b=mOtEwSPfvH4zXZUVDTX7qTWlpei3+6P95sXyiAyWDN3W9U7eU2SjA0oe825MGmucZG Izh7uMdFQImNqLhzNsCFjmpzi/L/UG9ZuPAf/oA9X5dRVpgMePZY00DIew8WeprQrYxZ XvVPvEaR4QaRsq20l4F5XE+jozkkGJZWca5mpknUXIFPsyl447D/4rkiEXAUPNYt4dPN bK3v1OwhNCgGbR66J9DJ51XA6sELXyiefk4R1Xbhf3Zs63Qylb++kNx4Ew6SSRok97xn mbrbnf7We5hLeeWqvb/dyj5RvKWEdyuNyXK6wK2LetJmHLiTdwB5lHUF+Dq1T6WxFm5l oVZw== X-Gm-Message-State: ALoCoQkQE0bUh6tV2LvTBHCig2yXLA6vX/Q/0Ubg/BTvwiBxz7FHRwHo8Yj4ce5Dxuvds3EAEPVb X-Received: by 10.112.146.65 with SMTP id ta1mr2091485lbb.19.1424781206715; Tue, 24 Feb 2015 04:33:26 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.104 with SMTP id r8ls73578lar.48.gmail; Tue, 24 Feb 2015 04:33:26 -0800 (PST) X-Received: by 10.112.13.38 with SMTP id e6mr14392570lbc.31.1424781206567; Tue, 24 Feb 2015 04:33:26 -0800 (PST) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id px6si5578664lbb.142.2015.02.24.04.33.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Feb 2015 04:33:26 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by labgq15 with SMTP id gq15so25391451lab.6 for ; Tue, 24 Feb 2015 04:33:26 -0800 (PST) X-Received: by 10.152.21.201 with SMTP id x9mr3468153lae.72.1424781206152; Tue, 24 Feb 2015 04:33:26 -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 h5csp1879942lbj; Tue, 24 Feb 2015 04:33:25 -0800 (PST) X-Received: by 10.140.97.203 with SMTP id m69mr34767678qge.39.1424781204896; Tue, 24 Feb 2015 04:33:24 -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 18si30745137qhf.41.2015.02.24.04.33.23 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 24 Feb 2015 04:33:24 -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 1YQEfx-0001pK-6G; Tue, 24 Feb 2015 12:33:21 +0000 Received: from mail-la0-f43.google.com ([209.85.215.43]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YQEfr-0001pC-3x for lng-odp@lists.linaro.org; Tue, 24 Feb 2015 12:33:15 +0000 Received: by labhv19 with SMTP id hv19so2658993lab.10 for ; Tue, 24 Feb 2015 04:33:09 -0800 (PST) X-Received: by 10.112.133.132 with SMTP id pc4mr14294564lbb.33.1424781189155; Tue, 24 Feb 2015 04:33:09 -0800 (PST) Received: from localhost.localdomain ([80.77.38.170]) by mx.google.com with ESMTPSA id ki7sm4525191lbc.13.2015.02.24.04.33.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Feb 2015 04:33:08 -0800 (PST) From: Taras Kondratiuk To: lng-odp@lists.linaro.org Date: Tue, 24 Feb 2015 14:33:04 +0200 Message-Id: <1424781184-31277-1-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: timers patch Subject: [lng-odp] [PATCH] linux-generic: timer: fix allocation from an empty pool 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: taras.kondratiuk@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.49 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 Allocation timeout from an empty pool causes segmentation fault because an invalid event it passed to odp_timeout_from_event() which eventually calls _odp_buffer_type() with ODP_BUFFER_INVALID. Check allocated buffer before passing it further. Signed-off-by: Taras Kondratiuk Reviewed-by: Bill Fischofer --- platform/linux-generic/odp_timer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index 7b5fe15..61a02b6 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -845,6 +845,8 @@ void *odp_timeout_user_ptr(odp_timeout_t tmo) odp_timeout_t odp_timeout_alloc(odp_pool_t pool) { odp_buffer_t buf = odp_buffer_alloc(pool); + if (odp_unlikely(buf == ODP_BUFFER_INVALID)) + return ODP_TIMEOUT_INVALID; return odp_timeout_from_event(odp_buffer_to_event(buf)); }