patches for DPDK stable branches
 help / color / mirror / Atom feed
From: "Xu, Rosen" <rosen.xu@intel.com>
To: "Huang, Wei" <wei.huang@intel.com>, "dev@dpdk.org" <dev@dpdk.org>,
	"Zhang,  Qi Z" <qi.z.zhang@intel.com>
Cc: "stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-stable] [PATCH v2 2/2] raw/ifpga/base: check pointer adapter before dereference
Date: Thu, 5 Nov 2020 11:32:36 +0000
Message-ID: <BYAPR11MB2901C1A16C1215562524EB1089EE0@BYAPR11MB2901.namprd11.prod.outlook.com> (raw)
In-Reply-To: <1604541940-5994-3-git-send-email-wei.huang@intel.com>

Hi,

> -----Original Message-----
> From: Huang, Wei <wei.huang@intel.com>
> Sent: Thursday, November 05, 2020 10:06
> To: dev@dpdk.org; Xu, Rosen <rosen.xu@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Cc: stable@dpdk.org; Huang, Wei <wei.huang@intel.com>
> Subject: [PATCH v2 2/2] raw/ifpga/base: check pointer adapter before
> dereference
> 
> In opae_adapter_destroy(), pointer "adapter" is not validated before passing
> it to opae_adapter_shm_free() and opae_adapter_mutex_close() which
> dereference it.
> 
> Fixes: e41856b515ce ("raw/ifpga/base: enhance driver reliability in multi-
> process") Coverity issue: 363752
> 
> Signed-off-by: Wei Huang <wei.huang@intel.com>
> ---
> v2: fix typo in commit log
> ---
>  drivers/raw/ifpga/base/opae_hw_api.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/raw/ifpga/base/opae_hw_api.c
> b/drivers/raw/ifpga/base/opae_hw_api.c
> index 600afdea1..d5cd5fe60 100644
> --- a/drivers/raw/ifpga/base/opae_hw_api.c
> +++ b/drivers/raw/ifpga/base/opae_hw_api.c
> @@ -605,10 +605,12 @@ int opae_adapter_enumerate(struct opae_adapter
> *adapter)
>   */
>  void opae_adapter_destroy(struct opae_adapter *adapter)  {
> -	if (adapter && adapter->ops && adapter->ops->destroy)
> -		adapter->ops->destroy(adapter);
> -	opae_adapter_shm_free(adapter);
> -	opae_adapter_mutex_close(adapter);
> +	if (adapter) {
> +		if (adapter->ops && adapter->ops->destroy)
> +			adapter->ops->destroy(adapter);
> +		opae_adapter_shm_free(adapter);
> +		opae_adapter_mutex_close(adapter);
> +	}
>  }
> 
>  /**
> --
> 2.29.2

Acked-by: Rosen Xu <rosen.xu@intel.com>

  reply	other threads:[~2020-11-05 11:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05  2:05 [dpdk-stable] [PATCH v2 0/2] raw/ifpga/base: fix defects found by coverity scan Wei Huang
2020-11-05  2:05 ` [dpdk-stable] [PATCH v2 1/2] raw/ifpga/base: unlock mutex when nios init fail Wei Huang
2020-11-05 11:32   ` Xu, Rosen
2020-11-05  2:05 ` [dpdk-stable] [PATCH v2 2/2] raw/ifpga/base: check pointer adapter before dereference Wei Huang
2020-11-05 11:32   ` Xu, Rosen [this message]
2020-11-09  9:41 ` [dpdk-stable] [PATCH v2 0/2] raw/ifpga/base: fix defects found by coverity scan Zhang, Qi Z

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=BYAPR11MB2901C1A16C1215562524EB1089EE0@BYAPR11MB2901.namprd11.prod.outlook.com \
    --to=rosen.xu@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --cc=stable@dpdk.org \
    --cc=wei.huang@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

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git