]> git.baikalelectronics.ru Git - kernel.git/commit
vhost-net: fix use-after-free in vhost_net_flush
authorMichael S. Tsirkin <mst@redhat.com>
Tue, 25 Jun 2013 14:29:46 +0000 (17:29 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 7 Jul 2013 11:06:22 +0000 (14:06 +0300)
commit0666ce56e38dec4f0ea4bf4ec7ffeadecc9edadc
treea5286110beeea3f5fef0c86fb44535d91402ea3b
parentc96b444416394b316b552bc74f4b1ab4c64a5781
vhost-net: fix use-after-free in vhost_net_flush

vhost_net_ubuf_put_and_wait has a confusing name:
it will actually also free it's argument.
Thus since commit 0f97eddf067693735628cca3d65c829b9cf4d2bd
    "vhost-net: flush outstanding DMAs on memory change"
vhost_net_flush tries to use the argument after passing it
to vhost_net_ubuf_put_and_wait, this results
in use after free.
To fix, don't free the argument in vhost_net_ubuf_put_and_wait,
add an new API for callers that want to free ubufs.

Acked-by: Asias He <asias@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vhost/net.c