]> git.proxmox.com Git - qemu.git/commit
tap: fix NULL dereference when passing invalid parameters to tap
authorJason Wang <jasowang@redhat.com>
Tue, 4 Jun 2013 05:18:17 +0000 (13:18 +0800)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 17 Jun 2013 21:35:39 +0000 (16:35 -0500)
commit5a893b0d37795f1f1d89caa2e36d9ff311cd2dc9
tree15b74e3e51f027b4fe5b2c8d6be9941a59a04d1e
parent0817fa97673acc71994a65e73449b632c069c22b
tap: fix NULL dereference when passing invalid parameters to tap

This patch forbid the following invalid parameters to tap:

1) fd and vhostfds were specified but vhostfd were not specified
2) vhostfds were specified but fds were not specified
3) fds and vhostfd were specified

For 1 and 2, net_init_tap_one() will still pass NULL as vhostfdname to
monitor_handle_fd_param(), which may crash the qemu.

Also remove the unnecessary has_fd check.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Stefan Hajnoczi <shajnocz@redhat.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit c87826a878be05208c3906eb9d5e1f37cff5e98e)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
net/tap.c