Message ID | 20170321170838.7614-1-maxim.uvarov@linaro.org |
---|---|
State | Accepted |
Commit | fd980722c2a99d57ece3ec878d82dd94d03a5e76 |
Headers | show |
ping On 03/21/17 20:08, Maxim Uvarov wrote: > Check unmap return code > https://bugs.linaro.org/show_bug.cgi?id=2831 > > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> > --- > platform/linux-generic/pktio/socket_mmap.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > 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)); >
On Tue, Mar 21, 2017 at 12:08 PM, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: > Check unmap return code > https://bugs.linaro.org/show_bug.cgi?id=2831 > > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> > Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> > --- > platform/linux-generic/pktio/socket_mmap.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > 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)); > -- > 2.11.0.295.gd7dffce > >
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));
Check unmap return code https://bugs.linaro.org/show_bug.cgi?id=2831 Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- platform/linux-generic/pktio/socket_mmap.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) -- 2.11.0.295.gd7dffce