DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Ouyang, Changchun" <changchun.ouyang@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
	"Xie, Huawei" <huawei.xie@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 3/3] virtio: fix possible NULL dereference
Date: Mon, 31 Aug 2015 01:07:17 +0000	[thread overview]
Message-ID: <F52918179C57134FAEC9EA62FA2F962511CEC61A@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1440779019-10793-4-git-send-email-stephen@networkplumber.org>



> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Saturday, August 29, 2015 12:24 AM
> To: Xie, Huawei; Ouyang, Changchun
> Cc: dev@dpdk.org; Stephen Hemminger
> Subject: [PATCH 3/3] virtio: fix possible NULL dereference
> 
> Found by Coverity. In virtio_dev_queue_release if the queue pointer is NULL,
> then driver is dereferencing it to get hw pointer.
> Also, don't do useless assignment
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>

> ---
>  drivers/net/virtio/virtio_ethdev.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c
> b/drivers/net/virtio/virtio_ethdev.c
> index 338d891..914c73d 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -239,15 +239,15 @@ virtio_set_multiple_queues(struct rte_eth_dev
> *dev, uint16_t nb_queues)
> 
>  void
>  virtio_dev_queue_release(struct virtqueue *vq) {
> -	struct virtio_hw *hw = vq->hw;
> 
>  	if (vq) {
> +		struct virtio_hw *hw = vq->hw;
> +
>  		/* Select and deactivate the queue */
>  		VIRTIO_WRITE_REG_2(hw, VIRTIO_PCI_QUEUE_SEL, vq-
> >queue_id);
>  		VIRTIO_WRITE_REG_4(hw, VIRTIO_PCI_QUEUE_PFN, 0);
> 
>  		rte_free(vq);
> -		vq = NULL;
>  	}
>  }
> 
> --
> 2.1.4

  reply	other threads:[~2015-08-31  1:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-28 16:23 [dpdk-dev] [PATCH 0/3] virtio: patches for 2.1+ Stephen Hemminger
2015-08-28 16:23 ` [dpdk-dev] [PATCH 1/3] virtio: don't report link state feature unless available Stephen Hemminger
2015-08-31  2:54   ` Ouyang, Changchun
2015-08-28 16:23 ` [dpdk-dev] [PATCH 2/3] virtio: fix Coverity unsigned warnings Stephen Hemminger
2015-08-31  1:38   ` Ouyang, Changchun
2015-08-31 16:44     ` Stephen Hemminger
2015-08-28 16:23 ` [dpdk-dev] [PATCH 3/3] virtio: fix possible NULL dereference Stephen Hemminger
2015-08-31  1:07   ` Ouyang, Changchun [this message]
2015-10-21 14:18 ` [dpdk-dev] [PATCH 0/3] virtio: patches for 2.1+ 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=F52918179C57134FAEC9EA62FA2F962511CEC61A@shsmsx102.ccr.corp.intel.com \
    --to=changchun.ouyang@intel.com \
    --cc=dev@dpdk.org \
    --cc=huawei.xie@intel.com \
    --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).