From: "Tetsuya.Mukawa" <mukawa@igel.co.jp>
To: dev@dpdk.org, thomas.monjalon@6wind.com
Subject: Re: [dpdk-dev] [PATCH] pci: fix closing an unopened file descriptor
Date: Wed, 04 Sep 2013 16:38:21 +0900 [thread overview]
Message-ID: <5226E36D.1090004@igel.co.jp> (raw)
In-Reply-To: <1378280075-2076-1-git-send-email-mukawa@igel.co.jp>
Hi Thomas,
I've sent the patch to fix an uninitialized variable access.
Could you please check it?
I will send ver.2 patch if I need.
Thanks,
Tetsuya Mukawa
(2013/09/04 16:34), Tetsuya Mukawa wrote:
> If CONFIG_RTE_EAL_UNBIND_PORTS is set and virtio-net is used, an unopened
> file descriptor will be illegally closed in the finalized phase of EAL.
> The fix adds a correct initial value to the file descriptor, and check it
> before closing it.
>
> Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
> ---
> lib/librte_eal/linuxapp/eal/eal_pci.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
> index c793148..7c04ba3 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_pci.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
> @@ -519,6 +519,8 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
> dev->addr.devid = devid;
> dev->addr.function = function;
>
> + dev->intr_handle.fd = -1;
> +
> /* get vendor id */
> rte_snprintf(filename, sizeof(filename), "%s/vendor", dirname);
> if (eal_parse_sysfs_value(filename, &tmp) < 0) {
> @@ -718,7 +720,8 @@ pci_exit_process(struct rte_pci_device *dev)
> RTE_LOG(ERR, EAL, "Error with munmap\n");
> return -1;
> }
> - if (close(dev->intr_handle.fd) == -1){
> + if ((dev->intr_handle.fd != -1) &&
> + (close(dev->intr_handle.fd) == -1)) {
> RTE_LOG(ERR, EAL, "Error closing interrupt handle\n");
> return -1;
> }
next prev parent reply other threads:[~2013-09-04 7:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-04 7:34 Tetsuya Mukawa
2013-09-04 7:38 ` Tetsuya.Mukawa [this message]
2013-09-12 15:28 ` 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=5226E36D.1090004@igel.co.jp \
--to=mukawa@igel.co.jp \
--cc=dev@dpdk.org \
--cc=thomas.monjalon@6wind.com \
/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).