DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Tan, Jianfeng" <jianfeng.tan@intel.com>
To: Anatoly Burakov <anatoly.burakov@intel.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 2/2] eal/ipc: fix use-after-free in asynchronous requests
Date: Fri, 13 Apr 2018 23:34:23 +0800	[thread overview]
Message-ID: <2bad2fa0-677e-29ed-23dc-2cfc7d848b9c@intel.com> (raw)
In-Reply-To: <c7fafc231189d9f9287d38b7239306c1e37623dd.1523620361.git.anatoly.burakov@intel.com>



On 4/13/2018 7:55 PM, Anatoly Burakov wrote:
> Previously, we were removing request from the list only if we
> have succeeded to send it. This resulted in leaving an invalid
> pointer in the request list.
>
> Fix this by only adding new requests to the request list if we
> have succeeded in sending them.
>
> Fixes: f05e26051c15 ("eal: add IPC asynchronous request")
> Cc: anatoly.burakov@intel.com
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>

Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>

> ---
>   lib/librte_eal/common/eal_common_proc.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
> index e3eb430..a8ca7b8 100644
> --- a/lib/librte_eal/common/eal_common_proc.c
> +++ b/lib/librte_eal/common/eal_common_proc.c
> @@ -876,9 +876,7 @@ mp_request_async(const char *dst, struct rte_mp_msg *req,
>   	/* queue already locked by caller */
>   
>   	exist = find_sync_request(dst, req->name);
> -	if (!exist) {
> -		TAILQ_INSERT_TAIL(&pending_requests.requests, sync_req, next);
> -	} else {
> +	if (exist) {
>   		RTE_LOG(ERR, EAL, "A pending request %s:%s\n", dst, req->name);
>   		rte_errno = EEXIST;
>   		ret = -1;
> @@ -895,6 +893,7 @@ mp_request_async(const char *dst, struct rte_mp_msg *req,
>   		ret = 0;
>   		goto fail;
>   	}
> +	TAILQ_INSERT_TAIL(&pending_requests.requests, sync_req, next);
>   
>   	param->user_reply.nb_sent++;
>   

  reply	other threads:[~2018-04-13 15:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-13 11:54 [dpdk-dev] [PATCH 1/2] eal/ipc: fix use-after-free in synchronous requests Anatoly Burakov
2018-04-13 11:55 ` [dpdk-dev] [PATCH 2/2] eal/ipc: fix use-after-free in asynchronous requests Anatoly Burakov
2018-04-13 15:34   ` Tan, Jianfeng [this message]
2018-04-13 15:33 ` [dpdk-dev] [PATCH 1/2] eal/ipc: fix use-after-free in synchronous requests Tan, Jianfeng
2018-04-16 23:19   ` 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=2bad2fa0-677e-29ed-23dc-2cfc7d848b9c@intel.com \
    --to=jianfeng.tan@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.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).