public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: asias@redhat.com
Cc: kvm@vger.kernel.org
Subject: [bug report] VSOCK: Introduce vhost_vsock.ko
Date: Wed, 3 Aug 2016 11:31:08 +0300	[thread overview]
Message-ID: <20160803083108.GA2622@mwanda> (raw)

Hello Asias He,

The patch 433fc58e6bf2: "VSOCK: Introduce vhost_vsock.ko" from Jul
28, 2016, leads to the following static checker warning:

	drivers/vhost/vsock.c:343 vhost_vsock_handle_tx_kick()
	error: dereferencing freed memory 'pkt'

drivers/vhost/vsock.c
   330  
   331                  pkt = vhost_vsock_alloc_pkt(vq, out, in);
   332                  if (!pkt) {
   333                          vq_err(vq, "Faulted on pkt\n");
   334                          continue;
   335                  }
   336  
   337                  /* Only accept correctly addressed packets */
   338                  if (le64_to_cpu(pkt->hdr.src_cid) == vsock->guest_cid)
   339                          virtio_transport_recv_pkt(pkt);
   340                  else
   341                          virtio_transport_free_pkt(pkt);
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   342  
   343                  vhost_add_used(vq, head, sizeof(pkt->hdr) + pkt->len);
                                                                    ^^^^^^^^
   344                  added = true;
   345          }
   346  
   347  no_more_replies:
   348          if (added)
   349                  vhost_signal(&vsock->dev, vq);
   350  
   351  out:
   352          mutex_unlock(&vq->mutex);
   353  }

regards,
dan carpenter

             reply	other threads:[~2016-08-03  8:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-03  8:31 Dan Carpenter [this message]
2016-08-04 12:49 ` [bug report] VSOCK: Introduce vhost_vsock.ko Stefan Hajnoczi

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=20160803083108.GA2622@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=asias@redhat.com \
    --cc=kvm@vger.kernel.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