From patchwork Tue Mar 21 17:08:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 95665 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1554812qgd; Tue, 21 Mar 2017 10:35:47 -0700 (PDT) X-Received: by 10.200.41.176 with SMTP id 45mr36053841qts.26.1490117746952; Tue, 21 Mar 2017 10:35:46 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 90si4556427qtf.205.2017.03.21.10.35.46; Tue, 21 Mar 2017 10:35:46 -0700 (PDT) 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 803B8635B5; Tue, 21 Mar 2017 17:35:38 +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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 C78BB60A54; Tue, 21 Mar 2017 17:26:59 +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 1CB1B62DA5; Tue, 21 Mar 2017 17:08:51 +0000 (UTC) Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com [209.85.215.45]) by lists.linaro.org (Postfix) with ESMTPS id DD79E60D81 for ; Tue, 21 Mar 2017 17:08:49 +0000 (UTC) Received: by mail-lf0-f45.google.com with SMTP id a6so69599227lfa.0 for ; Tue, 21 Mar 2017 10:08:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Hq/g2jgc8ljXzailfr74ccYWFHhRwtmDdzADIyX9okA=; b=dfbSZJQAa0sDIe2hOEksBkZ6bxS+5wYmTUqm26GOzqa0BPBqfnizoMo0v3uFJh391J 1sJIBCgsErBqnl44mjM9V6jLvJ/0k4SpZE8NdWkLMqfsco+yCi05dYjDsVGs8mh4IgZJ o4AY+plkUv90VeLhm6vf+ztizDeRwFYd7v2getl4A1QZG96CPzZosJV6ca5CJpmyHZ8a z5fmly778ueVTTLOUSFs8QaTMQrtVvx8apMP1Z1xPr1LmUx9xoX59uVSeh+mH4jSUOXn vR/R/OW0yBLgP277DdW2XaG1rcMfUXk+u8UcjL/x8xYxnYsu+mYQZlNiiq1HKxr1KfYa GqPQ== X-Gm-Message-State: AFeK/H2ZoCjgNewW5+GJ6O0ZQnojt6785GXe8D7is2KLqgx0iv0/eGuWvLx8aUi3NcsL0wpBwvk= X-Received: by 10.25.25.207 with SMTP id 198mr9675011lfz.1.1490116128667; Tue, 21 Mar 2017 10:08:48 -0700 (PDT) Received: from localhost.localdomain (ppp95-165-131-83.pppoe.spdop.ru. [95.165.131.83]) by smtp.gmail.com with ESMTPSA id 91sm3750093lft.17.2017.03.21.10.08.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Mar 2017 10:08:47 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Tue, 21 Mar 2017 20:08:38 +0300 Message-Id: <20170321170838.7614-1-maxim.uvarov@linaro.org> X-Mailer: git-send-email 2.11.0.295.gd7dffce Subject: [lng-odp] [PATCH] linux-gen: pktio: socket mmap: check unmap return code 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Check unmap return code https://bugs.linaro.org/show_bug.cgi?id=2831 Signed-off-by: Maxim Uvarov --- platform/linux-generic/pktio/socket_mmap.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) -- 2.11.0.295.gd7dffce Reviewed-by: Bill Fischofer diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index 666aae6a..fdf8cca5 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -454,11 +454,11 @@ static int mmap_sock(pkt_sock_mmap_t *pkt_sock) return 0; } -static void mmap_unmap_sock(pkt_sock_mmap_t *pkt_sock) +static int mmap_unmap_sock(pkt_sock_mmap_t *pkt_sock) { - munmap(pkt_sock->mmap_base, pkt_sock->mmap_len); free(pkt_sock->rx_ring.rd); free(pkt_sock->tx_ring.rd); + return munmap(pkt_sock->mmap_base, pkt_sock->mmap_len); } static int mmap_bind_sock(pkt_sock_mmap_t *pkt_sock, const char *netdev) @@ -486,8 +486,14 @@ static int mmap_bind_sock(pkt_sock_mmap_t *pkt_sock, const char *netdev) static int sock_mmap_close(pktio_entry_t *entry) { pkt_sock_mmap_t *const pkt_sock = &entry->s.pkt_sock_mmap; + int ret; + + ret = mmap_unmap_sock(pkt_sock); + if (ret != 0) { + ODP_ERR("mmap_unmap_sock() %s\n", strerror(errno)); + return -1; + } - mmap_unmap_sock(pkt_sock); if (pkt_sock->sockfd != -1 && close(pkt_sock->sockfd) != 0) { __odp_errno = errno; ODP_ERR("close(sockfd): %s\n", strerror(errno));