public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] VSOCK: Introduce vhost_vsock.ko
@ 2016-08-03  8:31 Dan Carpenter
  2016-08-04 12:49 ` Stefan Hajnoczi
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-08-03  8:31 UTC (permalink / raw)
  To: asias; +Cc: kvm

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-04 12:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-03  8:31 [bug report] VSOCK: Introduce vhost_vsock.ko Dan Carpenter
2016-08-04 12:49 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox