patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Jin Yu <jin.yu@intel.com>
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>,
	Tiwei Bie <tiwei.bie@intel.com>,
	Zhihong Wang <zhihong.wang@intel.com>,
	dev@dpdk.org, stable@dpdk.org
Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] examples/vhost_blk: fix the TOCTOU
Date: Tue, 26 Nov 2019 10:25:55 +0000	[thread overview]
Message-ID: <20191126102555.GA1629@bricha3-MOBL.ger.corp.intel.com> (raw)
In-Reply-To: <20191126153214.7952-1-jin.yu@intel.com>

On Tue, Nov 26, 2019 at 11:32:14PM +0800, Jin Yu wrote:
> Fix the time of check time of use warning in example code
> 
> Coverity issue: 350589 158663
> Fixes: c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Jin Yu <jin.yu@intel.com>
> ---
>  examples/vhost_blk/vhost_blk.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/examples/vhost_blk/vhost_blk.c b/examples/vhost_blk/vhost_blk.c
> index 3182a488b..bcb4ebb0b 100644
> --- a/examples/vhost_blk/vhost_blk.c
> +++ b/examples/vhost_blk/vhost_blk.c
> @@ -993,11 +993,7 @@ vhost_blk_ctrlr_construct(const char *ctrlr_name)
>  	}
>  	snprintf(dev_pathname, sizeof(dev_pathname), "%s/%s", path, ctrlr_name);
>  
> -	if (access(dev_pathname, F_OK) != -1) {
> -		if (unlink(dev_pathname) != 0)
> -			rte_exit(EXIT_FAILURE, "Cannot remove %s.\n",
> -				 dev_pathname);
> -	}
> +	unlink(dev_pathname);
>  

The original code did an exit if the delete failed, do you intend there to
be a behaviour change here? You can probably get the same behaviour if you
check the errno on an unlink failure, e.g. ENOENT means file doesn't exist.

If not having the app exit on unlink failure is reasonable behaviour then
ignore this comment.

Regards,
/Bruce


  reply	other threads:[~2019-11-26 10:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26 15:32 [dpdk-stable] " Jin Yu
2019-11-26 10:25 ` Bruce Richardson [this message]
2019-11-27  2:36   ` [dpdk-stable] [dpdk-dev] " Yu, Jin
2019-11-27  9:35     ` Bruce Richardson
2020-01-14  9:32     ` Maxime Coquelin
2020-02-11  9:33 ` [dpdk-stable] [PATCH v2] " Jin Yu
2020-02-12 12:54   ` Jin Yu
2020-02-13 16:28   ` Maxime Coquelin

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=20191126102555.GA1629@bricha3-MOBL.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=jin.yu@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    --cc=tiwei.bie@intel.com \
    --cc=zhihong.wang@intel.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).