From: "Wiles, Keith" <keith.wiles@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 3/4] net/tap: fix file descriptor leak on error
Date: Wed, 7 Nov 2018 10:02:50 +0000 [thread overview]
Message-ID: <4DF969B8-7809-490B-8393-010184DD1AA0@intel.com> (raw)
In-Reply-To: <20181106193005.5383-4-stephen@networkplumber.org>
> On Nov 6, 2018, at 7:30 PM, Stephen Hemminger <stephen@networkplumber.org> wrote:
>
> If netlink socket setup fails the file descriptor was leaked.
Acked-by: Keith Wiles <keith.wiles@intel.com>
>
> Coverity issue: 257040
> Fixes: 7c25284e30c2 ("net/tap: add netlink back-end for flow API")
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> drivers/net/tap/tap_netlink.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/tap/tap_netlink.c b/drivers/net/tap/tap_netlink.c
> index 6cb510092218..14bbbec754f6 100644
> --- a/drivers/net/tap/tap_netlink.c
> +++ b/drivers/net/tap/tap_netlink.c
> @@ -51,14 +51,17 @@ tap_nl_init(uint32_t nl_groups)
> }
> if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &sndbuf_size, sizeof(int))) {
> TAP_LOG(ERR, "Unable to set socket buffer send size");
> + close(fd);
> return -1;
> }
> if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &rcvbuf_size, sizeof(int))) {
> TAP_LOG(ERR, "Unable to set socket buffer receive size");
> + close(fd);
> return -1;
> }
> if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
> TAP_LOG(ERR, "Unable to bind to the netlink socket");
> + close(fd);
> return -1;
> }
> return fd;
> --
> 2.17.1
>
Regards,
Keith
next prev parent reply other threads:[~2018-11-07 10:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-06 19:30 [dpdk-dev] [PATCH 0/4] Coverity issue fixes Stephen Hemminger
2018-11-06 19:30 ` [dpdk-dev] [PATCH 1/4] net/failsafe: avoid rte_memcpy if rte_realloc fails Stephen Hemminger
2018-11-07 6:30 ` Andrew Rybchenko
2018-11-07 18:15 ` Stephen Hemminger
2018-11-08 6:20 ` Andrew Rybchenko
2018-11-06 19:30 ` [dpdk-dev] [PATCH 2/4] bus/vmbus: fix directory handle leak on error Stephen Hemminger
2018-11-06 19:30 ` [dpdk-dev] [PATCH 3/4] net/tap: fix file descriptor " Stephen Hemminger
2018-11-07 10:02 ` Wiles, Keith [this message]
2018-11-06 19:30 ` [dpdk-dev] [PATCH 4/4] net/tap: fix warning about comparison of fd Stephen Hemminger
2018-11-07 10:03 ` Wiles, Keith
2018-11-14 1:00 ` [dpdk-dev] [PATCH 0/4] Coverity issue fixes Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4DF969B8-7809-490B-8393-010184DD1AA0@intel.com \
--to=keith.wiles@intel.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).